Skip to content

Commit

Permalink
feat: [M3-8947] - Improve linter rules for naming convention (linode#…
Browse files Browse the repository at this point in the history
…11337)

* Add linter rules for naming convention

* Add rules for typeLike

* Add rules for destrctured variables

* Added changeset: Linter rules for naming convention

* Added changeset: Linter rules for naming convention
  • Loading branch information
pmakode-akamai authored Dec 2, 2024
1 parent 4f777b9 commit 8611b57
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 9 deletions.
5 changes: 5 additions & 0 deletions packages/api-v4/.changeset/pr-11337-added-1732714186488.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/api-v4": Added
---

Linter rules for naming convention ([#11337](https://github.com/linode/manager/pull/11337))
45 changes: 36 additions & 9 deletions packages/api-v4/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,42 @@
"plugin:prettier/recommended"
],
"rules": {
"@typescript-eslint/naming-convention": [
"warn",
{
"format": ["camelCase", "UPPER_CASE", "PascalCase"],
"leadingUnderscore": "allow",
"selector": "variable",
"trailingUnderscore": "allow"
},
{
"format": null,
"modifiers": ["destructured"],
"selector": "variable"
},
{
"format": ["camelCase", "PascalCase"],
"selector": "function"
},
{
"format": ["camelCase"],
"leadingUnderscore": "allow",
"selector": "parameter"
},
{
"format": ["PascalCase"],
"selector": "typeLike"
}
],
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-namespace": "warn",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-empty-interface": "warn",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/interface-name-prefix": "off",
"no-unused-vars": [
"warn",
{
Expand All @@ -33,15 +69,6 @@
"no-console": "error",
"no-undef-init": "off",
"radix": "error",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-namespace": "warn",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-empty-interface": "warn",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/interface-name-prefix": "off",
"sonarjs/cognitive-complexity": "warn",
"sonarjs/no-duplicate-string": "warn",
"sonarjs/prefer-immediate-return": "warn",
Expand Down
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11337-added-1732714227095.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Added
---

Linter rules for naming convention ([#11337](https://github.com/linode/manager/pull/11337))
27 changes: 27 additions & 0 deletions packages/manager/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,33 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/naming-convention': [
'warn',
{
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
leadingUnderscore: 'allow',
selector: 'variable',
trailingUnderscore: 'allow',
},
{
format: null,
modifiers: ['destructured'],
selector: 'variable',
},
{
format: ['camelCase', 'PascalCase'],
selector: 'function',
},
{
format: ['camelCase'],
leadingUnderscore: 'allow',
selector: 'parameter',
},
{
format: ['PascalCase'],
selector: 'typeLike',
},
],
'@typescript-eslint/no-empty-interface': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-inferrable-types': 'off',
Expand Down

0 comments on commit 8611b57

Please sign in to comment.