@mikey-pro/eslint-config-angular 7.5.3 → 9.0.1

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 (4) hide show
  1. package/README.md +9 -2
  2. package/flat.js +3 -0
  3. package/index.js +149 -56
  4. package/package.json +44 -8
package/README.md CHANGED
@@ -18,9 +18,16 @@ A preset ESLint Angular configuration
18
18
  npm i -D mikey-pro @mikey-pro/eslint-config-angular
19
19
  ```
20
20
 
21
- ### Configure
21
+ ### Configure (Flat ESLint v9+ Recommended)
22
22
 
23
- Extend to ESLint in `package.json`:
23
+ ```js
24
+ // eslint.config.js
25
+ import angularConfig from '@mikey-pro/eslint-config-angular/flat';
26
+
27
+ export default angularConfig;
28
+ ```
29
+
30
+ ### Legacy Configuration (still supported)
24
31
 
25
32
  ```json
26
33
  {
package/flat.js ADDED
@@ -0,0 +1,3 @@
1
+ // Modern Angular ESLint 9 Flat Configuration for Mikey Pro
2
+
3
+ export { default } from './index.js';
package/index.js CHANGED
@@ -1,60 +1,153 @@
1
- const baseConfig = require('@mikey-pro/eslint-config');
2
- const overrides = require('@mikey-pro/eslint-config/overrides');
3
-
4
- module.exports = {
5
- ...baseConfig,
6
- overrides: [
7
- ...baseConfig.overrides,
8
- {
9
- ...overrides.ts,
10
- extends: [
11
- ...overrides.ts.extends,
12
- 'plugin:@angular-eslint/all',
13
- 'plugin:@angular-eslint/template/process-inline-templates',
14
- ],
15
- rules: {
16
- ...overrides.ts.rules,
17
- '@angular-eslint/component-selector': [
18
- 'warn',
19
- {
20
- type: 'element',
21
- prefix: 'app',
22
- style: 'kebab-case',
23
- },
24
- ],
25
- '@angular-eslint/consistent-component-styles': 'off',
26
- '@angular-eslint/directive-selector': [
27
- 'warn',
28
- {
29
- type: 'attribute',
30
- prefix: 'app',
31
- style: 'camelCase',
32
- },
33
- ],
34
- '@angular-eslint/prefer-on-push-component-change-detection': 'off',
35
- '@angular-eslint/prefer-standalone': 'off',
36
- '@angular-eslint/prefer-standalone-component': 'off',
37
- 'prettier/prettier': ['warn', { parser: 'typescript' }],
38
- },
1
+ // Modern Angular ESLint configuration for Mikey Pro
2
+ import angular from '@angular-eslint/eslint-plugin';
3
+ import angularTemplate from '@angular-eslint/eslint-plugin-template';
4
+ import angularTemplateParser from '@angular-eslint/template-parser';
5
+ import { baseConfig } from '@mikey-pro/eslint-config/base-config.js';
6
+ import { baseOverrides } from '@mikey-pro/eslint-config/overrides.js';
7
+
8
+ // Angular-specific configuration
9
+ const angularConfig = {
10
+ files: ['**/*.ts'],
11
+ languageOptions: {
12
+ parser: baseConfig.languageOptions.parser,
13
+ parserOptions: {
14
+ ...baseConfig.languageOptions.parserOptions,
15
+ project: './tsconfig.json',
39
16
  },
40
- {
41
- ...overrides.html,
42
- extends: [
43
- ...overrides.html.extends,
44
- 'plugin:@angular-eslint/template/recommended',
45
- 'plugin:@angular-eslint/template/accessibility',
46
- ],
47
- parser: '@angular-eslint/template-parser',
48
- rules: {
49
- ...overrides.html.rules,
50
- '@angular-eslint/template/alt-text': 'warn',
51
- 'prettier/prettier': [
52
- 'warn',
53
- {
54
- parser: 'angular',
55
- },
56
- ],
17
+ },
18
+ plugins: {
19
+ '@angular-eslint': angular,
20
+ },
21
+ rules: {
22
+ // Angular rules
23
+ ...angular.configs.recommended.rules,
24
+
25
+ // Basic Angular-specific overrides
26
+ '@angular-eslint/component-class-suffix': [
27
+ 'error',
28
+ { suffixes: ['Component', 'Page', 'View'] },
29
+ ],
30
+ '@angular-eslint/component-selector': [
31
+ 'error',
32
+ {
33
+ prefix: 'app',
34
+ style: 'kebab-case',
35
+ type: 'element',
36
+ },
37
+ ],
38
+ '@angular-eslint/directive-class-suffix': [
39
+ 'error',
40
+ { suffixes: ['Directive'] },
41
+ ],
42
+ '@angular-eslint/directive-selector': [
43
+ 'error',
44
+ {
45
+ prefix: 'app',
46
+ style: 'camelCase',
47
+ type: 'attribute',
48
+ },
49
+ ],
50
+ '@angular-eslint/no-multiple-template-root': 'off', // Angular 17+ allows multiple roots
51
+ '@angular-eslint/use-lifecycle-interface': 'error',
52
+ },
53
+ settings: {
54
+ 'import/resolver': {
55
+ typescript: {
56
+ alwaysTryTypes: true,
57
57
  },
58
58
  },
59
- ],
59
+ },
60
60
  };
61
+
62
+ // Angular template configuration
63
+ const angularTemplateConfig = {
64
+ files: ['**/*.html'],
65
+ languageOptions: {
66
+ parser: angularTemplateParser,
67
+ parserOptions: {
68
+ ecmaVersion: 'latest',
69
+ sourceType: 'module',
70
+ },
71
+ },
72
+ plugins: {
73
+ '@angular-eslint/template': angularTemplate,
74
+ },
75
+ rules: {
76
+ // Angular template rules
77
+ ...angularTemplate.configs.recommended.rules,
78
+
79
+ // Basic Angular template-specific overrides
80
+ '@angular-eslint/template/alt-text': 'error',
81
+ '@angular-eslint/template/click-events-have-key-events': 'error',
82
+ '@angular-eslint/template/conditional-complexity': ['error', { max: 3 }],
83
+ '@angular-eslint/template/cyclomatic-complexity': ['error', { max: 5 }],
84
+ '@angular-eslint/template/eqeqeq': 'error',
85
+ '@angular-eslint/template/iframe-title': 'error',
86
+ '@angular-eslint/template/interactive-supports-focus': 'error',
87
+ '@angular-eslint/template/label-has-associated-control': 'error',
88
+ '@angular-eslint/template/mouse-events-have-key-events': 'error',
89
+ '@angular-eslint/template/no-autofocus': 'error',
90
+ '@angular-eslint/template/no-duplicate-attributes': 'error',
91
+ '@angular-eslint/template/no-positive-tabindex': 'error',
92
+ '@angular-eslint/template/use-track-by-function': 'error',
93
+ '@angular-eslint/template/valid-aria': 'error',
94
+ },
95
+ };
96
+
97
+ // Export the complete Angular configuration
98
+ export default [
99
+ // Global ignores
100
+ {
101
+ ignores: [
102
+ '**/dist/**/*',
103
+ '**/vendor/**/*',
104
+ '**/node_modules/**/*',
105
+ '**/coverage/**/*',
106
+ '**/.next/**/*',
107
+ '**/.nuxt/**/*',
108
+ '**/.output/**/*',
109
+ '**/.vite/**/*',
110
+ '**/build/**/*',
111
+ '**/out/**/*',
112
+ '*.properties',
113
+ '*.cclibs',
114
+ '*.svg',
115
+ '*.png',
116
+ '*.jpg',
117
+ '*.jpeg',
118
+ '*.gif',
119
+ '*.ico',
120
+ '*.webp',
121
+ '*.aco',
122
+ '*.psd',
123
+ '*.ai',
124
+ '*.ase',
125
+ '*.sh',
126
+ '*.bat',
127
+ '*.cmd',
128
+ 'package-lock.json',
129
+ 'yarn.lock',
130
+ 'pnpm-lock.yaml',
131
+ 'LICENSE',
132
+ 'CNAME',
133
+ '*.min.js',
134
+ '*.min.css',
135
+ ],
136
+ },
137
+
138
+ // Base configuration
139
+ baseConfig,
140
+
141
+ // Angular-specific configuration
142
+ angularConfig,
143
+
144
+ // Angular template configuration
145
+ angularTemplateConfig,
146
+
147
+ // File-specific overrides
148
+ ...baseOverrides,
149
+ ];
150
+
151
+ // Export individual components for advanced usage
152
+ export { baseConfig } from '@mikey-pro/eslint-config/base-config.js';
153
+ export { baseOverrides } from '@mikey-pro/eslint-config/overrides.js';
package/package.json CHANGED
@@ -1,15 +1,32 @@
1
1
  {
2
2
  "name": "@mikey-pro/eslint-config-angular",
3
- "version": "7.5.3",
4
- "description": "Mikey Pro ESLint Angular configuration",
3
+ "version": "9.0.1",
4
+ "description": "Mikey Pro ESLint Angular configuration - Ultimate Angular coding style guide",
5
+ "type": "module",
5
6
  "main": "index.js",
6
7
  "dependencies": {
7
- "@angular-eslint/eslint-plugin": "^17.5.2",
8
- "@angular-eslint/eslint-plugin-template": "^17.5.2",
9
- "@angular-eslint/template-parser": "^17.5.2"
8
+ "@angular-eslint/eslint-plugin": "^20.2.0",
9
+ "@angular-eslint/eslint-plugin-template": "^20.2.0",
10
+ "@angular-eslint/template-parser": "^20.2.0",
11
+ "@mikey-pro/eslint-config": "^9.0.0",
12
+ "@typescript-eslint/eslint-plugin": "^8.43.0",
13
+ "@typescript-eslint/parser": "^8.43.0",
14
+ "eslint-plugin-prettier": "^5.5.4"
15
+ },
16
+ "peerDependencies": {
17
+ "@mikey-pro/eslint-config": "^9.0.0"
18
+ },
19
+ "peerDependenciesMeta": {
20
+ "@angular/core": {
21
+ "optional": false
22
+ },
23
+ "typescript": {
24
+ "optional": false
25
+ }
10
26
  },
11
27
  "files": [
12
28
  "index.js",
29
+ "flat.js",
13
30
  "README.md",
14
31
  "LICENSE"
15
32
  ],
@@ -23,7 +40,7 @@
23
40
  },
24
41
  "license": "MIT",
25
42
  "keywords": [
26
- "@mikey-pro/eslint-config",
43
+ "@mikey-pro/eslint-config-angular",
27
44
  "@mikey-pro",
28
45
  "mikey-pro",
29
46
  "mikey",
@@ -32,12 +49,31 @@
32
49
  "eslintconfig",
33
50
  "eslint",
34
51
  "config",
52
+ "angular",
35
53
  "style-guide",
36
54
  "style",
37
- "guide"
55
+ "guide",
56
+ "eslint-9",
57
+ "flat-config"
38
58
  ],
39
59
  "author": "Mikl Wolfe <wolfe@mikl.io> (https://mikl.io)",
40
60
  "browserslist": [
41
61
  "defaults"
42
- ]
62
+ ],
63
+ "engines": {
64
+ "node": ">=18.0.0",
65
+ "npm": ">=9.0.0",
66
+ "pnpm": ">=8.0.0",
67
+ "yarn": ">=4.0.0"
68
+ },
69
+ "exports": {
70
+ ".": {
71
+ "import": "./index.js",
72
+ "require": "./index.js"
73
+ },
74
+ "./flat": {
75
+ "import": "./flat.js",
76
+ "require": "./flat.js"
77
+ }
78
+ }
43
79
  }