forked from yamada-ui/yamada-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.ts
120 lines (110 loc) · 2.44 KB
/
eslint.config.ts
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
import { dirname, resolve } from "node:path"
import { fileURLToPath } from "node:url"
import pluginVitest from "@vitest/eslint-plugin"
import type { Linter } from "eslint"
import tseslint from "typescript-eslint"
import {
baseConfig,
importConfigArray,
languageOptionFactory,
reactConfig as sharedReactConfig,
reactHooksConfig as sharedReactHooksConfig,
testingLibraryConfig,
typescriptConfig,
vitestConfig,
} from "./.eslint"
const sharedFiles = [
"packages/**/*.ts",
"packages/**/*.tsx",
"packages/**/*.d.ts",
"stories/**/*.ts",
"stories/**/*.tsx",
"stories/**/*.d.ts",
]
const ignoresConfig: Linter.Config = {
name: "eslint/ignores",
ignores: [
"**/.next/**",
"**/.turbo/**",
"**/dist/**",
"**/node_modules/**",
"**/build/**",
"**/pnpm-lock.yaml",
"docs/**",
"examples/**",
"coverage/**",
"storybook-static/**",
".storybook/**",
"packages/cli/bin/**",
],
}
const noConsoleConfig: Linter.Config = {
name: "eslint/no-console",
files: [
"packages/cli/**/*.ts",
"scripts/**/*.ts",
"stories/**/*.tsx",
"stories/**/*.ts",
],
rules: {
"no-console": "off",
},
}
const testsConfig: Linter.Config = {
name: "eslint/tests",
files: [
"**/packages/**/test/**/*.ts",
"**/packages/**/test/**/*.tsx",
"**/packages/**/tests/**/*.ts",
"**/packages/**/tests/**/*.tsx",
],
rules: {
"no-restricted-imports": "off",
},
}
const reactConfig: Linter.Config = {
...sharedReactConfig,
files: sharedFiles,
ignores: ["packages/cli/**/*.ts"],
}
const reactHooksConfig: Linter.Config = {
...sharedReactHooksConfig,
files: [
"packages/**/*.ts",
"packages/**/*.tsx",
"packages/**/*.d.ts",
"stories/**/*.ts",
"stories/**/*.tsx",
"stories/**/*.d.ts",
],
ignores: ["packages/cli/**/*.ts"],
}
const vitestSetupTestsConfig: Linter.Config = {
name: "eslint/vitest/setup-tests",
files: ["scripts/setup-test.ts"],
plugins: {
vitest: pluginVitest,
},
rules: {
"vitest/prefer-spy-on": "off",
},
}
const tsConfigPath = resolve(
dirname(fileURLToPath(import.meta.url)),
"./tsconfig.json",
)
export const languageOptionConfig = languageOptionFactory(tsConfigPath)
export default tseslint.config(
ignoresConfig,
languageOptionConfig,
baseConfig,
noConsoleConfig,
testsConfig,
typescriptConfig,
...importConfigArray,
reactConfig,
reactHooksConfig,
vitestConfig,
vitestSetupTestsConfig,
testingLibraryConfig,
)