@jkba/eslint-config-angular 1.2.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 +10 -4
- package/package.json +3 -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,6 +45,12 @@ 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',
|
|
@@ -71,6 +78,7 @@ module.exports = {
|
|
|
71
78
|
'rxjs/no-compat': 'error',
|
|
72
79
|
'rxjs/throw-error': 'error',
|
|
73
80
|
|
|
81
|
+
'@typescript-eslint/no-unused-vars': ['error', { 'args': 'after-used' }],
|
|
74
82
|
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }], // Ignore `Validators.required` etc.
|
|
75
83
|
'@typescript-eslint/no-confusing-void-expression': 'off', // I just simply disagree with this rule
|
|
76
84
|
'@typescript-eslint/explicit-member-accessibility': [
|
|
@@ -80,10 +88,9 @@ module.exports = {
|
|
|
80
88
|
'@angular-eslint/sort-ngmodule-metadata-arrays': 'error',
|
|
81
89
|
'@angular-eslint/prefer-on-push-component-change-detection': 'error',
|
|
82
90
|
'@angular-eslint/use-component-view-encapsulation': 'warn', // For me, it is only a suggestion
|
|
83
|
-
'@angular-eslint/prefer-output-readonly': 'error', // TODO:
|
|
91
|
+
'@angular-eslint/prefer-output-readonly': 'error', // TODO: https://github.com/jmeinlschmidt/eslint-config-angular/issues/14
|
|
84
92
|
'@angular-eslint/contextual-decorator': 'error',
|
|
85
93
|
'@angular-eslint/component-max-inline-declarations': [ 'error', { 'template': 20 } ],
|
|
86
|
-
'@angular-eslint/contextual-decorator': 'error',
|
|
87
94
|
'@angular-eslint/no-attribute-decorator': 'error',
|
|
88
95
|
'@angular-eslint/no-conflicting-lifecycle': 'error',
|
|
89
96
|
'@angular-eslint/no-empty-lifecycle-method': 'error',
|
|
@@ -94,7 +101,7 @@ module.exports = {
|
|
|
94
101
|
'@angular-eslint/no-queries-metadata-property': 'error',
|
|
95
102
|
'@angular-eslint/prefer-standalone-component': 'error',
|
|
96
103
|
'@angular-eslint/relative-url-prefix': 'error',
|
|
97
|
-
// '@angular-eslint/require-localize-metadata': 'error', // TODO:
|
|
104
|
+
// '@angular-eslint/require-localize-metadata': 'error', // TODO: https://github.com/jmeinlschmidt/eslint-config-angular/issues/13
|
|
98
105
|
'@angular-eslint/use-component-selector': 'error',
|
|
99
106
|
|
|
100
107
|
'import/no-absolute-path': 'error',
|
|
@@ -137,7 +144,6 @@ module.exports = {
|
|
|
137
144
|
plugins: ['@angular-eslint/template'],
|
|
138
145
|
rules: {
|
|
139
146
|
// '@angular-eslint/template/attributes-order': 'error', // TODO: Bug present (https://github.com/angular-eslint/angular-eslint/issues/1456)
|
|
140
|
-
'@angular-eslint/template/button-has-type': 'warn', // For me, it is only a suggestion
|
|
141
147
|
'@angular-eslint/template/no-inline-styles': 'warn', // For me, it is only a suggestion
|
|
142
148
|
'@angular-eslint/template/conditional-complexity': [
|
|
143
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": {
|
|
@@ -35,15 +35,16 @@
|
|
|
35
35
|
"@angular-eslint/eslint-plugin": ">=16",
|
|
36
36
|
"@angular-eslint/eslint-plugin-template": ">=16",
|
|
37
37
|
"@angular-eslint/template-parser": ">=16",
|
|
38
|
+
"@ngrx/eslint-plugin": "^16.2.0",
|
|
38
39
|
"@typescript-eslint/eslint-plugin": ">=6",
|
|
39
40
|
"@typescript-eslint/parser": ">=6",
|
|
40
41
|
"eslint": ">=8",
|
|
41
42
|
"eslint-config-prettier": ">=8",
|
|
43
|
+
"eslint-import-resolver-typescript": ">= 3.5.5",
|
|
42
44
|
"eslint-plugin-import": ">=2.27.0",
|
|
43
45
|
"eslint-plugin-prettier": ">=5",
|
|
44
46
|
"eslint-plugin-rxjs": ">=5",
|
|
45
47
|
"eslint-plugin-rxjs-angular": ">=2",
|
|
46
|
-
"eslint-import-resolver-typescript": ">= 3.5.5",
|
|
47
48
|
"prettier": ">=3",
|
|
48
49
|
"typescript": ">=4"
|
|
49
50
|
}
|