eslint-config-angular-strict 22.6.1 → 22.6.3
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 +1 -1
- package/index.js +7 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ Add the following to your `package.json`:
|
|
|
78
78
|
|
|
79
79
|
### 4. Lint YAML and TOML files (optional)
|
|
80
80
|
|
|
81
|
-
YAML and TOML files are checked
|
|
81
|
+
YAML and TOML files are checked against the `standard` preset of their plugin and the Unicorn rules recommended for them, but `ng lint` only looks at the patterns declared in `angular.json`. Add them there:
|
|
82
82
|
|
|
83
83
|
```jsonc
|
|
84
84
|
{
|
package/index.js
CHANGED
|
@@ -16,11 +16,8 @@ import { noRestrictedSyntaxOverrides, noRestrictedSyntaxRule } from './rules/fil
|
|
|
16
16
|
// @angular-eslint v22 dropped the `configs` export — manually enable all rules instead
|
|
17
17
|
const enableAllRules = (plugin, prefix) => Object.fromEntries(Object.keys(plugin.rules).map(k => [`${prefix}/${k}`, 'error']));
|
|
18
18
|
|
|
19
|
-
//
|
|
20
|
-
const
|
|
21
|
-
const isSupported = rule => !rule.meta.deprecated && (rule.meta.languages || []).some(supported => supported === '*' || supported === language);
|
|
22
|
-
return Object.fromEntries(Object.entries(unicornPlugin.rules).filter(([, rule]) => isSupported(rule)).map(([name]) => [`unicorn/${name}`, 'error']));
|
|
23
|
-
};
|
|
19
|
+
// The language plugins ship their presets as arrays whose rules carry no `files` — merge them so they stay scoped to our own blocks
|
|
20
|
+
const presetRules = preset => Object.assign({}, ...preset.map(config => config.rules));
|
|
24
21
|
|
|
25
22
|
const dataFiles = ['**/*.toml', '**/*.yaml', '**/*.yml']; // Data files get their own language blocks below: the JavaScript presets must not reach them
|
|
26
23
|
|
|
@@ -354,8 +351,10 @@ export default [
|
|
|
354
351
|
language: 'toml/toml',
|
|
355
352
|
plugins: { toml: tomlPlugin, unicorn: unicornPlugin },
|
|
356
353
|
rules: {
|
|
357
|
-
...
|
|
358
|
-
'
|
|
354
|
+
...presetRules(tomlPlugin.configs['flat/standard']),
|
|
355
|
+
...unicornPlugin.configs['recommended-toml'].rules,
|
|
356
|
+
'toml/array-bracket-spacing': ['error', 'never'], // same as `@stylistic/array-bracket-spacing` on the TypeScript side
|
|
357
|
+
'toml/array-element-newline': ['error', 'consistent'], // one element per line is not forced, only mixing both layouts is reported
|
|
359
358
|
},
|
|
360
359
|
},
|
|
361
360
|
|
|
@@ -364,10 +363,7 @@ export default [
|
|
|
364
363
|
files: ['**/*.yaml', '**/*.yml'],
|
|
365
364
|
language: 'yml/yaml',
|
|
366
365
|
plugins: { unicorn: unicornPlugin, yml: ymlPlugin },
|
|
367
|
-
rules: {
|
|
368
|
-
...enableUnicornRules('yml/yaml'),
|
|
369
|
-
'unicorn/key-name-casing': 'off', // keys are dictated by the tool that reads the file (Dependabot, GitHub Actions...)
|
|
370
|
-
},
|
|
366
|
+
rules: { ...presetRules(ymlPlugin.configs['flat/standard']), ...unicornPlugin.configs['recommended-yaml'].rules },
|
|
371
367
|
},
|
|
372
368
|
|
|
373
369
|
...noRestrictedSyntaxOverrides,
|