-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
144 lines (142 loc) · 4.94 KB
/
eslint.config.js
File metadata and controls
144 lines (142 loc) · 4.94 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
import process from "node:process";
import antfu from "@antfu/eslint-config";
const SORT_IMPORT_CUSTOM_GROUPS = [{
groupName: "vue",
anyOf: [
{ selector: "type", elementNamePattern: "^vue$" },
{ elementNamePattern: "^vue$" }
]
}, {
groupName: "vue-libs",
anyOf: [
{ selector: "type", elementNamePattern: ["^vue-router$", "^vue-i18n$", "^@vueuse/"] },
{ elementNamePattern: ["^vue-router$", "^vue-i18n$", "^@vueuse/"] }
]
}, {
groupName: "vue-components",
anyOf: [
{ selector: "type", elementNamePattern: "\\.vue$" },
{ elementNamePattern: "\\.vue$" }
]
}];
export default antfu({
isInEditor: false,
ignores: ["**/typed-router.ts"]
}, {
rules: {
"antfu/consistent-list-newline": "off",
"antfu/if-newline": "off",
"curly": ["error", "multi-line"],
"import/consistent-type-specifier-style": "off",
"max-lines": ["warn", { max: 1000 }],
"max-params": ["error", { max: 6 }],
"no-await-in-loop": "error",
"no-console": [process.env.NODE_ENV === "production" ? "error" : "warn", {
allow: ["table", "info", "warn", "error"]
}],
"no-duplicate-imports": "error",
"no-else-return": "error",
"no-restricted-globals": ["error",
{ name: "global", message: "Use `globalThis` instead." },
{ name: "self", message: "Use `globalThis` instead." },
{ name: "location", message: "Use `window.location` instead." },
{ name: "close", message: "Use `window.close` instead." }
],
"no-return-assign": "error",
"no-script-url": "error",
"no-useless-concat": "error",
"no-void": "error",
"perfectionist/sort-named-imports": ["error", {
order: "asc",
type: "natural",
groups: ["value-import", "type-import"]
}],
"perfectionist/sort-imports": ["error", {
internalPattern: ["^@/"],
groups: [
"builtin",
"vue",
"vue-libs",
"value-external",
"type-import",
"value-internal",
["value-parent", "value-sibling", "value-index"],
"type-internal",
["type-parent", "type-sibling", "type-index"],
"side-effect",
"vue-components",
"ts-equals-import",
"unknown"
],
customGroups: SORT_IMPORT_CUSTOM_GROUPS,
newlinesBetween: 0,
newlinesInside: 0,
order: "asc",
type: "natural"
}],
"prefer-destructuring": ["error", { array: true, object: true }],
"require-await": "warn",
"style/arrow-parens": ["error", "always"],
"style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
"style/comma-dangle": ["error", "never"],
"style/indent": ["error", 2, {
ArrayExpression: 1,
CallExpression: { arguments: 1 },
flatTernaryExpressions: false,
FunctionDeclaration: { body: 1, parameters: 1 },
FunctionExpression: { body: 1, parameters: 1 },
ignoreComments: false,
ignoredNodes: [
"TSUnionType",
"TSIntersectionType",
"TSTypeParameterInstantiation",
"FunctionExpression > .params[decorators.length > 0]",
"FunctionExpression > .params > :matches(Decorator, :not(:first-child))"
],
ImportDeclaration: 1,
MemberExpression: 1,
ObjectExpression: 1,
offsetTernaryExpressions: false,
outerIIFEBody: 1,
SwitchCase: 1,
tabLength: 2,
VariableDeclarator: 1
}],
"style/lines-between-class-members": "off",
"style/max-statements-per-line": "off",
"style/operator-linebreak": ["error", "after"],
"style/quotes": ["error", "double"],
"style/semi": ["error", "always"],
"ts/array-type": "error",
"ts/consistent-indexed-object-style": "error",
"ts/consistent-type-definitions": ["error", "interface"],
"ts/member-ordering": ["error", { default: { optionalityOrder: "required-first" } }],
"ts/no-shadow": "error",
"unicorn/prefer-includes": "off",
"yaml/quotes": ["error", { prefer: "double" }]
}
}, {
files: ["**/*.vue"],
rules: {
"vue/attribute-hyphenation": ["error", "always"],
"vue/block-order": ["error", { order: ["template", "script", "style"] }],
"vue/comma-dangle": ["error", "never"],
"vue/component-definition-name-casing": ["error", "kebab-case"],
"vue/component-name-in-template-casing": ["error", "kebab-case"],
"vue/custom-event-name-casing": ["error", "camelCase", { ignores: ["/^[a-z]+:[a-z]+[A-Z]?[a-z]+$/"] }],
"vue/html-self-closing": ["error", { svg: "never" }],
"vue/max-attributes-per-line": ["error", { multiline: 1, singleline: 8 }],
"vue/mustache-interpolation-spacing": ["error", "always"],
"vue/no-required-prop-with-default": "error",
"vue/operator-linebreak": ["error", "after"],
"vue/padding-line-between-blocks": ["error", "never"],
"vue/require-emit-validator": "warn",
"vue/v-bind-style": ["error", "shorthand", { sameNameShorthand: "always" }],
"vue/v-on-style": ["error", "shorthand"]
}
}, {
files: ["**/*.md"],
rules: {
"perfectionist/sort-imports": "off"
}
});