Skip to content

Conversation

jrieken
Copy link
Member

@jrieken jrieken commented Nov 2, 2022

rules to check that properties starting with underscore are private

related to #165117

@jrieken jrieken marked this pull request as draft November 2, 2022 17:04
@jrieken jrieken self-assigned this Nov 2, 2022
Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use the naming-converations rule for this:

"@typescript-eslint/naming-convention": [
  "warn",
  {
	"selector": "default",
	"modifiers": ["public"],
	"format": null,
	"leadingUnderscore": "forbid"
  }
]

@mjbvz
Copy link
Collaborator

mjbvz commented Nov 3, 2022

Here's an updated eslint rule that forbids leading underscores on public and protected service properties:

"@typescript-eslint/naming-convention": [
	"warn",
{
	"selector": "default",
	"modifiers": [
		"public"
	],
	"format": null,
	"filter": "^_\\w+Service",
	"leadingUnderscore": "forbid"
},
{
	"selector": "default",
	"modifiers": [
		"protected"
	],
	"format": null,
	"filter": "^_\\w+Service",
	"leadingUnderscore": "forbid"
}
],

This identifies 91 errors in our codebase

@jrieken
Copy link
Member Author

jrieken commented Nov 8, 2022

closing this - we have a different approach where we don't need this

@jrieken jrieken closed this Nov 8, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants