eslint-config-angular-strict 2.1.6 → 2.1.8
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 +24 -17
- package/index.js +14 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
<br>
|
|
14
14
|
|
|
15
|
-
## ⚠️ Version 2.0.0 -
|
|
15
|
+
## ⚠️ Version 2.0.0 - Flat Config
|
|
16
16
|
|
|
17
17
|
This package includes **ESLint 9** and uses the new **flat configuration format** : [ESLint 9 Migration Guide](https://eslint.org/docs/latest/use/configure/migration-guide).
|
|
18
18
|
|
|
@@ -22,7 +22,7 @@ This package includes **ESLint 9** and uses the new **flat configuration format*
|
|
|
22
22
|
|
|
23
23
|
- ✅ **Airbnb Extended** (strict coding standards)
|
|
24
24
|
- ✅ **Angular ESLint** (Angular 18+ support)
|
|
25
|
-
- ✅ **ESLint 9** (bundled
|
|
25
|
+
- ✅ **ESLint 9** (bundled)
|
|
26
26
|
- ✅ **Stylistic** (modern formatting rules)
|
|
27
27
|
- ✅ **TypeScript ESLint** (latest rules)
|
|
28
28
|
|
|
@@ -30,11 +30,11 @@ This package includes **ESLint 9** and uses the new **flat configuration format*
|
|
|
30
30
|
|
|
31
31
|
- **Angular 18+**
|
|
32
32
|
- **Node.js 18+**
|
|
33
|
-
- **TypeScript 5
|
|
33
|
+
- **TypeScript 5+**
|
|
34
34
|
|
|
35
35
|
## Installation
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
One command setup
|
|
38
38
|
|
|
39
39
|
```sh
|
|
40
40
|
npm install eslint-config-angular-strict --save-dev
|
|
@@ -99,24 +99,31 @@ Make sure your `tsconfig.json` is properly configured:
|
|
|
99
99
|
|
|
100
100
|
### Angular Rules
|
|
101
101
|
|
|
102
|
-
- ✅
|
|
103
|
-
- ✅
|
|
104
|
-
- ✅
|
|
105
|
-
- ✅ Lifecycle method
|
|
106
|
-
- ✅ Template
|
|
102
|
+
- ✅ **Best practices**: Standalone components, view encapsulation, injectable provided-in
|
|
103
|
+
- ✅ **Component standards**: Class suffixes (Component, Modal, Page), kebab-case selectors
|
|
104
|
+
- ✅ **Directive standards**: CamelCase selectors, proper class suffixes
|
|
105
|
+
- ✅ **Lifecycle enforcement**: Interface usage, method ordering, async restrictions
|
|
106
|
+
- ✅ **Template validation**: Accessibility, attributes ordering, trackBy functions
|
|
107
107
|
|
|
108
108
|
### TypeScript Rules
|
|
109
109
|
|
|
110
|
-
- ✅ Code
|
|
111
|
-
- ✅
|
|
112
|
-
- ✅
|
|
113
|
-
- ✅ Strict type
|
|
110
|
+
- ✅ **Code organization**: Import/export management, consistent type definitions
|
|
111
|
+
- ✅ **Modern patterns**: Optional chaining, destructuring, proper error handling
|
|
112
|
+
- ✅ **Performance**: Unbound method checking, proper async/await usage
|
|
113
|
+
- ✅ **Strict typing**: Member ordering, type safety, no explicit any allowed
|
|
114
114
|
|
|
115
|
-
###
|
|
115
|
+
### Style & Formatting (via @stylistic)
|
|
116
116
|
|
|
117
|
-
- ✅
|
|
118
|
-
- ✅
|
|
119
|
-
- ✅
|
|
117
|
+
- ✅ **Airbnb compliance**: 531 strict rules from eslint-config-airbnb-extended
|
|
118
|
+
- ✅ **Code structure**: Max line length (180), object key sorting, proper spacing
|
|
119
|
+
- ✅ **Consistent formatting**: 2-space indentation, single quotes, trailing commas
|
|
120
|
+
- ✅ **Import organization**: Alphabetical ordering with framework prioritization
|
|
121
|
+
|
|
122
|
+
### Quality Assurance
|
|
123
|
+
|
|
124
|
+
- ✅ **Browser globals**: Explicit window usage for 58+ global variables
|
|
125
|
+
- ✅ **Modern ES features**: Arrow functions, const/let usage, template literals
|
|
126
|
+
- ✅ **Variable safety**: No shadowing, unused variable warnings, no undefined usage
|
|
120
127
|
|
|
121
128
|
## Contributing
|
|
122
129
|
|
package/index.js
CHANGED
|
@@ -11,16 +11,16 @@ export default [
|
|
|
11
11
|
// Global plugins configuration for all files
|
|
12
12
|
{
|
|
13
13
|
plugins: {
|
|
14
|
-
'import-x': importX,
|
|
15
14
|
'@stylistic': stylistic,
|
|
16
15
|
'@typescript-eslint': tsEslint,
|
|
16
|
+
'import-x': importX,
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
|
|
20
20
|
// Airbnb strict rules
|
|
21
21
|
...configs.base.all,
|
|
22
|
-
rules.base.strict,
|
|
23
22
|
rules.base.importsStrict,
|
|
23
|
+
rules.typescript.typescriptEslintStrict,
|
|
24
24
|
{
|
|
25
25
|
// TypeScript files configuration
|
|
26
26
|
files: ['**/*.ts'],
|
|
@@ -28,9 +28,7 @@ export default [
|
|
|
28
28
|
parser: tsParser,
|
|
29
29
|
parserOptions: { ecmaVersion: 'latest', project: './tsconfig.json', sourceType: 'module' },
|
|
30
30
|
},
|
|
31
|
-
plugins: {
|
|
32
|
-
'@angular-eslint': angular,
|
|
33
|
-
},
|
|
31
|
+
plugins: { '@angular-eslint': angular },
|
|
34
32
|
rules: {
|
|
35
33
|
// Angular ESLint rules
|
|
36
34
|
'@angular-eslint/component-class-suffix': ['error', { suffixes: ['Component', 'Modal', 'Page'] }],
|
|
@@ -83,6 +81,15 @@ export default [
|
|
|
83
81
|
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
84
82
|
'@stylistic/comma-dangle': ['error', 'always-multiline'],
|
|
85
83
|
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
|
|
84
|
+
'@stylistic/object-curly-newline': [
|
|
85
|
+
'error',
|
|
86
|
+
{
|
|
87
|
+
ExportDeclaration: { multiline: true },
|
|
88
|
+
ImportDeclaration: { multiline: true },
|
|
89
|
+
ObjectExpression: { minProperties: 4, multiline: true },
|
|
90
|
+
ObjectPattern: { minProperties: 4, multiline: true },
|
|
91
|
+
},
|
|
92
|
+
],
|
|
86
93
|
'@stylistic/function-call-spacing': ['error', 'never'],
|
|
87
94
|
'@stylistic/indent': ['error', 2],
|
|
88
95
|
'@stylistic/keyword-spacing': ['error', { before: true, after: true }],
|
|
@@ -131,15 +138,6 @@ export default [
|
|
|
131
138
|
'no-restricted-globals': 'off',
|
|
132
139
|
'no-return-assign': 'off',
|
|
133
140
|
'no-underscore-dangle': 'off',
|
|
134
|
-
'object-curly-newline': [
|
|
135
|
-
'error',
|
|
136
|
-
{
|
|
137
|
-
ExportDeclaration: { multiline: true },
|
|
138
|
-
ImportDeclaration: { multiline: true },
|
|
139
|
-
ObjectExpression: { minProperties: 4, multiline: true },
|
|
140
|
-
ObjectPattern: { minProperties: 4, multiline: true },
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
141
|
'prefer-destructuring': 'off',
|
|
144
142
|
'sort-keys': ['error'],
|
|
145
143
|
radix: ['error', 'as-needed'],
|
|
@@ -153,12 +151,8 @@ export default [
|
|
|
153
151
|
{
|
|
154
152
|
// HTML Template files configuration
|
|
155
153
|
files: ['**/*.html'],
|
|
156
|
-
languageOptions: {
|
|
157
|
-
|
|
158
|
-
},
|
|
159
|
-
plugins: {
|
|
160
|
-
'@angular-eslint/template': angularTemplate,
|
|
161
|
-
},
|
|
154
|
+
languageOptions: { parser: angularTemplateParser },
|
|
155
|
+
plugins: { '@angular-eslint/template': angularTemplate },
|
|
162
156
|
rules: {
|
|
163
157
|
'@angular-eslint/template/attributes-order': ['error', { alphabetical: true }],
|
|
164
158
|
'@angular-eslint/template/banana-in-box': 'error',
|