-
Notifications
You must be signed in to change notification settings - Fork 5
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): support member ordering
- Loading branch information
Showing
25 changed files
with
8,571 additions
and
3,478 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 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,13 +1,28 @@ | ||
module.exports = { | ||
extends: [], | ||
|
||
plugins: [], | ||
|
||
rules: { | ||
'import/no-webpack-loader-syntax': 'off', | ||
'sort-class-members/sort-class-members': 'off', | ||
'no-param-reassign': 'off', | ||
'@typescript-eslint/no-useless-constructor': 'off', | ||
'@typescript-eslint/no-extraneous-class': 'off', // incorrect working with constructor parameters | ||
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'), | ||
}, | ||
}, | ||
], | ||
}; |
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 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,14 @@ | ||
/** | ||
* @note: only rules from eslint base rules | ||
*/ | ||
module.exports = { | ||
'no-param-reassign': 'error', | ||
'@typescript-eslint/no-extraneous-class': ['error'], | ||
|
||
/** | ||
* @note: note you must disable the base rule | ||
* as it can report incorrect errors in @typescript-eslint | ||
*/ | ||
'no-useless-constructor': 'off', | ||
'@typescript-eslint/no-useless-constructor': ['error'], | ||
}; |
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,6 @@ | ||
/** | ||
* @note: only rules for imports | ||
*/ | ||
module.exports = { | ||
'import/no-webpack-loader-syntax': 'off', | ||
}; |
127 changes: 127 additions & 0 deletions
127
packages/eslint-config-angular/rules/member-ordering.js
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,127 @@ | ||
/** | ||
* @note: only rules which start with ^@typescript-eslint/ | ||
*/ | ||
module.exports = { | ||
/** | ||
* @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', | ||
], | ||
}, | ||
], | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.