-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathvite.config.ts
More file actions
89 lines (87 loc) · 2.51 KB
/
Copy pathvite.config.ts
File metadata and controls
89 lines (87 loc) · 2.51 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
import type {OxlintConfig} from 'oxlint';
import {defineConfig} from 'vite-plus';
import javascript from '@ver0/oxlint-config/javascript.js';
import typescript from '@ver0/oxlint-config/typescript.js';
import react from '@ver0/oxlint-config/react.js';
import browser from '@ver0/oxlint-config/browser.js';
import vitest from '@ver0/oxlint-config/vitest.js';
// Composed via extends after the presets so these overrides apply last.
const repoOverrides: OxlintConfig = {
rules: {
// Hook parameters are inherently mutable platform types
// (DOM elements, React refs, dependency lists).
'typescript/prefer-readonly-parameter-types': 'off',
// Single-use type parameters in exported hooks are public API --
// removing one changes the generic arity and breaks explicit callers.
'typescript/no-unnecessary-type-parameters': 'off',
},
overrides: [
{
files: ['**/*.test.ts'],
plugins: ['vitest'],
rules: {
// Tests are uniformly async for renderHook symmetry.
'typescript/require-await': 'off',
'typescript/strict-void-return': 'off',
'typescript/unbound-method': 'off',
'vitest/no-conditional-in-test': 'off',
'vitest/require-mock-type-parameters': 'off',
'vitest/expect-expect': [
'error',
{
assertFunctionNames: ['expect', 'expectResultValue'],
},
],
},
},
],
};
export default defineConfig({
test: {
dir: './src',
setupFiles: ['./src/util/testing/setup/react-hooks.test.ts', './src/util/testing/setup/vibrate.test.ts'],
passWithNoTests: true,
// Node >= 25 ships Web Storage globals; without --localstorage-file
// they are non-functional stubs that shadow jsdom's storage in workers.
execArgv: ['--no-experimental-webstorage'],
projects: [
{
extends: true,
test: {
name: 'DOM',
include: ['**/*.dom.test.ts'],
environment: 'jsdom',
},
},
{
extends: true,
test: {
name: 'SSR',
include: ['**/*.ssr.test.ts'],
environment: 'node',
},
},
],
},
lint: {
options: {typeCheck: true},
extends: [javascript, typescript, react, browser, vitest, repoOverrides],
ignorePatterns: ['.claude', '.idea', 'dist', 'coverage', 'CHANGELOG.md'],
},
fmt: {
useTabs: true,
tabWidth: 2,
printWidth: 120,
endOfLine: 'lf',
trailingComma: 'all',
semi: true,
singleQuote: true,
bracketSameLine: true,
bracketSpacing: false,
jsxBracketSameLine: false,
jsxSingleQuote: true,
arrowParens: 'always',
proseWrap: 'always',
ignorePatterns: ['.claude', '.idea', 'dist', 'coverage', 'CHANGELOG.md'],
},
});