@lenne.tech/eslint-config-angular 0.0.16 → 1.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.
- package/index.js +106 -149
- package/package.json +9 -12
package/index.js
CHANGED
|
@@ -1,159 +1,116 @@
|
|
|
1
1
|
console.log("Linting Angular...");
|
|
2
|
+
import tsParser from "@typescript-eslint/parser";
|
|
3
|
+
import typescript from "@typescript-eslint/eslint-plugin";
|
|
4
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"eslint:recommended",
|
|
9
|
-
"plugin:@typescript-eslint/recommended",
|
|
10
|
-
"plugin:@angular-eslint/recommended",
|
|
11
|
-
// This is required if you use inline templates in Components
|
|
12
|
-
"plugin:@angular-eslint/template/process-inline-templates",
|
|
13
|
-
"plugin:perfectionist/recommended-natural",
|
|
14
|
-
],
|
|
15
|
-
rules: {
|
|
16
|
-
/**
|
|
17
|
-
* Any TypeScript source code (NOT TEMPLATE) related rules you wish to use/reconfigure over and above the
|
|
18
|
-
* recommended set provided by the @angular-eslint project would go here.
|
|
19
|
-
*/
|
|
20
|
-
"perfectionist/sort-classes": "off",
|
|
21
|
-
"@angular-eslint/directive-selector": [
|
|
22
|
-
"error",
|
|
23
|
-
{ type: "attribute", prefix: "app", style: "camelCase" },
|
|
24
|
-
], // Enforces a consistent naming convention for Angular directives
|
|
25
|
-
"@angular-eslint/component-selector": [
|
|
26
|
-
"error",
|
|
27
|
-
{ type: "element", prefix: "app", style: "kebab-case" },
|
|
28
|
-
], // Enforces a consistent naming convention for Angular components
|
|
29
|
-
"no-async-promise-executor": "warn", // Warns when using an async function as a Promise executor
|
|
30
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
31
|
-
"@typescript-eslint/no-unused-vars": "error", // Reports unused variables in TypeScript code
|
|
32
|
-
},
|
|
6
|
+
export default [
|
|
7
|
+
{
|
|
8
|
+
files: ["*.ts"],
|
|
9
|
+
languageOptions: {
|
|
10
|
+
parser: tsParser,
|
|
33
11
|
},
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"plugin:@angular-eslint/template/accessibility",
|
|
39
|
-
],
|
|
40
|
-
rules: {
|
|
41
|
-
/**
|
|
42
|
-
* Any template/HTML related rules you wish to use/reconfigure over and above the
|
|
43
|
-
* recommended set provided by the @angular-eslint project would go here.
|
|
44
|
-
*/
|
|
45
|
-
"@angular-eslint/template/interactive-supports-focus": "warn", // Warns about interactive elements lacking keyboard focus handling in Angular templates
|
|
46
|
-
"@angular-eslint/template/click-events-have-key-events": "warn", // Warns about clickable elements lacking keyboard support in Angular templates
|
|
47
|
-
},
|
|
12
|
+
plugins: {
|
|
13
|
+
"@typescript-eslint": typescript,
|
|
14
|
+
"@stylistic": stylistic,
|
|
15
|
+
typescript,
|
|
48
16
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
17
|
+
rules: {
|
|
18
|
+
// TS
|
|
19
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
20
|
+
"error",
|
|
21
|
+
{ "ts-ignore": "allow-with-description" },
|
|
22
|
+
], // Bans specific TypeScript comment syntax
|
|
23
|
+
"@stylistic/member-delimiter-style": [
|
|
24
|
+
"error",
|
|
25
|
+
{
|
|
26
|
+
multiline: {
|
|
27
|
+
delimiter: "semi",
|
|
28
|
+
requireLast: true,
|
|
29
|
+
},
|
|
30
|
+
singleline: {
|
|
31
|
+
delimiter: "semi",
|
|
32
|
+
requireLast: false,
|
|
33
|
+
},
|
|
34
|
+
multilineDetection: "brackets",
|
|
63
35
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"@typescript-eslint/consistent-type-definitions": ["error", "interface"], // Enforces consistent usage of type definitions in TypeScript (interface vs type)
|
|
73
|
-
"@typescript-eslint/prefer-ts-expect-error": "error", // Recommends using '@ts-expect-error' over '@ts-ignore' when ignoring TypeScript errors
|
|
74
|
-
"@typescript-eslint/no-require-imports": "error", // Disallows using the `require` function to import modules in TypeScript
|
|
75
|
-
"no-useless-constructor": "off", // Disallows unnecessary constructors
|
|
76
|
-
indent: "off", // Disallows inconsistent indentation
|
|
77
|
-
"@typescript-eslint/no-invalid-this": "error", // Reports invalid uses of 'this' in TypeScript code
|
|
36
|
+
], // Enforces member delimiter style in TypeScript interfaces and type literals
|
|
37
|
+
"@stylistic/type-annotation-spacing": ["error", {}], // Enforces consistent spacing around type annotations in TypeScript
|
|
38
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"], // Enforces consistent usage of type definitions in TypeScript (interface vs type)
|
|
39
|
+
"@typescript-eslint/prefer-ts-expect-error": "error", // Recommends using '@ts-expect-error' over '@ts-ignore' when ignoring TypeScript errors
|
|
40
|
+
"@typescript-eslint/no-require-imports": "error", // Disallows using the `require` function to import modules in TypeScript
|
|
41
|
+
"no-useless-constructor": "off", // Disallows unnecessary constructors
|
|
42
|
+
indent: "off", // Disallows inconsistent indentation
|
|
43
|
+
"@typescript-eslint/no-invalid-this": "error", // Reports invalid uses of 'this' in TypeScript code
|
|
78
44
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"error",
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
"@typescript-eslint/lines-between-class-members": [
|
|
110
|
-
"error",
|
|
111
|
-
"always",
|
|
112
|
-
{ exceptAfterSingleLine: true },
|
|
113
|
-
], // Requires an empty line between class members in TypeScript code, except after a single-line member
|
|
114
|
-
"@typescript-eslint/brace-style": [
|
|
115
|
-
"error",
|
|
116
|
-
"1tbs",
|
|
117
|
-
{ allowSingleLine: false },
|
|
118
|
-
],
|
|
45
|
+
"@typescript-eslint/no-redeclare": "error", // Reports redeclaring variables in TypeScript code
|
|
46
|
+
"@typescript-eslint/no-use-before-define": [
|
|
47
|
+
"error",
|
|
48
|
+
{ functions: false, classes: false, variables: true },
|
|
49
|
+
], // Reports using variables before they are defined in TypeScript code (excluding functions and classes)
|
|
50
|
+
"@stylistic/comma-dangle": ["error", "only-multiline"], // Enforces trailing commas in TypeScript arrays and objects, but only in multiline expressions
|
|
51
|
+
"@stylistic/object-curly-spacing": ["error", "always"], // Enforces consistent spacing inside braces for TypeScript objects
|
|
52
|
+
"@stylistic/semi": ["error"], // Enforces the use of semicolons in TypeScript code
|
|
53
|
+
"@stylistic/quotes": ["error", "single"], // Enforces the consistent use of single quotes in TypeScript code
|
|
54
|
+
"@stylistic/space-before-blocks": ["error", "always"], // Enforces consistent spacing before blocks in TypeScript code
|
|
55
|
+
"@stylistic/space-before-function-paren": [
|
|
56
|
+
"error",
|
|
57
|
+
{
|
|
58
|
+
anonymous: "always",
|
|
59
|
+
named: "never",
|
|
60
|
+
asyncArrow: "always",
|
|
61
|
+
},
|
|
62
|
+
], // Enforces consistent spacing before function parentheses in TypeScript code, with specific rules for anonymous, named, and async arrow functions
|
|
63
|
+
"@stylistic/space-infix-ops": "error", // Enforces spacing around infix operators in TypeScript code
|
|
64
|
+
"@stylistic/keyword-spacing": ["error", { before: true, after: true }], // Enforces consistent spacing before and after keywords in TypeScript code
|
|
65
|
+
"@stylistic/comma-spacing": ["error", { before: false, after: true }], // Enforces consistent spacing before and after commas in TypeScript code
|
|
66
|
+
"@stylistic/no-extra-parens": ["error", "functions"], // Reports unnecessary parentheses in TypeScript code, excluding function expressions
|
|
67
|
+
"@typescript-eslint/no-dupe-class-members": "error", // Reports duplicate class members in TypeScript code
|
|
68
|
+
"@typescript-eslint/no-loss-of-precision": "error", // Reports literal numbers that lose precision in TypeScript code
|
|
69
|
+
"@stylistic/lines-between-class-members": [
|
|
70
|
+
"error",
|
|
71
|
+
"always",
|
|
72
|
+
{ exceptAfterSingleLine: true },
|
|
73
|
+
], // Requires an empty line between class members in TypeScript code, except after a single-line member
|
|
74
|
+
"@stylistic/brace-style": ["error", "1tbs", { allowSingleLine: false }],
|
|
119
75
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
76
|
+
// normal
|
|
77
|
+
"no-console": ["error", { allow: ["info", "debug", "warn", "error"] }], // Disallows or restricts the use of certain console methods
|
|
78
|
+
"prefer-template": "error",
|
|
79
|
+
curly: ["error", "all"],
|
|
80
|
+
"max-statements-per-line": ["error", { max: 1 }],
|
|
125
81
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
82
|
+
// off
|
|
83
|
+
// TS
|
|
84
|
+
"@typescript-eslint/consistent-indexed-object-style": "off", // Enforces consistent usage of index signatures or record types in TypeScript code
|
|
85
|
+
"@typescript-eslint/naming-convention": "off", // Enforces naming conventions for variables, functions, classes, etc. in TypeScript code
|
|
86
|
+
"@typescript-eslint/explicit-member-accessibility": "off", // Requires explicit accessibility modifiers on class members in TypeScript code
|
|
87
|
+
"@typescript-eslint/parameter-properties": "off", // Requires parameter properties to be declared on the constructor in TypeScript code
|
|
88
|
+
"@typescript-eslint/interface-name-prefix": "off", // Requires or disallows a prefix for interface names in TypeScript code
|
|
89
|
+
"@typescript-eslint/no-empty-interface": "off", // Disallows empty interfaces in TypeScript code
|
|
90
|
+
"@typescript-eslint/ban-ts-ignore": "off", // Disallows the use of the '@ts-ignore' comment in TypeScript code
|
|
91
|
+
"@typescript-eslint/no-empty-function": "off", // Disallows empty function declarations in TypeScript code
|
|
92
|
+
"@typescript-eslint/no-non-null-assertion": "off", // Disallows the use of the non-null assertion operator (!) in TypeScript code
|
|
93
|
+
"@typescript-eslint/explicit-module-boundary-types": "off", // Requires explicit return and parameter types on exported functions and methods in TypeScript code
|
|
94
|
+
"@typescript-eslint/ban-types": "off", // Disallows specific types in TypeScript code
|
|
95
|
+
"@typescript-eslint/triple-slash-reference": "off", // Disallows the use of triple slash reference directives in TypeScript code
|
|
140
96
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
97
|
+
// normal
|
|
98
|
+
"no-invalid-this": "off", // Disallows using 'this' outside of classes or class-like objects (turned off because the TypeScript rule handles it)
|
|
99
|
+
"no-redeclare": "off", // Disallows redeclaring variables (turned off because the TypeScript rule handles it)
|
|
100
|
+
"no-use-before-define": "off", // Disallows using variables before they are defined (turned off because the TypeScript rule handles it)
|
|
101
|
+
"brace-style": "off", // Enforces consistent brace style for blocks (turned off because the TypeScript rule handles it)
|
|
102
|
+
"object-curly-spacing": "off", // Enforces consistent spacing inside braces for objects (turned off because the TypeScript rule handles it)
|
|
103
|
+
semi: "off", // Disallows or enforces semicolons (turned off because the TypeScript rule handles it)
|
|
104
|
+
quotes: "off", // Enforces the consistent use of either single or double quotes (turned off because the TypeScript rule handles it)
|
|
105
|
+
"space-before-blocks": "off", // Enforces consistent spacing before blocks (turned off because the TypeScript rule handles it)
|
|
106
|
+
"space-before-function-paren": "off", // Enforces consistent spacing before function parentheses (turned off because the TypeScript rule handles it)
|
|
107
|
+
"space-infix-ops": "off", // Enforces spacing around infix operators (turned off because the TypeScript rule handles it)
|
|
108
|
+
"keyword-spacing": "off", // Enforces consistent spacing before and after keywords (turned off because the TypeScript rule handles it)
|
|
109
|
+
"comma-spacing": "off", // Enforces consistent spacing before and after commas (turned off because the TypeScript rule handles it)
|
|
110
|
+
"no-extra-parens": "off", // Disallows unnecessary parentheses (turned off because the TypeScript rule handles it)
|
|
111
|
+
"no-dupe-class-members": "off", // Disallows duplicate class members (turned off because the TypeScript rule handles it)
|
|
112
|
+
"no-loss-of-precision": "off", // Disallows literal numbers that lose precision (turned off because the TypeScript rule handles it)
|
|
113
|
+
"lines-between-class-members": "off", // Requires an empty line between class members (turned off because the TypeScript rule handles it)
|
|
114
|
+
},
|
|
158
115
|
},
|
|
159
|
-
|
|
116
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/eslint-config-angular",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "ESLint config of lenne.Tech for Angular",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -10,26 +10,23 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"index.js"
|
|
12
12
|
],
|
|
13
|
+
"type": "module",
|
|
13
14
|
"scripts": {
|
|
14
15
|
"watch": "watch 'yalc push --private'"
|
|
15
16
|
},
|
|
16
17
|
"peerDependencies": {
|
|
17
|
-
"eslint": ">=
|
|
18
|
+
"eslint": ">=9.0.0"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@
|
|
22
|
-
"@
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"@typescript-eslint/eslint-plugin": "6.7.0",
|
|
26
|
-
"@typescript-eslint/parser": "6.7.0",
|
|
27
|
-
"eslint-config-prettier": "9.0.0",
|
|
28
|
-
"eslint-plugin-perfectionist": "2.4.2",
|
|
21
|
+
"@typescript-eslint/parser": "8.19.1",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "8.19.1",
|
|
23
|
+
"@stylistic/eslint-plugin": "2.12.1",
|
|
24
|
+
"eslint-config-prettier": "9.1.0",
|
|
25
|
+
"eslint-plugin-perfectionist": "4.5.0",
|
|
29
26
|
"functions-have-names": "1.2.3"
|
|
30
27
|
},
|
|
31
28
|
"devDependencies": {
|
|
32
|
-
"eslint": "
|
|
29
|
+
"eslint": "9.17.0",
|
|
33
30
|
"watch": "1.0.2"
|
|
34
31
|
}
|
|
35
32
|
}
|