-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
147 lines (145 loc) · 5 KB
/
Copy pathvite.config.ts
File metadata and controls
147 lines (145 loc) · 5 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
import { fileURLToPath } from "node:url";
import { defineConfig } from "vite-plus";
export default defineConfig({
resolve: {
alias: {
"#shared": fileURLToPath(new URL("src/shared", import.meta.url)),
"#mocks": fileURLToPath(new URL("e2e/mocks", import.meta.url)),
"#helpers": fileURLToPath(new URL("e2e/helpers", import.meta.url)),
},
},
lint: {
options: { typeAware: true, typeCheck: true },
categories: {
correctness: "error",
nursery: "error",
pedantic: "error",
perf: "error",
restriction: "error",
style: "error",
suspicious: "error",
},
env: { browser: true },
globals: { chrome: "readonly" },
ignorePatterns: ["**/fixtures/**"],
plugins: ["eslint", "typescript", "unicorn", "oxc", "promise", "import"],
overrides: [
{
files: ["build.ts", "scripts/**/*.ts"],
env: { browser: false, node: true },
globals: { chrome: "off" },
rules: {
"import/no-nodejs-modules": "off",
},
},
{
files: ["e2e/**/*.ts"],
env: { browser: true, node: true },
rules: {
"import/no-nodejs-modules": "off",
// Off because tsgolint's `allow` matcher does not honor any form for Playwright types (declared in playwright-core, re-exported via `export *`); disabling here beats carrying broken allow entries.
"typescript/prefer-readonly-parameter-types": "off",
},
},
{
files: ["**/*.test.ts"],
rules: {
"import/no-nodejs-modules": "off",
},
},
{
files: ["vite.config.ts", "knip.config.ts"],
env: { browser: false, node: true },
globals: { chrome: "off" },
rules: {
"import/no-default-export": "off",
"import/no-nodejs-modules": "off",
},
},
],
rules: {
"func-style": ["error", "declaration"],
"id-length": ["error", { exceptions: ["T", "i", "j", "x", "y", "_"] }],
"import/consistent-type-specifier-style": ["error", "prefer-inline"],
"typescript/no-import-type-side-effects": "off",
"import/exports-last": "off",
"import/group-exports": "off",
"import/max-dependencies": ["error", { max: 20 }],
"import/no-named-export": "off",
"import/prefer-default-export": "off",
"init-declarations": "off",
"max-lines-per-function": ["error", { max: 250 }],
"max-statements": ["error", { max: 60 }],
"no-await-in-loop": "off",
"no-console": "off",
"no-continue": "off",
"no-inline-comments": "off",
"no-magic-numbers": "off",
"no-ternary": "off",
"no-undefined": "off",
"oxc/no-async-await": "off",
"oxc/no-optional-chaining": "off",
"oxc/no-rest-spread-properties": "off",
"promise/catch-or-return": "off",
"promise/prefer-await-to-then": "off",
"require-await": "off",
"sort-imports": "off",
"sort-keys": "off",
"typescript/no-unnecessary-condition": "off",
"typescript/prefer-readonly-parameter-types": [
"error",
{
allow: [
{ from: "lib", name: "Element" },
{ from: "lib", name: "HTMLElement" },
{ from: "lib", name: "HTMLButtonElement" },
{ from: "lib", name: "HTMLInputElement" },
{ from: "lib", name: "HTMLTextAreaElement" },
{ from: "lib", name: "HTMLImageElement" },
{ from: "lib", name: "HTMLAnchorElement" },
{ from: "lib", name: "HTMLDivElement" },
{ from: "lib", name: "HTMLProgressElement" },
{ from: "lib", name: "HTMLSpanElement" },
{ from: "lib", name: "File" },
{ from: "lib", name: "Blob" },
{ from: "lib", name: "MediaSource" },
{ from: "lib", name: "MessageEvent" },
{ from: "lib", name: "KeyboardEvent" },
{ from: "lib", name: "MouseEvent" },
{ from: "lib", name: "Event" },
{ from: "lib", name: "PointerEvent" },
{ from: "lib", name: "Promise" },
{ from: "lib", name: "RegExp" },
{ from: "lib", name: "Document" },
{ from: "lib", name: "Node" },
{ from: "lib", name: "MutationObserver" },
{ from: "lib", name: "Date" },
{ from: "lib", name: "Uint8Array" },
{ from: "lib", name: "Record" },
{ from: "package", name: "MessageSender", package: "@types/chrome" },
],
ignoreInferredTypes: true,
treatMethodsAsReadonly: true,
},
],
"typescript/promise-function-async": "off",
"typescript/require-await": "off",
"typescript/strict-void-return": "off",
},
},
fmt: {
sortImports: {},
},
staged: {
"*": "vp check --fix",
},
test: {
include: ["src/**/*.test.ts"],
environment: "happy-dom",
coverage: {
provider: "v8",
reporter: ["lcov"],
exclude: ["**/*.test.ts", "e2e/**", "dist/**", "scripts/**", "build.ts"],
},
},
});