@jkba/eslint-config-angular 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/eslint.config.js +33 -4
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ npm i -D \
|
|
|
16
16
|
@angular-eslint/template-parser \
|
|
17
17
|
@typescript-eslint/eslint-plugin \
|
|
18
18
|
@typescript-eslint/parser \
|
|
19
|
+
@ngrx/eslint-plugin \
|
|
19
20
|
eslint-plugin-import \
|
|
20
21
|
eslint-config-prettier \
|
|
21
22
|
eslint-plugin-prettier \
|
|
@@ -48,6 +49,20 @@ module.exports = require('@jkba/eslint-config-angular/prettier.config');
|
|
|
48
49
|
```
|
|
49
50
|
|
|
50
51
|
|
|
52
|
+
### Enable Prettier
|
|
53
|
+
|
|
54
|
+
In VSCode, add the following lines to your `settings.json`
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"prettier.enable": true,
|
|
59
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
60
|
+
"[html]": {
|
|
61
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
51
66
|
### Modifying rules
|
|
52
67
|
|
|
53
68
|
Modify (add/disable/override) specific rules via the `rules` property:
|
package/eslint.config.js
CHANGED
|
@@ -19,6 +19,7 @@ module.exports = {
|
|
|
19
19
|
'plugin:rxjs/recommended', // For some unknown weird reason, this plugin needs to be installed in child project as well.
|
|
20
20
|
'plugin:import/recommended',
|
|
21
21
|
'plugin:import/typescript',
|
|
22
|
+
'plugin:@ngrx/all',
|
|
22
23
|
|
|
23
24
|
// Prettier rule must always be the very last!
|
|
24
25
|
// This rule might intentionally disable some rules declared above due to conflicts
|
|
@@ -44,10 +45,40 @@ module.exports = {
|
|
|
44
45
|
*/
|
|
45
46
|
'sort-imports': [ 'error', { 'ignoreDeclarationSort': true }],
|
|
46
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Handled by https://typescript-eslint.io/rules/no-unused-vars/
|
|
50
|
+
* You must disable the base rule as it can report incorrect errors
|
|
51
|
+
*/
|
|
52
|
+
'no-unused-vars': 'off',
|
|
53
|
+
|
|
47
54
|
'rxjs-angular/prefer-async-pipe': 'error',
|
|
48
55
|
'rxjs-angular/prefer-composition': 'error',
|
|
49
56
|
'rxjs-angular/prefer-takeuntil': 'error',
|
|
57
|
+
|
|
58
|
+
// Reference https://github.com/cartant/eslint-plugin-rxjs/blob/main/docs/rules/finnish.md
|
|
59
|
+
'rxjs/finnish': [
|
|
60
|
+
'error',
|
|
61
|
+
{
|
|
62
|
+
'functions': false,
|
|
63
|
+
'methods': false,
|
|
64
|
+
'names': {
|
|
65
|
+
'^(canActivate|canActivateChild|canDeactivate|canLoad|intercept|resolve|validate)$': false
|
|
66
|
+
},
|
|
67
|
+
'parameters': true,
|
|
68
|
+
'properties': true,
|
|
69
|
+
'strict': false,
|
|
70
|
+
'types': {
|
|
71
|
+
'^EventEmitter$': false,
|
|
72
|
+
'^Store$': false
|
|
73
|
+
},
|
|
74
|
+
'variables': true
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
'rxjs/no-exposed-subjects': [ 'error', { 'allowProtected': true } ],
|
|
78
|
+
'rxjs/no-compat': 'error',
|
|
79
|
+
'rxjs/throw-error': 'error',
|
|
50
80
|
|
|
81
|
+
'@typescript-eslint/no-unused-vars': ['error', { 'args': 'after-used' }],
|
|
51
82
|
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }], // Ignore `Validators.required` etc.
|
|
52
83
|
'@typescript-eslint/no-confusing-void-expression': 'off', // I just simply disagree with this rule
|
|
53
84
|
'@typescript-eslint/explicit-member-accessibility': [
|
|
@@ -57,10 +88,9 @@ module.exports = {
|
|
|
57
88
|
'@angular-eslint/sort-ngmodule-metadata-arrays': 'error',
|
|
58
89
|
'@angular-eslint/prefer-on-push-component-change-detection': 'error',
|
|
59
90
|
'@angular-eslint/use-component-view-encapsulation': 'warn', // For me, it is only a suggestion
|
|
60
|
-
'@angular-eslint/prefer-output-readonly': 'error', // TODO:
|
|
91
|
+
'@angular-eslint/prefer-output-readonly': 'error', // TODO: https://github.com/jmeinlschmidt/eslint-config-angular/issues/14
|
|
61
92
|
'@angular-eslint/contextual-decorator': 'error',
|
|
62
93
|
'@angular-eslint/component-max-inline-declarations': [ 'error', { 'template': 20 } ],
|
|
63
|
-
'@angular-eslint/contextual-decorator': 'error',
|
|
64
94
|
'@angular-eslint/no-attribute-decorator': 'error',
|
|
65
95
|
'@angular-eslint/no-conflicting-lifecycle': 'error',
|
|
66
96
|
'@angular-eslint/no-empty-lifecycle-method': 'error',
|
|
@@ -71,7 +101,7 @@ module.exports = {
|
|
|
71
101
|
'@angular-eslint/no-queries-metadata-property': 'error',
|
|
72
102
|
'@angular-eslint/prefer-standalone-component': 'error',
|
|
73
103
|
'@angular-eslint/relative-url-prefix': 'error',
|
|
74
|
-
// '@angular-eslint/require-localize-metadata': 'error', // TODO:
|
|
104
|
+
// '@angular-eslint/require-localize-metadata': 'error', // TODO: https://github.com/jmeinlschmidt/eslint-config-angular/issues/13
|
|
75
105
|
'@angular-eslint/use-component-selector': 'error',
|
|
76
106
|
|
|
77
107
|
'import/no-absolute-path': 'error',
|
|
@@ -114,7 +144,6 @@ module.exports = {
|
|
|
114
144
|
plugins: ['@angular-eslint/template'],
|
|
115
145
|
rules: {
|
|
116
146
|
// '@angular-eslint/template/attributes-order': 'error', // TODO: Bug present (https://github.com/angular-eslint/angular-eslint/issues/1456)
|
|
117
|
-
'@angular-eslint/template/button-has-type': 'warn', // For me, it is only a suggestion
|
|
118
147
|
'@angular-eslint/template/no-inline-styles': 'warn', // For me, it is only a suggestion
|
|
119
148
|
'@angular-eslint/template/conditional-complexity': [
|
|
120
149
|
'error', { 'maxComplexity': 3 } // Max 3 is enough, create derived variable with proper naming
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jkba/eslint-config-angular",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Opinionated ESLint config for Angular projects",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"package.json",
|
|
25
25
|
"prettier.config.js"
|
|
26
26
|
],
|
|
27
|
+
"readme": "README.md",
|
|
27
28
|
"author": "Jakub Meinlschmidt",
|
|
28
29
|
"license": "MIT",
|
|
29
30
|
"bugs": {
|
|
@@ -34,15 +35,16 @@
|
|
|
34
35
|
"@angular-eslint/eslint-plugin": ">=16",
|
|
35
36
|
"@angular-eslint/eslint-plugin-template": ">=16",
|
|
36
37
|
"@angular-eslint/template-parser": ">=16",
|
|
38
|
+
"@ngrx/eslint-plugin": "^16.2.0",
|
|
37
39
|
"@typescript-eslint/eslint-plugin": ">=6",
|
|
38
40
|
"@typescript-eslint/parser": ">=6",
|
|
39
41
|
"eslint": ">=8",
|
|
40
42
|
"eslint-config-prettier": ">=8",
|
|
43
|
+
"eslint-import-resolver-typescript": ">= 3.5.5",
|
|
41
44
|
"eslint-plugin-import": ">=2.27.0",
|
|
42
45
|
"eslint-plugin-prettier": ">=5",
|
|
43
46
|
"eslint-plugin-rxjs": ">=5",
|
|
44
47
|
"eslint-plugin-rxjs-angular": ">=2",
|
|
45
|
-
"eslint-import-resolver-typescript": ">= 3.5.5",
|
|
46
48
|
"prettier": ">=3",
|
|
47
49
|
"typescript": ">=4"
|
|
48
50
|
}
|