@jkba/eslint-config-angular 1.0.0 → 1.1.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.
Files changed (3) hide show
  1. package/README.md +57 -10
  2. package/eslint.config.js +11 -2
  3. package/package.json +12 -13
package/README.md CHANGED
@@ -1,18 +1,29 @@
1
1
  # eslint-config-angular
2
2
 
3
+ ![](https://img.shields.io/npm/dt/@jkba/eslint-config-angular?logo=npm)
4
+
5
+
3
6
  Opinionated ESLint config for Angular projects
4
7
 
5
8
 
6
9
  ## Installation
7
10
 
8
- For some unknown weird reason, following dependencies have to be installed in your project as well. (https://github.com/jmeinlschmidt/eslint-config-angular/issues/5)
9
-
10
11
  ```sh
11
- npm i -D eslint-plugin-rxjs eslint-plugin-rxjs-angular
12
- ```
12
+ npm i -D \
13
+ prettier \
14
+ @angular-eslint/eslint-plugin \
15
+ @angular-eslint/eslint-plugin-template \
16
+ @angular-eslint/template-parser \
17
+ @typescript-eslint/eslint-plugin \
18
+ @typescript-eslint/parser \
19
+ eslint-plugin-import \
20
+ eslint-config-prettier \
21
+ eslint-plugin-prettier \
22
+ eslint-plugin-rxjs \
23
+ eslint-plugin-rxjs-angular \
24
+ eslint-import-resolver-typescript \
25
+ @jkba/eslint-config-angular
13
26
 
14
- ```sh
15
- npm i -D @jkba/eslint-config-angular
16
27
  ```
17
28
 
18
29
 
@@ -20,7 +31,7 @@ npm i -D @jkba/eslint-config-angular
20
31
 
21
32
  Extend your eslint configuration with `"@jkba/angular"`:
22
33
 
23
- ```javascript
34
+ ```js
24
35
  // .eslintrc.json
25
36
 
26
37
  {
@@ -39,14 +50,50 @@ module.exports = require('@jkba/eslint-config-angular/prettier.config');
39
50
 
40
51
  ### Modifying rules
41
52
 
42
- > :warning: Work in Progress
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).
43
89
 
44
90
 
45
91
  ## Build
46
92
 
47
- > :warning: Work in Progress
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.
48
95
 
49
- Refer to https://eslint.org/docs/latest/extend/shareable-configs.
96
+ Reference [Share Configurations](https://eslint.org/docs/latest/extend/shareable-configs).
50
97
 
51
98
 
52
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': {
@@ -79,7 +79,13 @@ module.exports = {
79
79
  'import/order': [
80
80
  'error',
81
81
  {
82
- 'groups': ['builtin', 'external', 'parent', 'sibling', 'index'],
82
+ 'groups': [
83
+ ['builtin', 'external'],
84
+ 'internal',
85
+ 'parent',
86
+ 'sibling',
87
+ 'index',
88
+ ],
83
89
  'newlines-between': 'always',
84
90
  'alphabetize': {
85
91
  'order': 'asc',
@@ -87,6 +93,9 @@ module.exports = {
87
93
  }
88
94
  }
89
95
  ],
96
+ 'import/no-useless-path-segments': ['error', { noUselessIndex: true }],
97
+ // 'import/no-deprecated': 'error', // Throws false-positive for RxJS,
98
+ 'import/no-self-import': 'error',
90
99
  },
91
100
  },
92
101
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jkba/eslint-config-angular",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Opinionated ESLint config for Angular projects",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,20 +31,19 @@
31
31
  },
32
32
  "homepage": "https://github.com/jmeinlschmidt/eslint-config-angular#readme",
33
33
  "peerDependencies": {
34
+ "@angular-eslint/eslint-plugin": ">=16",
35
+ "@angular-eslint/eslint-plugin-template": ">=16",
36
+ "@angular-eslint/template-parser": ">=16",
37
+ "@typescript-eslint/eslint-plugin": ">=6",
38
+ "@typescript-eslint/parser": ">=6",
34
39
  "eslint": ">=8",
40
+ "eslint-config-prettier": ">=8",
41
+ "eslint-plugin-import": ">=2.27.0",
42
+ "eslint-plugin-prettier": ">=5",
43
+ "eslint-plugin-rxjs": ">=5",
44
+ "eslint-plugin-rxjs-angular": ">=2",
45
+ "eslint-import-resolver-typescript": ">= 3.5.5",
35
46
  "prettier": ">=3",
36
- "rxjs": ">=7",
37
47
  "typescript": ">=4"
38
- },
39
- "dependencies": {
40
- "@angular-eslint/eslint-plugin": "^16.0.0",
41
- "@angular-eslint/eslint-plugin-template": "^16.0.0",
42
- "@angular-eslint/template-parser": "^16.0.0",
43
- "@typescript-eslint/eslint-plugin": "^6.0.0",
44
- "@typescript-eslint/parser": "^6.0.0",
45
- "eslint-plugin-import": "^2.27.5",
46
- "eslint-plugin-prettier": "^5.0.0",
47
- "eslint-plugin-rxjs": "^5.0.3",
48
- "eslint-plugin-rxjs-angular": "^2.0.1"
49
48
  }
50
49
  }