@jkba/eslint-config-angular 1.3.1 → 1.4.1
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 +11 -0
- package/eslint.config.js +11 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -103,6 +103,17 @@ or using the `overrides` property:
|
|
|
103
103
|
Reference [Overriding Settings from Shareable Configs](https://eslint.org/docs/latest/extend/shareable-configs#overriding-settings-from-shareable-configs).
|
|
104
104
|
|
|
105
105
|
|
|
106
|
+
### Rules for apps
|
|
107
|
+
|
|
108
|
+
Some of the rules declared in this package are quite strict and might be considered more suitable for publishable libraries than applications. Applying such rules in application context probably won't bring any significant results in code quality thus may be considered ineffective.
|
|
109
|
+
|
|
110
|
+
Especially when using structure like Nx Workspace, it is possible to adjust the rules per library. In my use-cases, I tend to disable the following rules in purely feature (application) related libraries but keep them enabled in, for example, shared libraries.
|
|
111
|
+
|
|
112
|
+
- `@typescript-eslint/explicit-member-accessibility`
|
|
113
|
+
- `rxjs/no-exposed-subjects`
|
|
114
|
+
- `@angular-eslint/prefer-output-readonly`
|
|
115
|
+
|
|
116
|
+
|
|
106
117
|
## Build
|
|
107
118
|
|
|
108
119
|
Use `npm link` and then `npm link @jkba/eslint-config-angular` in your project.
|
package/eslint.config.js
CHANGED
|
@@ -36,8 +36,16 @@ module.exports = {
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
rules: {
|
|
39
|
+
'no-implicit-coercion': 'error',
|
|
40
|
+
'no-self-compare': 'error',
|
|
41
|
+
'no-unmodified-loop-condition': 'error',
|
|
42
|
+
'no-unreachable-loop': 'error',
|
|
43
|
+
'default-case': 'warn',
|
|
44
|
+
'eqeqeq': 'error',
|
|
45
|
+
'max-classes-per-file': 'error',
|
|
39
46
|
'no-warning-comments': [ 'error', { 'terms': ['todo', 'fixme'], 'location': 'anywhere' } ],
|
|
40
47
|
'no-console': 'error',
|
|
48
|
+
'prefer-template': 'error',
|
|
41
49
|
|
|
42
50
|
/**
|
|
43
51
|
* Declaration sort is handled by import/order rule.
|
|
@@ -53,7 +61,7 @@ module.exports = {
|
|
|
53
61
|
|
|
54
62
|
'rxjs-angular/prefer-async-pipe': 'warn',
|
|
55
63
|
'rxjs-angular/prefer-composition': 'off', // I prefer takeUntilDestroyed() operator
|
|
56
|
-
'rxjs-angular/prefer-takeuntil': '
|
|
64
|
+
'rxjs-angular/prefer-takeuntil': 'off', // I prefer takeUntilDestroyed() operator
|
|
57
65
|
|
|
58
66
|
// Reference https://github.com/cartant/eslint-plugin-rxjs/blob/main/docs/rules/finnish.md
|
|
59
67
|
'rxjs/finnish': [
|
|
@@ -84,6 +92,7 @@ module.exports = {
|
|
|
84
92
|
'@typescript-eslint/explicit-member-accessibility': [
|
|
85
93
|
'error', { 'overrides': { 'constructors': 'no-public' } }
|
|
86
94
|
],
|
|
95
|
+
"@typescript-eslint/prefer-optional-chain": "error",
|
|
87
96
|
|
|
88
97
|
'@angular-eslint/sort-ngmodule-metadata-arrays': 'error',
|
|
89
98
|
'@angular-eslint/prefer-on-push-component-change-detection': 'error',
|
|
@@ -159,7 +168,7 @@ module.exports = {
|
|
|
159
168
|
],
|
|
160
169
|
plugins: ['@angular-eslint/template'],
|
|
161
170
|
rules: {
|
|
162
|
-
|
|
171
|
+
'@angular-eslint/template/attributes-order': 'error',
|
|
163
172
|
'@angular-eslint/template/no-inline-styles': 'warn', // For me, it is only a suggestion
|
|
164
173
|
'@angular-eslint/template/conditional-complexity': [
|
|
165
174
|
'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.4.1",
|
|
4
4
|
"description": "Opinionated ESLint config for Angular projects",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"@angular-eslint/eslint-plugin-template": ">=16",
|
|
37
37
|
"@angular-eslint/template-parser": ">=16",
|
|
38
38
|
"@ngrx/eslint-plugin": "^16.2.0",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": ">=
|
|
40
|
-
"@typescript-eslint/parser": ">=
|
|
39
|
+
"@typescript-eslint/eslint-plugin": ">=6",
|
|
40
|
+
"@typescript-eslint/parser": ">=6",
|
|
41
41
|
"eslint": ">=8",
|
|
42
42
|
"eslint-config-prettier": ">=8",
|
|
43
|
-
"eslint-import-resolver-typescript": ">=
|
|
43
|
+
"eslint-import-resolver-typescript": ">=3.5.5",
|
|
44
44
|
"eslint-plugin-import": ">=2.27.0",
|
|
45
45
|
"eslint-plugin-prettier": ">=5",
|
|
46
46
|
"eslint-plugin-rxjs": ">=5",
|