Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eslint-config-angular): decomposition by internal settings
- Loading branch information
Showing
10 changed files
with
205 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,4 @@ | ||
module.exports = { | ||
extends: [], | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true, | ||
}, | ||
parserOptions: { | ||
createDefaultProgram: true, | ||
project: 'tsconfig*.json', | ||
sourceType: 'module', | ||
errorOnUnknownASTType: true, | ||
errorOnTypeScriptSyntacticAndSemanticIssues: true, | ||
warnOnUnsupportedTypeScriptVersion: false, | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['*.ts'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['sort-class-members', '@typescript-eslint'], | ||
rules: { | ||
...require('./rules/base'), | ||
...require('./rules/import'), | ||
...require('./rules/member-ordering'), | ||
}, | ||
}, | ||
], | ||
env: { browser: true, es6: true, node: true }, | ||
extends: ['./internal/base', './internal/import', './internal/typescript'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
extends: [], | ||
parser: '@typescript-eslint/parser', | ||
rules: { | ||
'no-param-reassign': 'error', | ||
|
||
/** | ||
* @note: note you must disable the base rule | ||
* as it can report incorrect errors in @typescript-eslint | ||
*/ | ||
'no-useless-constructor': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
extends: [], | ||
parser: '@typescript-eslint/parser', | ||
settings: { | ||
'import/parsers': { '@typescript-eslint/parser': ['.ts'] }, | ||
'import/resolver': { 'eslint-import-resolver-typescript': true }, | ||
}, | ||
rules: { | ||
'import/no-webpack-loader-syntax': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
module.exports = { | ||
overrides: [ | ||
{ | ||
files: ['*.ts'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint', 'sort-class-members'], | ||
parserOptions: { | ||
sourceType: 'module', | ||
errorOnUnknownASTType: true, | ||
errorOnTypeScriptSyntacticAndSemanticIssues: true, | ||
warnOnUnsupportedTypeScriptVersion: false, | ||
ecmaVersion: 6, | ||
}, | ||
rules: { | ||
'@typescript-eslint/no-extraneous-class': [ | ||
'error', | ||
{ | ||
allowConstructorOnly: true, | ||
allowEmpty: false, | ||
allowStaticOnly: true, | ||
allowWithDecorator: true, | ||
}, | ||
], | ||
|
||
'@typescript-eslint/no-useless-constructor': ['error'], | ||
|
||
/** | ||
* @note(splincode): use @typescript-eslint/member-ordering instead | ||
*/ | ||
'sort-class-members/sort-class-members': 'off', | ||
'@typescript-eslint/member-ordering': [ | ||
'error', | ||
{ | ||
default: [ | ||
'signature', | ||
/** | ||
* static fields | ||
* [sort: public -> protected -> private] | ||
**/ | ||
'public-static-field', | ||
'protected-static-field', | ||
'private-static-field', | ||
|
||
/** | ||
* abstract fields | ||
* [sort: public -> protected -> private] | ||
**/ | ||
'public-abstract-field', | ||
'protected-abstract-field', | ||
'private-abstract-field', | ||
|
||
/** | ||
* instance fields | ||
* [sort: private -> protected -> public] | ||
* [sort: decorated -> non-decorated] | ||
**/ | ||
'private-decorated-field', | ||
'private-instance-field', | ||
'protected-decorated-field', | ||
'protected-instance-field', | ||
'public-decorated-field', | ||
'public-instance-field', | ||
|
||
/** | ||
* constructors | ||
* [sort: public -> protected -> private] | ||
**/ | ||
'public-constructor', | ||
'protected-constructor', | ||
'private-constructor', | ||
|
||
/** | ||
* @note(splincode): | ||
* We have deliberately disabled this rule | ||
* because it can break a lot of the codebase. | ||
* | ||
* static accessors | ||
* [sort: public -> protected -> private] | ||
**/ | ||
/* | ||
'public-static-get', | ||
'public-static-set', | ||
'protected-static-get', | ||
'protected-static-set', | ||
'private-static-get', | ||
'private-static-set', | ||
*/ | ||
|
||
/** | ||
* @note(splincode): | ||
* We have deliberately disabled this rule | ||
* because it can break a lot of the codebase. | ||
* | ||
* instance accessors | ||
* [sort: public -> protected -> private] | ||
* [sort: decorated -> non-decorated] | ||
**/ | ||
/* | ||
'public-decorated-get', | ||
'public-instance-get', | ||
'public-decorated-set', | ||
'public-instance-set', | ||
'protected-decorated-get', | ||
'protected-instance-get', | ||
'protected-decorated-set', | ||
'protected-instance-set', | ||
'private-decorated-get', | ||
'private-instance-get', | ||
'private-decorated-set', | ||
'private-instance-set', | ||
*/ | ||
|
||
/** | ||
* static methods | ||
* [sort: public -> protected -> private] | ||
**/ | ||
'public-static-method', | ||
'protected-static-method', | ||
'private-static-method', | ||
|
||
/** | ||
* abstract | ||
* [sort: public -> private -> protected] | ||
**/ | ||
'public-abstract-get', | ||
'public-abstract-set', | ||
'protected-abstract-get', | ||
'protected-abstract-set', | ||
'private-abstract-get', | ||
'private-abstract-set', | ||
'public-abstract-method', | ||
'protected-abstract-method', | ||
'private-abstract-method', | ||
|
||
/** | ||
* methods | ||
* [sort: public -> protected -> private] | ||
* [sort: decorated -> non-decorated] | ||
**/ | ||
'public-decorated-method', | ||
'public-instance-method', | ||
'protected-decorated-method', | ||
'protected-instance-method', | ||
'private-decorated-method', | ||
'private-instance-method', | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['*.spec.ts'], | ||
rules: { | ||
'@typescript-eslint/no-extraneous-class': 'off', | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
127 changes: 0 additions & 127 deletions
127
packages/eslint-config-angular/rules/member-ordering.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.