eslint-config-angular-strict 2.3.60 → 2.3.62
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 +53 -10
- package/index.js +3 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,17 +44,11 @@ A production-ready, opinionated ESLint configuration that enforces best practice
|
|
|
44
44
|
|
|
45
45
|
### 1. Install Package
|
|
46
46
|
|
|
47
|
-
```sh
|
|
48
|
-
npm install eslint-config-angular-strict --save-dev
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
or
|
|
52
|
-
|
|
53
47
|
```sh
|
|
54
48
|
yarn add eslint-config-angular-strict --dev
|
|
55
49
|
```
|
|
56
50
|
|
|
57
|
-
**⚠️ Important**: Remove any existing `eslint` dependency from your project - it's included!
|
|
51
|
+
> **⚠️ Important**: Remove any existing `eslint` dependency from your project - it's included!
|
|
58
52
|
|
|
59
53
|
### 2. Configure ESLint
|
|
60
54
|
|
|
@@ -73,8 +67,9 @@ export default [
|
|
|
73
67
|
|
|
74
68
|
Add the following to your `package.json`:
|
|
75
69
|
|
|
76
|
-
```
|
|
70
|
+
```jsonc
|
|
77
71
|
{
|
|
72
|
+
// ...
|
|
78
73
|
"type": "module"
|
|
79
74
|
}
|
|
80
75
|
```
|
|
@@ -83,10 +78,10 @@ Add the following to your `package.json`:
|
|
|
83
78
|
|
|
84
79
|
Make sure your `tsconfig.json` is properly configured:
|
|
85
80
|
|
|
86
|
-
```
|
|
81
|
+
```jsonc
|
|
87
82
|
{
|
|
88
83
|
"compilerOptions": {
|
|
89
|
-
|
|
84
|
+
// ...
|
|
90
85
|
"allowUnusedLabels": false,
|
|
91
86
|
"exactOptionalPropertyTypes": true,
|
|
92
87
|
"noImplicitOverride": true,
|
|
@@ -103,6 +98,54 @@ Make sure your `tsconfig.json` is properly configured:
|
|
|
103
98
|
}
|
|
104
99
|
```
|
|
105
100
|
|
|
101
|
+
## Prettier
|
|
102
|
+
|
|
103
|
+
This config handles **TypeScript formatting via ESLint**. Prettier should only be used for **HTML templates**.
|
|
104
|
+
|
|
105
|
+
### Recommended `.prettierrc`
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"printWidth": 165,
|
|
110
|
+
"singleQuote": true,
|
|
111
|
+
"overrides": [
|
|
112
|
+
{
|
|
113
|
+
"files": "*.html",
|
|
114
|
+
"options": { "parser": "angular" }
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Recommended lint scripts (`package.json`)
|
|
121
|
+
|
|
122
|
+
```jsonc
|
|
123
|
+
{
|
|
124
|
+
"scripts": {
|
|
125
|
+
// ...
|
|
126
|
+
"lint": "ng lint && prettier --check \"src/**/*.html\"",
|
|
127
|
+
"lint:fix": "ng lint --fix && prettier --write \"src/**/*.html\""
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
> **⚠️ Important**: Only target `*.html` files with Prettier. Running Prettier on `.ts` files will conflict with ESLint Stylistic rules.
|
|
133
|
+
|
|
134
|
+
### Recommended VS Code settings
|
|
135
|
+
|
|
136
|
+
```jsonc
|
|
137
|
+
{
|
|
138
|
+
"[html]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
|
|
139
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
|
140
|
+
"editor.formatOnSave": true,
|
|
141
|
+
"editor.formatOnType": true,
|
|
142
|
+
"eslint.format.enable": true,
|
|
143
|
+
"eslint.validate": [ /*...*/, "html", "typescript"],
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
This ensures ESLint handles `.ts` formatting on save, while Prettier handles `.html` templates.
|
|
148
|
+
|
|
106
149
|
## Contributing
|
|
107
150
|
|
|
108
151
|
Contributions are welcome! Please open an issue or submit a PR.
|
package/index.js
CHANGED
|
@@ -144,8 +144,6 @@ export default [
|
|
|
144
144
|
elementNamePattern: '^(init|ng(OnChanges|OnInit|DoCheck|AfterContentInit|AfterContentChecked|AfterViewInit|AfterViewChecked|OnDestroy))$',
|
|
145
145
|
groupName: 'lifecycle',
|
|
146
146
|
},
|
|
147
|
-
{ anyOf: [{ selector: 'get-method' }, { selector: 'set-method' }], groupName: 'public-accessors' },
|
|
148
|
-
{ anyOf: [{ selector: 'method' }, { selector: 'function-property' }], groupName: 'public-methods' },
|
|
149
147
|
{
|
|
150
148
|
anyOf: [
|
|
151
149
|
{ modifiers: ['private'], selector: 'get-method' },
|
|
@@ -160,6 +158,8 @@ export default [
|
|
|
160
158
|
],
|
|
161
159
|
groupName: 'private-methods',
|
|
162
160
|
},
|
|
161
|
+
{ anyOf: [{ selector: 'get-method' }, { selector: 'set-method' }], groupName: 'public-accessors' },
|
|
162
|
+
{ anyOf: [{ selector: 'method' }, { selector: 'function-property' }], groupName: 'public-methods' },
|
|
163
163
|
],
|
|
164
164
|
groups: [
|
|
165
165
|
'decorated-public',
|
|
@@ -189,22 +189,16 @@ export default [
|
|
|
189
189
|
{ elementNamePattern: '^ng-zorro-antd/', groupName: 'ng-zorro' },
|
|
190
190
|
],
|
|
191
191
|
groups: [
|
|
192
|
+
'value-builtin',
|
|
192
193
|
'angular',
|
|
193
194
|
'nestjs',
|
|
194
195
|
'firebase',
|
|
195
196
|
'ng-zorro',
|
|
196
|
-
'type-import',
|
|
197
|
-
'value-builtin',
|
|
198
197
|
'value-external',
|
|
199
|
-
'type-internal',
|
|
200
198
|
'value-internal',
|
|
201
|
-
'type-parent',
|
|
202
|
-
'type-sibling',
|
|
203
|
-
'type-index',
|
|
204
199
|
'value-parent',
|
|
205
200
|
'value-sibling',
|
|
206
201
|
'value-index',
|
|
207
|
-
'ts-equals-import',
|
|
208
202
|
'unknown',
|
|
209
203
|
],
|
|
210
204
|
},
|