eslint-config-angular-strict 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Jean-benoit Gautier
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # eslint-config-angular-strict
2
+
3
+ Stricts rules to enforce a consistent code style for **Angular** development
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
+ ## Installation
26
+
27
+ ```sh
28
+ npm install eslint-config-angular-strict --save-dev
29
+ ```
30
+
31
+ or
32
+
33
+ ```sh
34
+ yarn add eslint-config-angular-strict --dev
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ In `.eslintec.json`:
40
+
41
+ ```json
42
+ {
43
+ "extends": ["eslint-config-angular-strict"]
44
+ }
45
+ ```
46
+
47
+ ℹ️ All `eslint` dependencies are included, so you can remove all `eslint` related dependencies from your project.
48
+
49
+ ## Extends
50
+
51
+ - [@angular-eslint](https://github.com/angular-eslint/angular-eslint)
52
+ - [@typescript-eslint](https://github.com/typescript-eslint/typescript-eslint)
53
+ - [airbnb-typescript](https://github.com/iamturns/eslint-config-airbnb-typescript)
54
+ - [airbnb](https://github.com/airbnb/javascript)
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ extends: ['./rules/templates', './rules/typescript'].map(require.resolve),
3
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "eslint-config-angular-strict",
3
+ "version": "0.1.0",
4
+ "description": "Stricts rules to enforce a consistent code style for Angular development",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/Jbz797/eslint-config-angular-strict"
8
+ },
9
+ "keywords": [
10
+ "angular",
11
+ "eslint",
12
+ "linting-rules",
13
+ "stricts-rules",
14
+ "typescript"
15
+ ],
16
+ "author": {
17
+ "name": "Jean-benoit Gautier"
18
+ },
19
+ "license": "MIT",
20
+ "bugs": {
21
+ "url": "https://github.com/Jbz797/eslint-config-angular-strict/issues"
22
+ },
23
+ "homepage": "https://github.com/Jbz797/eslint-config-angular-strict",
24
+ "main": "./index.js",
25
+ "dependencies": {
26
+ "@angular-eslint/builder": "13.2.1",
27
+ "@angular-eslint/eslint-plugin": "13.2.1",
28
+ "@angular-eslint/eslint-plugin-template": "13.2.1",
29
+ "@angular-eslint/template-parser": "13.2.1",
30
+ "@typescript-eslint/eslint-plugin": "5.27.0",
31
+ "@typescript-eslint/parser": "5.27.0",
32
+ "eslint": "8.16.0",
33
+ "eslint-config-airbnb-base": "15.0.0",
34
+ "eslint-config-airbnb-typescript": "17.0.0",
35
+ "eslint-import-resolver-typescript": "2.7.1",
36
+ "eslint-plugin-import": "2.26.0"
37
+ },
38
+ "devDependencies": {
39
+ "typescript": "^4.0.0"
40
+ }
41
+ }
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ extends: ['plugin:@angular-eslint/template/recommended'],
3
+ files: ['*.html'],
4
+ };
@@ -0,0 +1,49 @@
1
+ module.exports = {
2
+ extends: [
3
+ 'airbnb-base',
4
+ 'airbnb-typescript/base',
5
+ 'plugin:@typescript-eslint/recommended',
6
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
7
+ 'plugin:@typescript-eslint/strict',
8
+ 'plugin:@angular-eslint/recommended',
9
+ 'plugin:@angular-eslint/template/process-inline-templates',
10
+ ],
11
+ files: ['*.ts'],
12
+ rules: {
13
+ '@angular-eslint/component-class-suffix': ['error', { suffixes: ['Component', 'Modal', 'Page'] }],
14
+ '@angular-eslint/component-selector': ['error', { type: 'element', prefix: 'app', style: 'kebab-case' }],
15
+ '@angular-eslint/directive-selector': ['error', { type: 'attribute', prefix: 'app', style: 'camelCase' }],
16
+
17
+ '@typescript-eslint/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
18
+ '@typescript-eslint/no-explicit-any': 'off',
19
+ '@typescript-eslint/no-extraneous-class': ['error', { allowEmpty: true, allowStaticOnly: true }],
20
+ '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: false }],
21
+ '@typescript-eslint/no-non-null-assertion': 'off',
22
+ '@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
23
+
24
+ 'import/prefer-default-export': 'off',
25
+
26
+ 'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
27
+ 'class-methods-use-this': ['error', { exceptMethods: ['transform'] }],
28
+ 'max-len': ['error', 180],
29
+ 'no-param-reassign': ['error', { props: false }],
30
+ 'no-plusplus': 'off',
31
+ 'no-return-assign': 'off',
32
+ 'no-underscore-dangle': 'off',
33
+ 'object-curly-newline': [
34
+ 'error',
35
+ {
36
+ ExportDeclaration: { multiline: true },
37
+ ImportDeclaration: { multiline: true },
38
+ ObjectExpression: { minProperties: 4, multiline: true },
39
+ ObjectPattern: { minProperties: 4, multiline: true },
40
+ },
41
+ ],
42
+ 'padded-blocks': 'off',
43
+ radix: ['error', 'as-needed'],
44
+ },
45
+ settings: {
46
+ 'import/parsers': { '@typescript-eslint/parser': ['.ts'] },
47
+ 'import/resolver': { typescript: {} },
48
+ },
49
+ };