@jkba/eslint-config-angular 1.2.0 → 1.3.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 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:
@@ -96,6 +111,11 @@ PRs are welcome but keep in mind this is an opinionated configuration.
96
111
  Reference [Share Configurations](https://eslint.org/docs/latest/extend/shareable-configs).
97
112
 
98
113
 
114
+ ## Release
115
+
116
+ Use `npm version`, don't forget to push the tag and the CI will take care of the rest.
117
+
118
+
99
119
  ## License
100
120
 
101
121
  This project is licensed under [MIT License](http://opensource.org/licenses/MIT/).
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,8 +45,14 @@ module.exports = {
44
45
  */
45
46
  'sort-imports': [ 'error', { 'ignoreDeclarationSort': true }],
46
47
 
47
- 'rxjs-angular/prefer-async-pipe': 'error',
48
- 'rxjs-angular/prefer-composition': 'error',
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
+
54
+ 'rxjs-angular/prefer-async-pipe': 'warn',
55
+ 'rxjs-angular/prefer-composition': 'off', // I prefer takeUntilDestroyed() operator
49
56
  'rxjs-angular/prefer-takeuntil': 'error',
50
57
 
51
58
  // Reference https://github.com/cartant/eslint-plugin-rxjs/blob/main/docs/rules/finnish.md
@@ -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: Not working (does nothing)
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,8 +101,24 @@ 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: Error
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',
106
+ "@angular-eslint/component-selector": [
107
+ "error",
108
+ {
109
+ "type": "element",
110
+ "prefix": "app",
111
+ "style": "kebab-case",
112
+ }
113
+ ],
114
+ "@angular-eslint/directive-selector": [
115
+ "error",
116
+ {
117
+ "type": "attribute",
118
+ "prefix": "app",
119
+ "style": "kebab-case", // I just don't really agree with using camelCase. Material isn't using it neither.
120
+ }
121
+ ],
99
122
 
100
123
  'import/no-absolute-path': 'error',
101
124
  'import/newline-after-import': [ 'error', { 'count': 1 } ],
@@ -137,7 +160,6 @@ module.exports = {
137
160
  plugins: ['@angular-eslint/template'],
138
161
  rules: {
139
162
  // '@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
163
  '@angular-eslint/template/no-inline-styles': 'warn', // For me, it is only a suggestion
142
164
  '@angular-eslint/template/conditional-complexity': [
143
165
  '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.2.0",
3
+ "version": "1.3.1",
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
- "@typescript-eslint/eslint-plugin": ">=6",
39
- "@typescript-eslint/parser": ">=6",
38
+ "@ngrx/eslint-plugin": "^16.2.0",
39
+ "@typescript-eslint/eslint-plugin": ">=5",
40
+ "@typescript-eslint/parser": ">=5",
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
  }