-
Notifications
You must be signed in to change notification settings - Fork 52
/
.eslintrc.json
144 lines (135 loc) · 4.02 KB
/
.eslintrc.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{
"root": true,
"env": {
"es2022": true
},
"plugins": ["promise", "no-only-tests", "eslint-plugin-html"],
"extends": [
"eslint:recommended",
"standard",
"plugin:import/recommended",
"plugin:promise/recommended",
"plugin:cypress/recommended"
],
"globals":{
"RED": "readonly",
"$": "readonly"
},
"parserOptions": {
"ecmaVersion": 2022
},
"ignorePatterns": ["dist/", "*.svg", "*.xml"],
"rules": {
// Inbuilt
"indent": ["error", 4],
"object-shorthand": ["error"],
"sort-imports": [
"error",
{
"ignoreDeclarationSort": true
}
],
"no-console": ["error", { "allow": ["log", "info", "warn", "error"] }],
// "no-console": ["error", { "allow": ["info", "warn", "error"] }], // TODO: enable this for v1.0.0
// plugin:import
"import/order": [
"error",
{
"alphabetize": {
"order": "asc"
},
"newlines-between": "always-and-inside-groups"
}
],
"import/no-unresolved": "error",
// plugin:no-only-tests
"no-only-tests/no-only-tests": "error",
// plugin:promise
"promise/catch-or-return": ["error", { "allowFinally": true }]
},
"overrides": [
// Tests use Mocha
{
"files": ["test/**"],
"env": {
"mocha": true
}
},
// Nodes use CommonJS and are imported by node-red into a Node-Runtime
{
"files": "nodes/**",
"extends": ["plugin:n/recommended"],
"env": {
"commonjs": true,
"browser": false
},
"rules": {
// plugin:n
"n/file-extension-in-import": "error",
"n/no-missing-import": "error",
"n/no-missing-require": "error"
}
},
// Frontend runs in the browser and builds with vite
{
"files": "ui/src/**",
"plugins": ["vue", "vuetify"],
"extends": [
"plugin:vue/vue3-recommended",
"plugin:vuetify/base"
],
"env": {
"browser": true,
"commonjs": false
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2022
},
"rules": {
// plugin:vue
"vue/html-indent": ["error", 4],
"vue/singleline-html-element-content-newline": "off",
"vue/max-attributes-per-line": "off",
"vue/attribute-hyphenation": "off",
// plugin:promise
"promise/always-return": "off" // common Vue.js pattern
}
},
// Docs also Vue in browser but are less strict
{
"files": "docs/**",
"plugins": ["vue"],
"extends": [
"plugin:vue/vue3-essential"
],
"env": {
"browser": true,
"commonjs": false
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2022
}
},
// Cypress is used for E2E
{
"files": "test/e2e/**",
"env": {
"cypress/globals": true
},
"extends": ["plugin:cypress/recommended"],
"plugins": ["cypress"],
"rules": {
// plugin:cypress
"cypress/require-data-selectors": "warn",
"cypress/assertion-before-screenshot": "error",
"cypress/no-force": "warn",
"cypress/no-pause": "error",
// plugin:n
"promise/always-return": "off",
"promise/catch-or-return": "off"
}
}
]
}