-
Notifications
You must be signed in to change notification settings - Fork 253
Expand file tree
/
Copy patheslint.config.js
More file actions
151 lines (138 loc) · 3.8 KB
/
eslint.config.js
File metadata and controls
151 lines (138 loc) · 3.8 KB
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
import antfu from '@antfu/eslint-config';
import { globalIgnores } from 'eslint/config';
import prettier from 'eslint-plugin-prettier/recommended';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import vueCss from 'eslint-plugin-vue-scoped-css';
import globals from 'globals';
import typescript from 'typescript-eslint';
export default antfu(
{
typescript: true,
vue: true,
jsonc: false,
yaml: false,
markdown: false,
formatters: false,
},
[
...vueCss.configs['flat/recommended'],
prettier,
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.jest,
defineProps: 'readonly',
defineEmits: 'readonly',
},
ecmaVersion: 6,
sourceType: 'module',
parserOptions: {
parser: typescript.parser,
allowImportExportEverywhere: true,
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
'simple-import-sort': simpleImportSort,
},
settings: {
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
},
rules: {
/* Closed due to template running
* (Recommended to open!)
*/
'no-console': 'off',
'ts/no-explicit-any': 'off',
/* Disallow person rules */
'antfu/top-level-function': 'off',
'antfu/if-newline': 'off',
'n/prefer-global/process': 'off',
/* If you need control the imports sequence, must be off
* https://github.com/vuejs/vue-eslint-parser/issues/58
*/
'import/first': 'off',
/* Allow start with _ */
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'vue/no-unused-vars': [
'error',
{
ignorePattern: '^_',
},
],
// Using ts/no-unused-vars instead
'no-unused-vars': 'off',
/* Some variables are initialized in the function */
'@typescript-eslint/no-use-before-define': 'off',
'no-use-before-define': 'off',
/* Disable antfu sort, use simple sort import */
'perfectionist/sort-imports': 'off',
'perfectionist/sort-named-imports': 'off',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
// Disable unused-imports rules in other presets
'unused-imports/no-unused-imports': 'off',
'unused-imports/no-unused-vars': 'off',
},
},
{
files: ['**/*.vue'],
rules: {
'vue/component-name-in-template-casing': ['error', 'kebab-case'],
'vue/custom-event-name-casing': ['error', 'kebab-case'],
'vue/block-order': [
'error',
{
order: ['template', 'script', 'style'],
},
],
'vue/block-lang': [
'error',
{
script: {
lang: ['ts', 'tsx'],
},
},
],
'vue/multi-word-component-names': 'off',
'vue/no-reserved-props': 'off',
'vue/no-v-html': 'off',
'vue-scoped-css/no-parsing-error': 'off',
'vue-scoped-css/no-unused-selector': 'off',
'vue-scoped-css/enforce-style-type': [
'error',
{
allows: ['scoped'],
},
],
'vue/padding-line-between-blocks': ['error', 'never'],
},
},
globalIgnores([
'**/snapshot*',
'**/dist',
'**/lib',
'**/es',
'**/esm',
'**/node_modules',
'src/_common',
'**/static',
'**/cypress',
'script/test/cypress',
'**/_site',
'**/temp*',
'**/static/',
'!**/.prettierrc.js',
]),
],
);