eslint-config-angular-strict 0.1.0 → 0.1.4
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 +35 -24
- package/package.json +6 -5
- package/template.js +3 -0
- package/{rules/typescript.js → typescript.js} +2 -6
- package/index.js +0 -3
- package/rules/templates.js +0 -4
package/README.md
CHANGED
|
@@ -2,26 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Stricts rules to enforce a consistent code style for **Angular** development
|
|
4
4
|
|
|
5
|
-
## Tsconfig
|
|
6
|
-
|
|
7
|
-
For better consistency, please add this options to your `tsconfig.json` :
|
|
8
|
-
|
|
9
|
-
```javascript
|
|
10
|
-
{
|
|
11
|
-
"compilerOptions": {
|
|
12
|
-
"forceConsistentCasingInFileNames": true, // Ensure that casing is correct in imports
|
|
13
|
-
"noImplicitAny": true, // Enable error reporting for expressions and declarations with an implied any type
|
|
14
|
-
"noImplicitOverride": true, // Ensure overriding members in derived classes are marked with an override modifier
|
|
15
|
-
"strict": true // Enable all strict type checking options
|
|
16
|
-
},
|
|
17
|
-
"angularCompilerOptions": {
|
|
18
|
-
"strictInjectionParameters": true, // Reports an error for a supplied parameter whose injection type cannot be determined
|
|
19
|
-
"strictInputAccessModifiers": true, // Whether access modifiers such as private/protected/readonly are honored when assigning a binding expression to an @Input()
|
|
20
|
-
"strictTemplates": true // Enables strict template type checking
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
5
|
## Installation
|
|
26
6
|
|
|
27
7
|
```sh
|
|
@@ -34,17 +14,48 @@ or
|
|
|
34
14
|
yarn add eslint-config-angular-strict --dev
|
|
35
15
|
```
|
|
36
16
|
|
|
37
|
-
##
|
|
17
|
+
## Configure ESLint
|
|
38
18
|
|
|
39
|
-
|
|
19
|
+
Within your **ESLint** config file:
|
|
40
20
|
|
|
41
21
|
```json
|
|
42
22
|
{
|
|
43
|
-
"
|
|
23
|
+
"root": true,
|
|
24
|
+
"overrides": [
|
|
25
|
+
{
|
|
26
|
+
"extends": ["angular-strict/typescript"],
|
|
27
|
+
"files": ["*.ts"]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"extends": ["angular-strict/template"],
|
|
31
|
+
"files": ["*.html"]
|
|
32
|
+
}
|
|
33
|
+
]
|
|
44
34
|
}
|
|
45
35
|
```
|
|
46
36
|
|
|
47
|
-
ℹ️
|
|
37
|
+
ℹ️ `eslint` dependencies are included, so you can remove all `eslint` related dependencies from your project.
|
|
38
|
+
|
|
39
|
+
## Tsconfig
|
|
40
|
+
|
|
41
|
+
For better consistency, please add this options to your `tsconfig.json`:
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
{
|
|
45
|
+
"compilerOptions": {
|
|
46
|
+
(...),
|
|
47
|
+
"forceConsistentCasingInFileNames": true, // Ensure that casing is correct in imports
|
|
48
|
+
"noImplicitAny": true, // Enable error reporting for expressions and declarations with an implied any type
|
|
49
|
+
"noImplicitOverride": true, // Ensure overriding members in derived classes are marked with an override modifier
|
|
50
|
+
"strict": true // Enable all strict type checking options
|
|
51
|
+
},
|
|
52
|
+
"angularCompilerOptions": {
|
|
53
|
+
"strictInjectionParameters": true, // Reports an error for a supplied parameter whose injection type cannot be determined
|
|
54
|
+
"strictInputAccessModifiers": true, // Whether access modifiers such as private/protected/readonly are honored when assigning a binding expression to an @Input()
|
|
55
|
+
"strictTemplates": true // Enables strict template type checking
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
48
59
|
|
|
49
60
|
## Extends
|
|
50
61
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-angular-strict",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Stricts rules to enforce a consistent code style for Angular development",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"keywords": [
|
|
10
10
|
"angular",
|
|
11
11
|
"eslint",
|
|
12
|
+
"eslint-plugin",
|
|
12
13
|
"linting-rules",
|
|
13
14
|
"stricts-rules",
|
|
14
15
|
"typescript"
|
|
@@ -27,15 +28,15 @@
|
|
|
27
28
|
"@angular-eslint/eslint-plugin": "13.2.1",
|
|
28
29
|
"@angular-eslint/eslint-plugin-template": "13.2.1",
|
|
29
30
|
"@angular-eslint/template-parser": "13.2.1",
|
|
30
|
-
"@typescript-eslint/eslint-plugin": "5.27.
|
|
31
|
-
"@typescript-eslint/parser": "5.27.
|
|
32
|
-
"eslint": "8.
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "5.27.1",
|
|
32
|
+
"@typescript-eslint/parser": "5.27.1",
|
|
33
|
+
"eslint": "8.17.0",
|
|
33
34
|
"eslint-config-airbnb-base": "15.0.0",
|
|
34
35
|
"eslint-config-airbnb-typescript": "17.0.0",
|
|
35
36
|
"eslint-import-resolver-typescript": "2.7.1",
|
|
36
37
|
"eslint-plugin-import": "2.26.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"typescript": "^4.
|
|
40
|
+
"typescript": "^4.7.3"
|
|
40
41
|
}
|
|
41
42
|
}
|
package/template.js
ADDED
|
@@ -8,7 +8,6 @@ module.exports = {
|
|
|
8
8
|
'plugin:@angular-eslint/recommended',
|
|
9
9
|
'plugin:@angular-eslint/template/process-inline-templates',
|
|
10
10
|
],
|
|
11
|
-
files: ['*.ts'],
|
|
12
11
|
rules: {
|
|
13
12
|
'@angular-eslint/component-class-suffix': ['error', { suffixes: ['Component', 'Modal', 'Page'] }],
|
|
14
13
|
'@angular-eslint/component-selector': ['error', { type: 'element', prefix: 'app', style: 'kebab-case' }],
|
|
@@ -21,6 +20,7 @@ module.exports = {
|
|
|
21
20
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
22
21
|
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
|
|
23
22
|
|
|
23
|
+
'import/no-import-module-exports': 'off',
|
|
24
24
|
'import/prefer-default-export': 'off',
|
|
25
25
|
|
|
26
26
|
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
|
|
@@ -41,9 +41,5 @@ module.exports = {
|
|
|
41
41
|
],
|
|
42
42
|
'padded-blocks': 'off',
|
|
43
43
|
radix: ['error', 'as-needed'],
|
|
44
|
-
}
|
|
45
|
-
settings: {
|
|
46
|
-
'import/parsers': { '@typescript-eslint/parser': ['.ts'] },
|
|
47
|
-
'import/resolver': { typescript: {} },
|
|
48
|
-
},
|
|
44
|
+
}
|
|
49
45
|
};
|
package/index.js
DELETED
package/rules/templates.js
DELETED