Skip to content

Commit 691d3c3

Browse files
klaascuvelierAkshat55zvonimirfras
authored
chore: migrate to eslint (#3086)
Signed-off-by: Akshat Patel <38994122+Akshat55@users.noreply.github.com> Co-authored-by: Akshat Patel <38994122+Akshat55@users.noreply.github.com> Co-authored-by: Zvonimir Fras <zvonimir@zvonimirfras.com>
1 parent 789b47a commit 691d3c3

File tree

120 files changed

+4484
-2121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+4484
-2121
lines changed

eslint.config.js

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
const eslint = require("@eslint/js");
2+
const tseslint = require("typescript-eslint");
3+
const angular = require("angular-eslint");
4+
5+
module.exports = tseslint.config({
6+
files: ["src/**/*.ts"],
7+
extends: [
8+
eslint.configs.recommended,
9+
...tseslint.configs.recommended,
10+
...tseslint.configs.stylistic,
11+
...angular.configs.tsRecommended,
12+
],
13+
rules: {
14+
// @todo - Enable v7/8?
15+
"@angular-eslint/component-class-suffix": "off",
16+
"@angular-eslint/component-selector": [
17+
"error",
18+
{
19+
type: "element",
20+
prefix: ["ibm", "cds", "app", "test"],
21+
style: "kebab-case"
22+
}
23+
],
24+
// @todo - Enable v7/8?
25+
"@angular-eslint/directive-class-suffix": "off",
26+
"@angular-eslint/directive-selector": [
27+
"error",
28+
{
29+
type: "attribute",
30+
prefix: ["ibm", "cds", "app", "test"],
31+
style: "camelCase"
32+
}
33+
],
34+
"@angular-eslint/no-host-metadata-property": "error",
35+
"@angular-eslint/no-input-rename": "error",
36+
"@angular-eslint/no-inputs-metadata-property": "error",
37+
// @todo - Enable v7/8 - Need to prepare a schematic
38+
"@angular-eslint/no-output-native": "warn",
39+
"@angular-eslint/no-output-on-prefix": "warn",
40+
"@angular-eslint/no-output-rename": "error",
41+
"@angular-eslint/no-outputs-metadata-property": "error",
42+
"@angular-eslint/use-lifecycle-interface": "error",
43+
"@angular-eslint/use-pipe-transform-interface": "error",
44+
"@angular-eslint/no-attribute-decorator": "error",
45+
"@typescript-eslint/adjacent-overload-signatures": "off",
46+
"@typescript-eslint/array-type": "off",
47+
"@typescript-eslint/ban-ts-comment": "off",
48+
"@typescript-eslint/class-literal-property-style": "off",
49+
"@typescript-eslint/consistent-generic-constructors": "off",
50+
"@typescript-eslint/consistent-indexed-object-style": "off",
51+
"@typescript-eslint/member-ordering": [
52+
"error",
53+
{
54+
default: [
55+
"public-static-field",
56+
"protected-static-field",
57+
"private-static-field",
58+
"public-static-method",
59+
"protected-static-method",
60+
"private-static-method",
61+
"public-instance-field",
62+
"protected-instance-field",
63+
"private-instance-field",
64+
"public-constructor",
65+
"protected-constructor",
66+
"private-constructor",
67+
"public-instance-method",
68+
"protected-instance-method",
69+
"private-instance-method"
70+
]
71+
}
72+
],
73+
"@typescript-eslint/naming-convention": [
74+
"error",
75+
{
76+
selector: "class",
77+
format: ["PascalCase"]
78+
}
79+
],
80+
"@typescript-eslint/no-empty-function": "off",
81+
"@typescript-eslint/no-explicit-any": "off",
82+
"@typescript-eslint/no-inferrable-types": "error",
83+
"@typescript-eslint/no-unsafe-function-type": "off",
84+
"@typescript-eslint/no-unused-vars": "off",
85+
"@typescript-eslint/no-wrapper-object-types": "off",
86+
"@typescript-eslint/prefer-for-of": "off",
87+
"@typescript-eslint/triple-slash-reference": "off",
88+
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
89+
"comma-dangle": ["error", "never"],
90+
"comma-spacing": ["error", { "before": false, "after": true }],
91+
"curly": "error",
92+
"eol-last": "error",
93+
"eqeqeq": ["error", "always", { null: "ignore" }],
94+
"guard-for-in": "error",
95+
"indent": ["error", "tab", { "SwitchCase": 1 }],
96+
"keyword-spacing": ["error", { "before": true, "after": true }],
97+
"max-len": ["error", { "code": 140, "ignoreTemplateLiterals": true }],
98+
"no-bitwise": "error",
99+
"no-caller": "error",
100+
"no-case-declarations": "error",
101+
"no-console": ["warn", { "allow": ["warn", "error"] }],
102+
"no-debugger": "error",
103+
"no-duplicate-case": "error",
104+
"no-empty": "off",
105+
"no-eval": "error",
106+
"no-new-wrappers": "error",
107+
"no-prototype-builtins": "off",
108+
"no-restricted-globals": ["error", "event", "fdescribe", "fit"],
109+
"no-self-assign": "off",
110+
"no-shadow": "off",
111+
"no-trailing-spaces": "error",
112+
"no-unused-expressions": "off",
113+
"no-useless-catch": "off",
114+
"no-var": "error",
115+
"prefer-const": "off",
116+
"quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }],
117+
"radix": "error",
118+
"semi": ["error", "always"],
119+
"sort-keys": "off",
120+
"space-before-blocks": "error",
121+
"space-before-function-paren": "off",
122+
"space-infix-ops": "error",
123+
"spaced-comment": "off"
124+
}
125+
},
126+
{
127+
// Everything in this config object targets our HTML files (external templates,
128+
// and inline templates as long as we have the `processor` set on our TypeScript config above)
129+
extends: [
130+
...angular.configs.templateRecommended,
131+
...angular.configs.templateAccessibility,
132+
],
133+
files: ["**/*.html"],
134+
processor: angular.processInlineTemplates,
135+
rules: {
136+
"max-len": "off",
137+
"@angular-eslint/template/elements-content": "warn",
138+
"@angular-eslint/template/label-has-associated-control": "warn",
139+
"@angular-eslint/template/interactive-supports-focus": "warn",
140+
"@angular-eslint/template/click-events-have-key-events": "warn",
141+
"@angular-eslint/template/role-has-required-aria": "warn",
142+
"@angular-eslint/template/alt-text": "warn"
143+
},
144+
}
145+
);

0 commit comments

Comments
 (0)