@jkba/eslint-config-angular 1.0.1 → 1.2.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 +41 -4
- package/eslint.config.js +34 -2
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ npm i -D \
|
|
|
21
21
|
eslint-plugin-prettier \
|
|
22
22
|
eslint-plugin-rxjs \
|
|
23
23
|
eslint-plugin-rxjs-angular \
|
|
24
|
+
eslint-import-resolver-typescript \
|
|
24
25
|
@jkba/eslint-config-angular
|
|
25
26
|
|
|
26
27
|
```
|
|
@@ -30,7 +31,7 @@ npm i -D \
|
|
|
30
31
|
|
|
31
32
|
Extend your eslint configuration with `"@jkba/angular"`:
|
|
32
33
|
|
|
33
|
-
```
|
|
34
|
+
```js
|
|
34
35
|
// .eslintrc.json
|
|
35
36
|
|
|
36
37
|
{
|
|
@@ -49,14 +50,50 @@ module.exports = require('@jkba/eslint-config-angular/prettier.config');
|
|
|
49
50
|
|
|
50
51
|
### Modifying rules
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
Modify (add/disable/override) specific rules via the `rules` property:
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
// .eslintrc.json
|
|
57
|
+
|
|
58
|
+
{
|
|
59
|
+
"extends": [ "@jkba/angular" ],
|
|
60
|
+
"rules": {
|
|
61
|
+
"@typescript-eslint/prefer-nullish-coalescing": "off", // Requires the `strictNullChecks` compiler option to be turned on to function correctly.
|
|
62
|
+
"@typescript-eslint/no-unnecessary-condition": "off", // Requires the `strictNullChecks` compiler option to be turned on to function correctly.
|
|
63
|
+
"@angular-eslint/template/click-events-have-key-events": "off", // Accessibility is not supported on this project
|
|
64
|
+
"@angular-eslint/template/interactive-supports-focus": "off", // Accessibility is not supported on this project
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
or using the `overrides` property:
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
// .eslintrc.json
|
|
73
|
+
|
|
74
|
+
{
|
|
75
|
+
"extends": [ "@jkba/angular" ],
|
|
76
|
+
"overrides": [
|
|
77
|
+
{
|
|
78
|
+
"files": [ "*.html" ],
|
|
79
|
+
"parserOptions": { "parser": "@angular-eslint/template-parser" },
|
|
80
|
+
"rules": {
|
|
81
|
+
"@angular-eslint/template/i18n": "off" // i18n is not supported on this project
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Reference [Overriding Settings from Shareable Configs](https://eslint.org/docs/latest/extend/shareable-configs#overriding-settings-from-shareable-configs).
|
|
53
89
|
|
|
54
90
|
|
|
55
91
|
## Build
|
|
56
92
|
|
|
57
|
-
|
|
93
|
+
Use `npm link` and then `npm link @jkba/eslint-config-angular` in your project.
|
|
94
|
+
PRs are welcome but keep in mind this is an opinionated configuration.
|
|
58
95
|
|
|
59
|
-
|
|
96
|
+
Reference [Share Configurations](https://eslint.org/docs/latest/extend/shareable-configs).
|
|
60
97
|
|
|
61
98
|
|
|
62
99
|
## License
|
package/eslint.config.js
CHANGED
|
@@ -24,7 +24,7 @@ module.exports = {
|
|
|
24
24
|
// This rule might intentionally disable some rules declared above due to conflicts
|
|
25
25
|
'plugin:prettier/recommended',
|
|
26
26
|
],
|
|
27
|
-
plugins: ['@typescript-eslint', '@angular-eslint', 'rxjs', 'rxjs-angular'],
|
|
27
|
+
plugins: ['@typescript-eslint', '@angular-eslint', 'rxjs', 'rxjs-angular', 'import'],
|
|
28
28
|
settings: {
|
|
29
29
|
// Reference https://www.npmjs.com/package/eslint-plugin-import
|
|
30
30
|
'import/resolver': {
|
|
@@ -47,6 +47,29 @@ module.exports = {
|
|
|
47
47
|
'rxjs-angular/prefer-async-pipe': 'error',
|
|
48
48
|
'rxjs-angular/prefer-composition': 'error',
|
|
49
49
|
'rxjs-angular/prefer-takeuntil': 'error',
|
|
50
|
+
|
|
51
|
+
// Reference https://github.com/cartant/eslint-plugin-rxjs/blob/main/docs/rules/finnish.md
|
|
52
|
+
'rxjs/finnish': [
|
|
53
|
+
'error',
|
|
54
|
+
{
|
|
55
|
+
'functions': false,
|
|
56
|
+
'methods': false,
|
|
57
|
+
'names': {
|
|
58
|
+
'^(canActivate|canActivateChild|canDeactivate|canLoad|intercept|resolve|validate)$': false
|
|
59
|
+
},
|
|
60
|
+
'parameters': true,
|
|
61
|
+
'properties': true,
|
|
62
|
+
'strict': false,
|
|
63
|
+
'types': {
|
|
64
|
+
'^EventEmitter$': false,
|
|
65
|
+
'^Store$': false
|
|
66
|
+
},
|
|
67
|
+
'variables': true
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
'rxjs/no-exposed-subjects': [ 'error', { 'allowProtected': true } ],
|
|
71
|
+
'rxjs/no-compat': 'error',
|
|
72
|
+
'rxjs/throw-error': 'error',
|
|
50
73
|
|
|
51
74
|
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }], // Ignore `Validators.required` etc.
|
|
52
75
|
'@typescript-eslint/no-confusing-void-expression': 'off', // I just simply disagree with this rule
|
|
@@ -79,7 +102,13 @@ module.exports = {
|
|
|
79
102
|
'import/order': [
|
|
80
103
|
'error',
|
|
81
104
|
{
|
|
82
|
-
'groups': [
|
|
105
|
+
'groups': [
|
|
106
|
+
['builtin', 'external'],
|
|
107
|
+
'internal',
|
|
108
|
+
'parent',
|
|
109
|
+
'sibling',
|
|
110
|
+
'index',
|
|
111
|
+
],
|
|
83
112
|
'newlines-between': 'always',
|
|
84
113
|
'alphabetize': {
|
|
85
114
|
'order': 'asc',
|
|
@@ -87,6 +116,9 @@ module.exports = {
|
|
|
87
116
|
}
|
|
88
117
|
}
|
|
89
118
|
],
|
|
119
|
+
'import/no-useless-path-segments': ['error', { noUselessIndex: true }],
|
|
120
|
+
// 'import/no-deprecated': 'error', // Throws false-positive for RxJS,
|
|
121
|
+
'import/no-self-import': 'error',
|
|
90
122
|
},
|
|
91
123
|
},
|
|
92
124
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jkba/eslint-config-angular",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.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": {
|
|
@@ -31,18 +32,19 @@
|
|
|
31
32
|
},
|
|
32
33
|
"homepage": "https://github.com/jmeinlschmidt/eslint-config-angular#readme",
|
|
33
34
|
"peerDependencies": {
|
|
34
|
-
"eslint": ">=8",
|
|
35
|
-
"typescript": ">=4",
|
|
36
|
-
"prettier": ">=3",
|
|
37
35
|
"@angular-eslint/eslint-plugin": ">=16",
|
|
38
36
|
"@angular-eslint/eslint-plugin-template": ">=16",
|
|
39
37
|
"@angular-eslint/template-parser": ">=16",
|
|
40
38
|
"@typescript-eslint/eslint-plugin": ">=6",
|
|
41
39
|
"@typescript-eslint/parser": ">=6",
|
|
42
|
-
"eslint
|
|
40
|
+
"eslint": ">=8",
|
|
43
41
|
"eslint-config-prettier": ">=8",
|
|
42
|
+
"eslint-plugin-import": ">=2.27.0",
|
|
44
43
|
"eslint-plugin-prettier": ">=5",
|
|
45
44
|
"eslint-plugin-rxjs": ">=5",
|
|
46
|
-
"eslint-plugin-rxjs-angular": ">=2"
|
|
45
|
+
"eslint-plugin-rxjs-angular": ">=2",
|
|
46
|
+
"eslint-import-resolver-typescript": ">= 3.5.5",
|
|
47
|
+
"prettier": ">=3",
|
|
48
|
+
"typescript": ">=4"
|
|
47
49
|
}
|
|
48
50
|
}
|