-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
141 lines (140 loc) · 4.83 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
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
import vueParser from 'vue-eslint-parser'
import js from '@eslint/js'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import * as regexpPlugin from 'eslint-plugin-regexp'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
import pluginVue from 'eslint-plugin-vue'
import globals from 'globals'
import tseslint from 'typescript-eslint'
export default [
js.configs.recommended,
...pluginVue.configs['flat/recommended'],
...tseslint.configs.recommended,
eslintPluginPrettierRecommended,
regexpPlugin.configs['flat/recommended'],
{
files: ['**/*.{ts,tsx,js,mjs,cjs,vue}'],
plugins: {
vue: pluginVue,
'simple-import-sort': simpleImportSort,
ts: tseslint.plugin
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
parser: vueParser,
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 'es2022',
sourceType: 'module'
},
globals: {
...globals.browser,
...globals.node,
...globals.es2021
}
},
rules: {
indent: 'off',
'@typescript-eslint/indent': ['error', 4],
'no-console': ['warn', { allow: ['warn', 'error'] }],
'consistent-return': 'error',
'space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'never',
asyncArrow: 'always'
}
],
'no-redeclare': 'off',
'simple-import-sort/imports': [
'error',
{
groups: [
[
// Side effect imports.
'^\\u0000',
// Packages. `vue` related packages come first.
'^vue',
'^@?\\w',
// Internal packages.
'^(src|components|config|utils|pages|hooks|api)(/.*|$)',
// Parent imports. Put `..` last.
'^\\.\\.(?!/?$)',
'^\\.\\./?$',
// Other relative imports. Put same-folder imports and `.` last.
'^\\./(?=.*/)(?!/?$)',
'^\\.(?!/?$)',
'^\\./?$',
// Style imports.
'^.+\\.s?css$'
]
]
}
],
'simple-import-sort/exports': 'error',
'vue/multi-word-component-names': 'off',
'vue/attribute-hyphenation': [
'warn',
'always',
{
ignore: ['on']
}
],
'vue/component-definition-name-casing': ['error', 'PascalCase'],
'vue/component-name-in-template-casing': [
'error',
'PascalCase',
{
registeredComponentsOnly: true
}
],
'vue/singleline-html-element-content-newline': 'off',
'vue/html-indent': [
'error',
4,
{
attribute: 1,
baseIndent: 1,
closeBracket: 0,
alignAttributesVertically: true,
ignores: []
}
],
'func-call-spacing': 'off',
'@typescript-eslint/func-call-spacing': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports'
}
],
'no-undef': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': [
'error',
{
enums: false,
typedefs: false,
ignoreTypeReferences: false,
functions: false
}
],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
ignoreRestSiblings: true
}
],
'@typescript-eslint/no-explicit-any': 'off'
}
}
]