@lenne.tech/eslint-config-angular 0.0.2

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