-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
101 lines (91 loc) · 2.06 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
// @ts-check
import antfu from "@antfu/eslint-config";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
export default antfu(
{
// Or customize the stylistic rules
stylistic: {
indent: 2, // 4, or 'tab'
quotes: "double", // or 'double'
semi: true, // or 'always'
},
// TypeScript and Vue are auto-detected, you can also explicitly enable them:
/**
* @see https://stackoverflow.com/questions/65137939/typescript-eslint-throws-cannot-read-file-tsconfig-json-in-every-project-i-s
*/
typescript: {
tsconfigPath: "./tsconfig.json",
parserOptions: {
project: "tsconfig.json",
sourceType: "module",
tsconfigRootDir: __dirname,
},
},
vue: true,
javascript: {
/**
* @see https://eslint.org/docs/latest/use/configure/migration-guide#importing-plugins-and-custom-parsers
*/
overrides: {
"jsdoc/require-description": "error",
"jsdoc/check-values": "error",
},
},
// Disable jsonc and yaml support
jsonc: false,
yaml: false,
// `.eslintignore` is no longer supported in Flat config, use `ignores` instead
ignores: [
"**/fixtures",
// ...globs
],
/**
* @see https://juejin.cn/post/7338074027281104936
*/
formatters: {
/**
* Format CSS, LESS, SCSS files, also the `<style>` blocks in Vue
* By default uses Prettier
*/
css: true,
/**
* Format HTML files
* By default uses Prettier
*/
html: true,
/**
* Format Markdown files
* Supports Prettier and dprint
* By default uses Prettier
*/
markdown: "prettier",
},
},
{
rules: {
"no-console": "off",
// 设置为总是警告
// "style/semi": ["warn", "always"],
},
},
{
rules: {
"prettier/prettier": [
"error",
{
usePrettierrc: true,
singleQuote: false,
printWidth: 120,
semi: true,
jsxSingleQuote: true,
useTabs: true,
tabWidth: 2,
endOfLine: "auto",
},
],
},
},
eslintConfigPrettier,
eslintPluginPrettierRecommended,
);