eslint-config-angular-strict 2.2.38 → 2.2.40
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 +18 -34
- package/index.js +41 -37
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -18,6 +18,13 @@
|
|
|
18
18
|
|
|
19
19
|
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).
|
|
20
20
|
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- 🅰️ **Angular**: Standalone components, lifecycle enforcement, component standards, and more...
|
|
24
|
+
- 📘 **TypeScript**: Strict typing, member ordering, modern patterns, and more...
|
|
25
|
+
- 🎨 **Style**: Airbnb compliance, max length, import organization, and more...
|
|
26
|
+
- 🦄 **Quality**: Modern JavaScript, anti-patterns prevention, performance optimization, and more...
|
|
27
|
+
|
|
21
28
|
## What's Included
|
|
22
29
|
|
|
23
30
|
#### ✨ **No additional ESLint installation needed!** Everything is bundled.
|
|
@@ -27,6 +34,7 @@ This package includes **ESLint 9** and uses the new **flat configuration format*
|
|
|
27
34
|
- <img src="https://eslint.org/icon-512.png" width="16" height="16"> [**ESLint 9**](https://github.com/eslint/eslint)
|
|
28
35
|
- <img src="https://avatars.githubusercontent.com/u/144717797?s=48&" width="16" height="16"> [**Stylistic**](https://github.com/eslint-stylistic/eslint-stylistic)
|
|
29
36
|
- <img src="https://avatars.githubusercontent.com/u/46634674?s=48&" width="16" height="16"> [**TypeScript ESLint**](https://github.com/typescript-eslint/typescript-eslint)
|
|
37
|
+
- 🦄 [**Unicorn**](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
30
38
|
|
|
31
39
|
## Requirements
|
|
32
40
|
|
|
@@ -50,19 +58,7 @@ yarn add eslint-config-angular-strict --dev
|
|
|
50
58
|
|
|
51
59
|
**⚠️ Important**: Remove any existing `eslint` dependency from your project - it's included!
|
|
52
60
|
|
|
53
|
-
##
|
|
54
|
-
|
|
55
|
-
**Required**: Add to your `package.json`:
|
|
56
|
-
|
|
57
|
-
```json
|
|
58
|
-
{
|
|
59
|
-
"type": "module"
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
This is mandatory because eslint-config-angular-strict uses ES modules.
|
|
64
|
-
|
|
65
|
-
## Configure ESLint
|
|
61
|
+
## ESLint Configuration
|
|
66
62
|
|
|
67
63
|
Create an `eslint.config.js` file (ESLint 9 flat config format):
|
|
68
64
|
|
|
@@ -75,7 +71,15 @@ export default [
|
|
|
75
71
|
];
|
|
76
72
|
```
|
|
77
73
|
|
|
78
|
-
|
|
74
|
+
**Required**: add to your `package.json`:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"type": "module"
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## TypeScript Configuration
|
|
79
83
|
|
|
80
84
|
Make sure your `tsconfig.json` is properly configured:
|
|
81
85
|
|
|
@@ -97,26 +101,6 @@ Make sure your `tsconfig.json` is properly configured:
|
|
|
97
101
|
}
|
|
98
102
|
```
|
|
99
103
|
|
|
100
|
-
## Features
|
|
101
|
-
|
|
102
|
-
### <img src="https://avatars.githubusercontent.com/u/139426?s=48&" width="20" height="20"> Angular Rules
|
|
103
|
-
|
|
104
|
-
- 🏗️ **Best practices**: Standalone components, view encapsulation
|
|
105
|
-
- 🎯 **Component standards**: Class suffixes, kebab-case selectors
|
|
106
|
-
- 🔄 **Lifecycle enforcement**: Interface usage, method ordering
|
|
107
|
-
|
|
108
|
-
### <img src="https://avatars.githubusercontent.com/u/46634674?s=48&" width="20" height="20"> TypeScript Rules
|
|
109
|
-
|
|
110
|
-
- 📦 **Code organization**: Import/export management, type definitions
|
|
111
|
-
- ⚡ **Modern patterns**: Optional chaining, destructuring, async/await
|
|
112
|
-
- 🛡️ **Strict typing**: Member ordering, type safety, no explicit any
|
|
113
|
-
|
|
114
|
-
### 🎨 Style & Formatting
|
|
115
|
-
|
|
116
|
-
- 📋 **Airbnb compliance**: 531 strict rules from eslint-config-airbnb-extended
|
|
117
|
-
- 📏 **Code structure**: Max line length (180), proper spacing
|
|
118
|
-
- 🔤 **Import organization**: Alphabetical ordering with framework prioritization
|
|
119
|
-
|
|
120
104
|
## Contributing
|
|
121
105
|
|
|
122
106
|
Contributions are welcome! Please open an issue or submit a PR.
|
package/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import stylistic from '@stylistic/eslint-plugin';
|
|
|
6
6
|
import tsEslint from '@typescript-eslint/eslint-plugin';
|
|
7
7
|
import tsParser from '@typescript-eslint/parser';
|
|
8
8
|
import { configs, rules } from 'eslint-config-airbnb-extended';
|
|
9
|
+
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
|
|
9
10
|
|
|
10
11
|
export default [
|
|
11
|
-
// Global plugins configuration for all files
|
|
12
12
|
{
|
|
13
13
|
ignores: ['dist/**', 'node_modules/**'],
|
|
14
14
|
plugins: {
|
|
@@ -19,8 +19,8 @@ export default [
|
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
|
|
22
|
-
// Airbnb strict rules
|
|
23
22
|
...configs.base.all,
|
|
23
|
+
eslintPluginUnicorn.configs.all,
|
|
24
24
|
rules.base.importsStrict,
|
|
25
25
|
rules.typescript.typescriptEslintStrict,
|
|
26
26
|
{
|
|
@@ -62,32 +62,15 @@ export default [
|
|
|
62
62
|
'@angular-eslint/use-lifecycle-interface': 'error',
|
|
63
63
|
'@angular-eslint/use-pipe-transform-interface': 'error',
|
|
64
64
|
|
|
65
|
-
//
|
|
66
|
-
'
|
|
67
|
-
'
|
|
68
|
-
'
|
|
69
|
-
'
|
|
70
|
-
'
|
|
71
|
-
'
|
|
72
|
-
'
|
|
73
|
-
|
|
74
|
-
// Stylistic rules
|
|
75
|
-
'@stylistic/arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
|
|
76
|
-
'@stylistic/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
|
|
77
|
-
'@stylistic/max-len': ['error', { code: 180, tabWidth: 2 }],
|
|
78
|
-
'@stylistic/object-curly-newline': [
|
|
79
|
-
'error',
|
|
80
|
-
{
|
|
81
|
-
ExportDeclaration: { consistent: true, minProperties: 10, multiline: true },
|
|
82
|
-
ImportDeclaration: { consistent: true, minProperties: 10, multiline: true },
|
|
83
|
-
ObjectExpression: { consistent: true, minProperties: 4, multiline: true },
|
|
84
|
-
ObjectPattern: { consistent: true, minProperties: 4, multiline: true },
|
|
85
|
-
TSEnumBody: { consistent: true, minProperties: 4, multiline: true },
|
|
86
|
-
TSInterfaceBody: { consistent: true, minProperties: 4, multiline: true },
|
|
87
|
-
TSTypeLiteral: { consistent: true, minProperties: 4, multiline: true },
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
'@stylistic/padded-blocks': ['error', { blocks: 'never', classes: 'always', switches: 'never' }],
|
|
65
|
+
// ESLint rules
|
|
66
|
+
'class-methods-use-this': 'off',
|
|
67
|
+
'max-lines': ['error', { max: 400, skipBlankLines: true, skipComments: true }],
|
|
68
|
+
'no-param-reassign': ['error', { props: false }],
|
|
69
|
+
'no-plusplus': 'off',
|
|
70
|
+
'no-return-assign': 'off',
|
|
71
|
+
'no-underscore-dangle': ['error', { allowAfterThis: true }],
|
|
72
|
+
'radix': ['error', 'as-needed'],
|
|
73
|
+
'sort-keys': ['error', 'asc', { allowLineSeparatedGroups: true, natural: true }],
|
|
91
74
|
|
|
92
75
|
// Import rules
|
|
93
76
|
'import-x/no-anonymous-default-export': 'error',
|
|
@@ -113,15 +96,36 @@ export default [
|
|
|
113
96
|
],
|
|
114
97
|
'import-x/prefer-default-export': 'off',
|
|
115
98
|
|
|
116
|
-
//
|
|
117
|
-
'
|
|
118
|
-
'
|
|
119
|
-
'
|
|
120
|
-
'
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
99
|
+
// Stylistic rules
|
|
100
|
+
'@stylistic/arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
|
|
101
|
+
'@stylistic/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
|
|
102
|
+
'@stylistic/max-len': ['error', { code: 170, tabWidth: 2 }],
|
|
103
|
+
'@stylistic/object-curly-newline': [
|
|
104
|
+
'error',
|
|
105
|
+
{
|
|
106
|
+
ExportDeclaration: { consistent: true, minProperties: 10, multiline: true },
|
|
107
|
+
ImportDeclaration: { consistent: true, minProperties: 10, multiline: true },
|
|
108
|
+
ObjectExpression: { consistent: true, minProperties: 4, multiline: true },
|
|
109
|
+
ObjectPattern: { consistent: true, minProperties: 4, multiline: true },
|
|
110
|
+
TSEnumBody: { consistent: true, minProperties: 4, multiline: true },
|
|
111
|
+
TSInterfaceBody: { consistent: true, minProperties: 4, multiline: true },
|
|
112
|
+
TSTypeLiteral: { consistent: true, minProperties: 4, multiline: true },
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
'@stylistic/padded-blocks': ['error', { blocks: 'never', classes: 'always', switches: 'never' }],
|
|
116
|
+
|
|
117
|
+
// TypeScript ESLint rules
|
|
118
|
+
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'no-type-imports' }],
|
|
119
|
+
'@typescript-eslint/member-ordering': 'error',
|
|
120
|
+
'@typescript-eslint/no-extraneous-class': ['error', { allowEmpty: true, allowStaticOnly: true }],
|
|
121
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
122
|
+
'@typescript-eslint/promise-function-async': ['error', { checkArrowFunctions: false }],
|
|
123
|
+
'@typescript-eslint/sort-type-constituents': 'error',
|
|
124
|
+
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
|
|
125
|
+
|
|
126
|
+
// Unicorn rules
|
|
127
|
+
'unicorn/no-array-for-each': 'off',
|
|
128
|
+
'unicorn/switch-case-braces': 'off',
|
|
125
129
|
},
|
|
126
130
|
},
|
|
127
131
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-angular-strict",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.40",
|
|
4
4
|
"description": "Modern ESLint configuration with strict rules for Angular development.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"eslint-config-airbnb-extended": "2.3.1",
|
|
49
49
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
50
50
|
"eslint-plugin-import-x": "4.16.1",
|
|
51
|
+
"eslint-plugin-unicorn": "61.0.2",
|
|
51
52
|
"typescript-eslint": "8.45.0"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|