eslint-config-beslogic 6.0.0 → 6.0.2
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/CHANGELOG.md +11 -0
- package/README.md +5 -5
- package/angular.mjs +6 -0
- package/base.mjs +10 -0
- package/lib/patch-dependencies.mjs +92 -91
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.0.2
|
|
4
|
+
|
|
5
|
+
- Explicitly disabled the following rules in `.html` in Angular preset, as they don't parse:
|
|
6
|
+
- `unicorn/prefer-string-raw`
|
|
7
|
+
- `sonarjs/code-eval`
|
|
8
|
+
- `@typescript-eslint/consistent-type-imports`
|
|
9
|
+
|
|
10
|
+
## 6.0.1
|
|
11
|
+
|
|
12
|
+
- Removed `@nx` patching. This will be updated in a later update.
|
|
13
|
+
|
|
3
14
|
## 6.0.0
|
|
4
15
|
|
|
5
16
|
### Changes that may require manual intervention
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Depending on your needs, you will need to also install other peer dependencies f
|
|
|
8
8
|
|
|
9
9
|
In your `eslint.config.*` file, simply [extend](#examples) our [presets](#presets) appropriate for your project.
|
|
10
10
|
|
|
11
|
-
For stylistic rules, it is highly recommended to use a dedicated formatter over ESLint. Read more here: <https://typescript-eslint.io/
|
|
11
|
+
For stylistic rules, it is highly recommended to use a dedicated formatter over ESLint. Read more here: <https://typescript-eslint.io/users/what-about-formatting/>\
|
|
12
12
|
We assume [dprint](https://dprint.dev/) and don't enable any rules it covers by default. If you're not using a formatter, a [stylistic.mjs](#stylisticmjs) configuration is offered below.
|
|
13
13
|
|
|
14
14
|
## Parallel configurations
|
|
@@ -98,7 +98,7 @@ Angular Material's MatDialogRef [defaults it dialog result generic to `any`](htt
|
|
|
98
98
|
|
|
99
99
|
## Presets
|
|
100
100
|
|
|
101
|
-
Below are all the different configurations you can extend from. You can mix and match as you want if a predefined configuration does not exist for your specific stack.
|
|
101
|
+
Below are all the different configurations you can extend from. You can mix and match as you want if a predefined configuration does not exist for your specific stack.
|
|
102
102
|
|
|
103
103
|
### Examples
|
|
104
104
|
|
|
@@ -197,6 +197,8 @@ export default defineConfig(
|
|
|
197
197
|
|
|
198
198
|
Configurations for NodeJS backends.
|
|
199
199
|
|
|
200
|
+
TODO: mention already handled by angular preset
|
|
201
|
+
|
|
200
202
|
Add the following `devDependencies` to your `package.json`:
|
|
201
203
|
|
|
202
204
|
```shell
|
|
@@ -250,12 +252,10 @@ Configurations for NGX projects. Comes with `html` template and inline template
|
|
|
250
252
|
For the linting to be fully effective, please make sure that your base `tsconfig.json` extends `eslint-config-beslogic/tsconfig.X.X.json` (see [Parallel configurations](#parallel-configurations)).\
|
|
251
253
|
If bundling as an npm package set `"strictMetadataEmit": true` under `angularCompilerOptions`.
|
|
252
254
|
|
|
253
|
-
**NOTE**: `angular-eslint` won't work on HTML files on ESLint v8 due to parser configuration issues.
|
|
254
|
-
|
|
255
255
|
Add the following `devDependencies` to your `package.json`:
|
|
256
256
|
|
|
257
257
|
```shell
|
|
258
|
-
npm install --save-dev @angular-eslint/eslint-plugin @angular-eslint/eslint-plugin-template @angular-eslint/template-parser eslint-plugin-rxjs-angular-x eslint-plugin-angular-file-naming
|
|
258
|
+
npm install --save-dev @angular-eslint/eslint-plugin @angular-eslint/eslint-plugin-template @angular-eslint/template-parser eslint-plugin-rxjs-angular-x eslint-plugin-angular-file-naming eslint-plugin-rxjs-x
|
|
259
259
|
```
|
|
260
260
|
|
|
261
261
|
If using Standalone Components, which are now the recommended default, you should enable the rule `"no-autofix/@angular-eslint/prefer-standalone": "error"`.
|
package/angular.mjs
CHANGED
|
@@ -66,6 +66,12 @@ export default disableAutofix(defineConfig(
|
|
|
66
66
|
"files": ["**/*.html"],
|
|
67
67
|
"extends": [...angular.configs.templateAll],
|
|
68
68
|
"rules": {
|
|
69
|
+
// These don't work in html
|
|
70
|
+
"unicorn/prefer-string-raw": "off",
|
|
71
|
+
"sonarjs/code-eval": "off",
|
|
72
|
+
// Rule that requires typescript parser loaded in html files, is it a misconfiguration ??
|
|
73
|
+
"@typescript-eslint/consistent-type-imports": "off",
|
|
74
|
+
|
|
69
75
|
/*
|
|
70
76
|
* angular-eslint/template overrides (https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/README.md#rules)
|
|
71
77
|
*/
|
package/base.mjs
CHANGED
|
@@ -1222,6 +1222,16 @@ export default disableAutofix(defineConfig(
|
|
|
1222
1222
|
{
|
|
1223
1223
|
"name": "beslogic/base/configs",
|
|
1224
1224
|
"files": ["*.config.{[cm][jt]s,[jt]s}"],
|
|
1225
|
+
"languageOptions": {
|
|
1226
|
+
"parserOptions": {
|
|
1227
|
+
"projectService": {
|
|
1228
|
+
// Don't force users to include this file in their tsconfig.json,
|
|
1229
|
+
// because it can lead to tons of type errors
|
|
1230
|
+
// They may still have to configure this if they have nested tsconfig.json
|
|
1231
|
+
"allowDefaultProject": ["*.config.{[cm]js,js}"]
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
},
|
|
1225
1235
|
"rules": {
|
|
1226
1236
|
// Direct anonymous exports in config files is perfectly acceptable
|
|
1227
1237
|
"import-x/no-anonymous-default-export": "off",
|
|
@@ -92,97 +92,98 @@ const patches = [
|
|
|
92
92
|
return packageName
|
|
93
93
|
},
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
95
|
+
// TODO: Fix nx patching
|
|
96
|
+
// async () => {
|
|
97
|
+
// const packageName = "@nx/angular"
|
|
98
|
+
// const base = getPackageBase(packageName)
|
|
99
|
+
// if (!base) return
|
|
100
|
+
// await Promise.all([
|
|
101
|
+
// searchAndReplace(
|
|
102
|
+
// join(base, "src", "generators", "add-linting", "lib", "create-eslint-configuration.js"),
|
|
103
|
+
// [
|
|
104
|
+
// // Remove code that adds preset extensions
|
|
105
|
+
// // plugin:@nx/angular-template
|
|
106
|
+
// // plugin:@nx/angular
|
|
107
|
+
// // plugin:@angular-eslint/template/process-inline-templates
|
|
108
|
+
// {
|
|
109
|
+
// "from": /'plugin:.+?',?/gu,
|
|
110
|
+
// "to": ""
|
|
111
|
+
// },
|
|
112
|
+
// // Remove empty extends
|
|
113
|
+
// {
|
|
114
|
+
// "from": /extends: \[\s*\],?/gu,
|
|
115
|
+
// "to": ""
|
|
116
|
+
// }
|
|
117
|
+
// ]
|
|
118
|
+
// ),
|
|
119
|
+
// // Patch out prettier
|
|
120
|
+
// searchAndReplace(
|
|
121
|
+
// join(base, "src", "generators", "ng-add", "utilities", "workspace.js"),
|
|
122
|
+
// [
|
|
123
|
+
// {
|
|
124
|
+
// "from": "!packageJson.devDependencies['prettier']",
|
|
125
|
+
// "to": "false"
|
|
126
|
+
// },
|
|
127
|
+
// {
|
|
128
|
+
// "from": "esbenp.prettier-vscode",
|
|
129
|
+
// "to": ""
|
|
130
|
+
// }
|
|
131
|
+
// ]
|
|
132
|
+
// )
|
|
133
|
+
// ])
|
|
134
|
+
|
|
135
|
+
// return packageName
|
|
136
|
+
// },
|
|
137
|
+
// async () => {
|
|
138
|
+
// const packageName = "@nx/eslint"
|
|
139
|
+
// const base = getPackageBase(packageName)
|
|
140
|
+
// if (!base) return
|
|
141
|
+
// // Patch out prettier
|
|
142
|
+
// await searchAndReplace(
|
|
143
|
+
// join(base, "src", "generators", "lint-project", "setup-root-eslint.js"),
|
|
144
|
+
// [
|
|
145
|
+
// {
|
|
146
|
+
// "from": /'eslint-config-prettier':.+?,/gu,
|
|
147
|
+
// "to": ""
|
|
148
|
+
// }
|
|
149
|
+
// ]
|
|
150
|
+
// )
|
|
151
|
+
|
|
152
|
+
// return packageName
|
|
153
|
+
// },
|
|
154
|
+
// async () => {
|
|
155
|
+
// const packageName = "@nx/js"
|
|
156
|
+
// const base = getPackageBase(packageName)
|
|
157
|
+
// if (!base) return
|
|
158
|
+
// // Patch out prettier
|
|
159
|
+
// await searchAndReplace(
|
|
160
|
+
// join(base, "src", "generators", "init", "init.js"),
|
|
161
|
+
// [
|
|
162
|
+
// {
|
|
163
|
+
// "from": /prettier:.+?,/gu,
|
|
164
|
+
// "to": ""
|
|
165
|
+
// },
|
|
166
|
+
// {
|
|
167
|
+
// "from": "if (prettierrcNameOptions",
|
|
168
|
+
// "to": "if (false && prettierrcNameOptions"
|
|
169
|
+
// },
|
|
170
|
+
// {
|
|
171
|
+
// "from": "!tree.exists(`.prettierignore`)",
|
|
172
|
+
// "to": "false"
|
|
173
|
+
// },
|
|
174
|
+
// {
|
|
175
|
+
// "from": "!json.recommendations.includes(extension)",
|
|
176
|
+
// "to": "false"
|
|
177
|
+
// },
|
|
178
|
+
// {
|
|
179
|
+
// "from": /.+?devkit_1\.ensurePackage\)\('prettier'.+?[\n;]/gu,
|
|
180
|
+
// "to": ""
|
|
181
|
+
// }
|
|
182
|
+
// ]
|
|
183
|
+
// )
|
|
184
|
+
|
|
185
|
+
// return packageName
|
|
186
|
+
// },
|
|
186
187
|
// ESLint 10 removed context.getFilename()/getSourceCode();
|
|
187
188
|
// eslint-rule-composer (unmaintained) still calls them.
|
|
188
189
|
// Patch with ?? fallback.
|