eslint-config-angular-strict 22.6.1 → 22.6.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +4 -13
  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
 
@@ -353,10 +350,7 @@ export default [
353
350
  files: ['**/*.toml'],
354
351
  language: 'toml/toml',
355
352
  plugins: { toml: tomlPlugin, unicorn: unicornPlugin },
356
- rules: {
357
- ...enableUnicornRules('toml/toml'),
358
- 'unicorn/key-name-casing': 'off', // keys are dictated by the tool that reads the file (Ruff, Yarn...)
359
- },
353
+ rules: { ...presetRules(tomlPlugin.configs['flat/standard']), ...unicornPlugin.configs['recommended-toml'].rules },
360
354
  },
361
355
 
362
356
  // YAML files configuration
@@ -364,10 +358,7 @@ export default [
364
358
  files: ['**/*.yaml', '**/*.yml'],
365
359
  language: 'yml/yaml',
366
360
  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
- },
361
+ rules: { ...presetRules(ymlPlugin.configs['flat/standard']), ...unicornPlugin.configs['recommended-yaml'].rules },
371
362
  },
372
363
 
373
364
  ...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.2",
4
4
  "description": "Modern ESLint configuration with strict rules for Angular development.",
5
5
  "keywords": [
6
6
  "angular",