WebUI: Enforce naming style with more ESLint checks in TS files.
Specifically enforcing naming for class, interface, typeAlias, enum,
typeParameter, classMethod and parameter cases to match the
styleguide at [1].
[1] https://google.github.io/styleguide/jsguide.html#naming
Bug: 720034
Change-Id: I80a1000d500e5770aaff1fea5f944fd43f9ac877
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3632596
Reviewed-by: Rebekah Potter <[email protected]>
Auto-Submit: Demetrios Papadopoulos <[email protected]>
Commit-Queue: Rebekah Potter <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1001357}
diff --git a/.eslintrc.js b/.eslintrc.js
index 5399713..c1ceeebd 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -73,18 +73,28 @@
'semi': 'off',
'@typescript-eslint/semi': ['error'],
+ // https://google.github.io/styleguide/jsguide.html#naming
'@typescript-eslint/naming-convention': [
'error',
{
- // https://google.github.io/styleguide/jsguide.html#naming-enum-names
- selector: 'enum',
+ selector: ['class', 'interface', 'typeAlias', 'enum', 'typeParameter'],
format: ['PascalCase'],
},
{
- // https://google.github.io/styleguide/jsguide.html#naming-enum-names
selector: 'enumMember',
format: ['UPPER_CASE'],
},
+ {
+ selector: 'classMethod',
+ format: ['camelCase'],
+ leadingUnderscore: 'allow',
+ trailingUnderscore: 'allow',
+ },
+ {
+ selector: 'parameter',
+ format: ['camelCase'],
+ leadingUnderscore: 'allow',
+ },
],
'@typescript-eslint/member-delimiter-style': ['error', {