Skip to content

Commit 4b691f2

Browse files
committed
Style: Improve code style based on official HA frontend repository
1 parent aadfaec commit 4b691f2

File tree

3 files changed

+478
-282
lines changed

3 files changed

+478
-282
lines changed

.eslintrc

+124-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,130 @@
11
{
2-
"env": {
3-
"browser": true,
4-
"es6": true
2+
"extends": [
3+
"airbnb-base",
4+
"airbnb-typescript/base",
5+
"plugin:@typescript-eslint/recommended",
6+
"plugin:wc/recommended",
7+
"plugin:lit/all",
8+
"plugin:lit-a11y/recommended",
9+
"prettier"
10+
],
11+
"parser": "@typescript-eslint/parser",
12+
"parserOptions": {
13+
"ecmaVersion": 2020,
14+
"ecmaFeatures": {
15+
"modules": true
16+
},
17+
"sourceType": "module",
18+
"project": "./tsconfig.json"
19+
},
20+
"settings": {
21+
"import/resolver": {
22+
"webpack": {
23+
"config": "./webpack.config.cjs"
24+
}
25+
}
526
},
6-
"extends": "eslint:recommended",
727
"globals": {
8-
"Atomics": "readonly",
9-
"SharedArrayBuffer": "readonly"
28+
"__DEV__": false,
29+
"__DEMO__": false,
30+
"__BUILD__": false,
31+
"__VERSION__": false,
32+
"__STATIC_PATH__": false,
33+
"__SUPERVISOR__": false,
34+
"Polymer": true
1035
},
11-
"parserOptions": {
12-
"ecmaVersion": 2018,
13-
"sourceType": "module"
36+
"env": {
37+
"browser": true,
38+
"es6": true
1439
},
1540
"rules": {
16-
}
17-
}
41+
"class-methods-use-this": "off",
42+
"new-cap": "off",
43+
"prefer-template": "off",
44+
"object-shorthand": "off",
45+
"func-names": "off",
46+
"no-underscore-dangle": "off",
47+
"strict": "off",
48+
"no-plusplus": "off",
49+
"no-bitwise": "error",
50+
"comma-dangle": "off",
51+
"vars-on-top": "off",
52+
"no-continue": "off",
53+
"no-param-reassign": "off",
54+
"no-multi-assign": "off",
55+
"no-console": "error",
56+
"radix": "off",
57+
"no-alert": "off",
58+
"no-nested-ternary": "off",
59+
"prefer-destructuring": "off",
60+
"no-restricted-globals": [2, "event"],
61+
"prefer-promise-reject-errors": "off",
62+
"import/prefer-default-export": "off",
63+
"import/no-default-export": "off",
64+
"import/no-unresolved": "off",
65+
"import/no-cycle": "off",
66+
"import/extensions": [
67+
"error",
68+
"ignorePackages",
69+
{
70+
"ts": "never",
71+
"js": "never"
72+
}
73+
],
74+
"no-restricted-syntax": ["error", "LabeledStatement", "WithStatement"],
75+
"object-curly-newline": "off",
76+
"default-case": "off",
77+
"wc/no-self-class": "off",
78+
"no-shadow": "off",
79+
"@typescript-eslint/camelcase": "off",
80+
"@typescript-eslint/ban-ts-comment": "off",
81+
"@typescript-eslint/no-use-before-define": "off",
82+
"@typescript-eslint/no-non-null-assertion": "off",
83+
"@typescript-eslint/no-explicit-any": "off",
84+
"@typescript-eslint/explicit-function-return-type": "off",
85+
"@typescript-eslint/explicit-module-boundary-types": "off",
86+
"@typescript-eslint/no-shadow": ["error"],
87+
"@typescript-eslint/naming-convention": [
88+
"off",
89+
{
90+
"selector": "default",
91+
"format": ["camelCase", "snake_case"],
92+
"leadingUnderscore": "allow",
93+
"trailingUnderscore": "allow"
94+
},
95+
{
96+
"selector": ["variable"],
97+
"format": ["camelCase", "snake_case", "UPPER_CASE"],
98+
"leadingUnderscore": "allow",
99+
"trailingUnderscore": "allow"
100+
},
101+
{
102+
"selector": "typeLike",
103+
"format": ["PascalCase"]
104+
}
105+
],
106+
"@typescript-eslint/no-unused-vars": "off",
107+
"unused-imports/no-unused-vars": [
108+
"error",
109+
{
110+
"vars": "all",
111+
"varsIgnorePattern": "^_",
112+
"args": "after-used",
113+
"argsIgnorePattern": "^_",
114+
"ignoreRestSiblings": true
115+
}
116+
],
117+
"unused-imports/no-unused-imports": "error",
118+
"lit/attribute-value-entities": "off",
119+
"lit/no-template-map": "off",
120+
"lit/no-native-attributes": "warn",
121+
"lit/no-this-assign-in-render": "warn",
122+
"lit-a11y/click-events-have-key-events": ["off"],
123+
"lit-a11y/no-autofocus": "off",
124+
"lit-a11y/alt-text": "warn",
125+
"lit-a11y/anchor-is-valid": "warn",
126+
"lit-a11y/role-has-required-aria-attrs": "warn"
127+
},
128+
"plugins": ["disable", "unused-imports"],
129+
"processor": "disable/disable"
130+
}

.prettierrc

-7
This file was deleted.

0 commit comments

Comments
 (0)