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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +7 -11
  3. 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 for syntax errors and every Unicorn rule that supports them, but `ng lint` only looks at the patterns declared in `angular.json`. Add them there:
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
- // Unicorn has no `all` preset per language — enable every maintained rule that declares support for it
20
- const enableUnicornRules = (language) => {
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
- ...enableUnicornRules('toml/toml'),
358
- 'unicorn/key-name-casing': 'off', // keys are dictated by the tool that reads the file (Ruff, Yarn...)
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-angular-strict",
3
- "version": "22.6.1",
3
+ "version": "22.6.3",
4
4
  "description": "Modern ESLint configuration with strict rules for Angular development.",
5
5
  "keywords": [
6
6
  "angular",