-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheslint.config.ts
More file actions
80 lines (77 loc) Β· 2.67 KB
/
eslint.config.ts
File metadata and controls
80 lines (77 loc) Β· 2.67 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
import globals from "globals";
import { defineConfigWithVueTs, vueTsConfigs } from "@vue/eslint-config-typescript";
import prettierEslintConfig from "@vue/eslint-config-prettier";
import pluginVue from "eslint-plugin-vue";
import pluginVitest from "@vitest/eslint-plugin";
import pluginStorybook from "eslint-plugin-storybook";
const languageOptions = {
globals: {
...globals.node,
...globals.browser,
},
parserOptions: {
module: "esnext",
tsconfigRootDir: __dirname,
},
};
export default defineConfigWithVueTs(
{
name: "global",
files: ["**/*.{ts,vue}", "**/.storybook/**"],
ignores: ["**/dist/**", "**/coverage/**", "**/storybook-static/**"],
languageOptions,
},
pluginVue.configs["flat/recommended"],
pluginStorybook.configs["flat/recommended"].map((item) => ({
...item,
...(item.name.includes("stories-rules") ? { files: ["**/stories.{js,ts}"] } : {}),
})),
vueTsConfigs.recommended,
prettierEslintConfig,
{
name: "common",
languageOptions,
files: ["**/*.{js,ts,vue}"],
rules: {
"no-console": process.env.PROD ? "error" : "warn",
"no-debugger": process.env.PROD ? "error" : "warn",
"@typescript-eslint/no-unused-vars": process.env.PROD ? "error" : "warn",
"@typescript-eslint/no-unused-expressions": ["error", { allowTernary: true, allowShortCircuit: true }],
"arrow-parens": ["error", "always"],
curly: ["error", "multi-line"],
"padding-line-between-statements": [
"error",
{ blankLine: "always", prev: ["const", "let", "var"], next: "*" },
{ blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"] },
{ blankLine: "always", prev: "directive", next: "*" },
{ blankLine: "any", prev: "directive", next: "directive" },
{ blankLine: "always", prev: "block-like", next: "*" },
{ blankLine: "always", prev: "*", next: "block-like" },
{ blankLine: "always", prev: "*", next: "return" },
],
"prettier/prettier": ["warn", { printWidth: 100 }],
"vue/max-len": ["error", { code: 120, template: 960, ignoreComments: true, ignoreUrls: true }],
"vue/max-attributes-per-line": ["error", { singleline: { max: 9 }, multiline: { max: 1 } }],
},
},
{
name: "vueless-component-config",
files: ["src/**/config.{js,ts}"],
rules: {
"vue/max-len": ["error", { code: 140 }],
"prettier/prettier": ["warn", { printWidth: 130 }],
},
},
{
name: "vitest",
files: ["src/**/tests/*"],
...pluginVitest.configs.recommended,
},
{
name: "eslint",
files: ["eslint.config.*"],
rules: {
"prettier/prettier": ["warn", { printWidth: 120 }],
},
},
);