-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy patheslint.config.js
74 lines (67 loc) · 2.03 KB
/
eslint.config.js
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
// @see https://dev.to/devidev/setting-up-eslint-9130-with-prettier-typescript-vuejs-and-vscode-autosave-autoformat-n0
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import pluginVue from 'eslint-plugin-vue';
/** @type {import('eslint').Linter.Config[]} */
const config = [
{
ignores: [
'**/*.d.ts',
"demo/**",
"dist/**",
"node_modules/**",
],
},
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
// js
pluginJs.configs.recommended,
// ts
...tseslint.configs.recommended,
// vue
...pluginVue.configs['flat/recommended'],
{
files: ['*.vue', '**/*.vue'],
languageOptions: {
parserOptions: {
parser: tseslint.parser,
},
},
},
// rules override
{
rules: {
indent: ['error', 4, { SwitchCase: 1 }],
semi: ["error", "always"],
"comma-dangle": ["error", "always-multiline"],
"arrow-parens": ["error", "always"],
"space-before-function-paren": ["error", {
anonymous: "never",
named: "never",
asyncArrow: "always",
}],
'max-len': ['off'],
'no-param-reassign': ['off'],
'no-use-before-define': ['off'],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
// allow let
'prefer-const': 'off',
'prefer-destructuring': ['error', { object: true, array: false }],
// allow extension in imports
'import/extensions': 'off',
'prefer-object-spread': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'vue/html-closing-bracket-spacing': 0,
'vue/html-indent': ['error', 4],
'vue/no-v-html': 0,
},
},
];
export default config;