Skip to content

Commit

Permalink
feat(eslint-config-angular): add strict rules as experimental sub-pac…
Browse files Browse the repository at this point in the history
…kage (#225)
  • Loading branch information
splincode authored Dec 1, 2022
1 parent f7f574b commit cc5d609
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 13 deletions.
2 changes: 2 additions & 0 deletions packages/eslint-config-angular/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/test/**
CHANGELOG.md
4 changes: 4 additions & 0 deletions packages/eslint-config-angular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ You can also include `optional` configurations, however, you are responsible for
'@tinkoff/eslint-config-angular/line-statements',
'@tinkoff/eslint-config-angular/member-ordering',
'@tinkoff/eslint-config-angular/decorator-position',
'@tinkoff/eslint-config-angular/function-return-type',

// experimental strict rules
'@tinkoff/eslint-config-angular/experimental',
],
}
```
Expand Down
29 changes: 29 additions & 0 deletions packages/eslint-config-angular/experimental/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
overrides: [
{
files: ['*.ts'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/no-base-to-string': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/no-use-before-define': [
'error',
{
functions: false,
classes: false,
variables: true,
enums: true,
typedefs: true,
},
],
},
},
],
};
21 changes: 21 additions & 0 deletions packages/eslint-config-angular/function-return-type/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
overrides: [
{
files: ['*.ts'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/explicit-function-return-type': [
'error',
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
allowDirectConstAssertionInArrowFunctions: true,
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
},
],
},
},
],
};
13 changes: 0 additions & 13 deletions packages/eslint-config-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,6 @@
"eslintconfig",
"eslint-config"
],
"files": [
"html",
"imports",
"line-statements",
"member-ordering",
"promise",
"file-progress",
"decorator-position",
"recommended",
"rxjs",
"index.js",
"README.md"
],
"scripts": {},
"main": "index.js",
"author": {
Expand Down
3 changes: 3 additions & 0 deletions packages/eslint-config-angular/recommended/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@ module.exports = {
},
],
eqeqeq: ['error', 'always'],
'no-useless-concat': 'error',
'prefer-template': 'error',
curly: ['error', 'all'],
},
};

0 comments on commit cc5d609

Please sign in to comment.