-
Notifications
You must be signed in to change notification settings - Fork 4
/
.eslintrc.cjs
187 lines (179 loc) · 5.99 KB
/
.eslintrc.cjs
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
parserOptions: {
parser: '@babel/eslint-parser',
requireConfigFile: false,
},
extends: [
'eslint:recommended',
// https://github.com/vuejs/eslint-plugin-vue
'plugin:vue/recommended',
'plugin:jsdoc/recommended',
],
// required to lint *.vue files
plugins: [
'vue',
'jsdoc',
],
settings: {
'jsdoc': {
mode: 'jsdoc', // instead of 'typescript'
tagNamePreference: {
// "return": "return",
},
},
},
// add your custom rules here
rules: {
'arrow-parens': ["error", "always"],
'no-unused-vars': 0,
'no-undef': 0,
'no-console': 0,
'no-empty': 0,
'comma-dangle': ["error", "always-multiline"],
'comma-spacing': ["error", { "before": false, "after": true }],
'semi': ["error", "always"],
'semi-spacing': "error",
'space-before-function-paren': ["error", {"anonymous": "never", "named": "never", "asyncArrow": "always"}],
// VUE UNCATEGORIZED
'vue/html-button-has-type': ['error'],
"vue/next-tick-style": ["warn", "promise"],
'vue/no-duplicate-attr-inheritance': ['error'],
"vue/no-potential-component-option-typo": ["warn"],
'vue/no-this-in-before-route-enter': 'error',
"vue/script-indent": ["warn", 4, {
"baseIndent": 0,
"switchCase": 1,
"ignores": [],
}],
'vue/v-on-function-call': ["error", "always"],
// VUE 3 ESSENTIAL
'vue/no-deprecated-data-object-declaration': 'error',
'vue/no-deprecated-filter': 'error',
'vue/no-deprecated-props-default-this': 'error',
'vue/no-deprecated-router-link-tag-prop': 'error',
'vue/no-deprecated-scope-attribute': 'error',
'vue/no-deprecated-slot-attribute': 'error',
'vue/no-deprecated-slot-scope-attribute': 'error',
'vue/prefer-import-from-vue': 'error',
'vue/require-toggle-inside-transition': 'error',
// VUE STRONGLY-RECOMMENDED
'vue/html-closing-bracket-spacing': 0,
'vue/html-indent': ["warn", 4, {
"attribute": 1,
"baseIndent": 1,
"closeBracket": 0,
"alignAttributesVertically": true,
// align with default webstorm behavior
"ignores": ['VElement[name=thead].children', 'VElement[name=tbody].children'],
}],
"vue/html-self-closing": ["error", {
"html": {
"void": "any",
"normal": "any",
"component": "always",
},
"svg": "always",
"math": "always",
}],
'vue/max-attributes-per-line': 0,
'vue/singleline-html-element-content-newline': 0,
// 'vue/v-bind-style': 0,
// 'vue/v-on-style': 0,
'vue/v-slot-style': 0,
'vue/no-unused-vars': 0,
// allow `$value`
'vue/prop-name-casing': ["warn"],
// allow pages/index.vue
'vue/multi-word-component-names': 0,
// VUE 3 STRONGLY RECOMMENDED
'vue/require-explicit-emits': 'warn',
// VUE RECOMMENDED
// undefined prop is okay
'vue/require-default-prop': 0,
'vue/no-v-html': 0,
'vue/attribute-hyphenation': 0,
"vue/attributes-order": ["warn", {
"order": [
"DEFINITION",
"CONDITIONALS", // v-else before v-for
"LIST_RENDERING",
"RENDER_MODIFIERS",
// "GLOBAL", // allow to be first
// ["UNIQUE", "SLOT"], // allow ref and v-slot to be first
"TWO_WAY_BINDING",
// "OTHER_DIRECTIVES", // allow to be first
// "OTHER_ATTR", // allow html attributes to be first
"EVENTS",
"CONTENT",
],
}],
"vue/order-in-components": ["error", {
"order": [
"el",
"name",
"key",
"parent",
"functional",
["delimiters", "comments"],
"components", "directives", "filters",
"extends",
"mixins",
["provide", "inject"],
// "layout", // allow layout on top
"scrollToTop",
"transition",
"loading",
"ROUTER_GUARDS",
"middleware",
"validate",
"inheritAttrs",
"model",
["props", "propsData", "emits"],
"setup",
"asyncData",
"data",
// "fetch", // allow fetch above data
// "head", // allow head on top
["computed", "validations"],
"watch",
"watchQuery",
"LIFECYCLE_HOOKS",
"methods",
["template", "render"],
"renderError",
],
}],
// JSDOC
'jsdoc/require-param-description': 0,
'jsdoc/require-returns-description': 0,
'jsdoc/require-property-description': 0,
'jsdoc/newline-after-description': 0,
// e.g. export default from .vue
'jsdoc/require-jsdoc': 0,
// poor syntax validator
'jsdoc/valid-types': 0,
// @TODO allow both return and returns
'jsdoc/require-returns': 0,
// @TODO allow both return and returns
'jsdoc/check-tag-names': 0,
// @TODO all custom types treated as undefined
'jsdoc/no-undefined-types': 0,
},
"overrides": [
{
"files": ["*.vue"],
"excludedFiles": "*.test.js",
"rules": {
'array-bracket-newline': ["error", "consistent"],
'array-element-newline': ["error", {
"ArrayExpression": "consistent",
}],
},
},
],
};