@jkba/eslint-config-angular 1.3.0 → 1.4.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 +16 -0
- package/eslint.config.js +28 -3
- package/package.json +2 -2
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.
|
|
@@ -111,6 +122,11 @@ PRs are welcome but keep in mind this is an opinionated configuration.
|
|
|
111
122
|
Reference [Share Configurations](https://eslint.org/docs/latest/extend/shareable-configs).
|
|
112
123
|
|
|
113
124
|
|
|
125
|
+
## Release
|
|
126
|
+
|
|
127
|
+
Use `npm version`, don't forget to push the tag and the CI will take care of the rest.
|
|
128
|
+
|
|
129
|
+
|
|
114
130
|
## License
|
|
115
131
|
|
|
116
132
|
This project is licensed under [MIT License](http://opensource.org/licenses/MIT/).
|
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.
|
|
@@ -51,9 +59,9 @@ module.exports = {
|
|
|
51
59
|
*/
|
|
52
60
|
'no-unused-vars': 'off',
|
|
53
61
|
|
|
54
|
-
'rxjs-angular/prefer-async-pipe': '
|
|
55
|
-
'rxjs-angular/prefer-composition': '
|
|
56
|
-
'rxjs-angular/prefer-takeuntil': '
|
|
62
|
+
'rxjs-angular/prefer-async-pipe': 'warn',
|
|
63
|
+
'rxjs-angular/prefer-composition': 'off', // I prefer takeUntilDestroyed() operator
|
|
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',
|
|
@@ -103,6 +112,22 @@ module.exports = {
|
|
|
103
112
|
'@angular-eslint/relative-url-prefix': 'error',
|
|
104
113
|
// '@angular-eslint/require-localize-metadata': 'error', // TODO: https://github.com/jmeinlschmidt/eslint-config-angular/issues/13
|
|
105
114
|
'@angular-eslint/use-component-selector': 'error',
|
|
115
|
+
"@angular-eslint/component-selector": [
|
|
116
|
+
"error",
|
|
117
|
+
{
|
|
118
|
+
"type": "element",
|
|
119
|
+
"prefix": "app",
|
|
120
|
+
"style": "kebab-case",
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"@angular-eslint/directive-selector": [
|
|
124
|
+
"error",
|
|
125
|
+
{
|
|
126
|
+
"type": "attribute",
|
|
127
|
+
"prefix": "app",
|
|
128
|
+
"style": "kebab-case", // I just don't really agree with using camelCase. Material isn't using it neither.
|
|
129
|
+
}
|
|
130
|
+
],
|
|
106
131
|
|
|
107
132
|
'import/no-absolute-path': 'error',
|
|
108
133
|
'import/newline-after-import': [ 'error', { 'count': 1 } ],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jkba/eslint-config-angular",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Opinionated ESLint config for Angular projects",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
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",
|