Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
125 lines (124 loc) · 5.41 KB
/
Copy pathvite.config.ts
File metadata and controls
125 lines (124 loc) · 5.41 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
import { recommended } from '@effect/tsgo/oxlint-presets';
import { defineConfig } from 'vite-plus';
// Workspace-root toolchain configuration.
//
// Oxlint and Oxfmt are configured here and only here. `vp lint`, `vp fmt`, and
// `vp check` read the root `lint` and `fmt` blocks even when invoked from a
// package directory, and Oxlint/Oxfmt ignore nested configs in Vite+ mode, so a
// package cannot drift from this file. Package-level `vite.config.ts` files
// are for per-package concerns only (currently just `pack`); anything a second
// package would also need belongs here, as a `lint.overrides` or `fmt.overrides`
// entry keyed on workspace globs such as `packages/<name>/**`.
export default defineConfig({
fmt: {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: true,
htmlWhitespaceSensitivity: 'css',
importOrderCaseSensitive: false,
jsdoc: {
capitalizeDescriptions: true,
commentLineStrategy: 'multiline',
descriptionTag: true,
descriptionWithDot: true,
keepUnparsableExampleIndent: false,
preferCodeFences: true,
separateReturnsFromParam: true,
separateTagGroups: true,
},
jsxSingleQuote: true,
objectWrap: 'collapse',
printWidth: 150,
quoteProps: 'as-needed',
semi: true,
singleQuote: true,
sortImports: {
groups: [
'side_effect_style',
'side_effect',
'type-import',
['value-builtin', 'value-external'],
'type-internal',
'value-internal',
['type-parent', 'type-sibling', 'type-index'],
['value-parent', 'value-sibling', 'value-index'],
'unknown',
],
newlinesBetween: true,
sortSideEffects: true,
},
sortPackageJson: { sortScripts: true },
tabWidth: 2,
trailingComma: 'es5',
},
lint: {
categories: { correctness: 'error' },
env: { browser: true, builtin: true, node: true, vitest: true },
extends: [recommended],
ignorePatterns: ['**/dist', '**/node_modules', '**/coverage'],
jsPlugins: [{ name: 'vite-plus', specifier: 'vite-plus/oxlint-plugin' }],
options: { reportUnusedDisableDirectives: 'warn', typeAware: true },
overrides: [
{ files: ['vite.config.ts'], rules: { 'sort-keys': ['error', 'asc', { minKeys: 5, natural: true, caseSensitive: true }] } },
{ files: ['scripts/**/*.{mjs,js,ts,mts}'], rules: { 'effecttsgo/node-builtin-import': 'off' } },
{ files: ['**/*.bench.ts'], rules: { 'vitest/expect-expect': 'off' } },
],
plugins: ['oxc', 'typescript', 'unicorn', 'import', 'vitest', 'node', 'promise'],
rules: {
'arrow-body-style': ['error', 'as-needed', { requireReturnForObjectLiteral: false }],
'effecttsgo/any-unknown-in-error-context': 'warn',
'effecttsgo/async-function': 'off',
'effecttsgo/catch-to-or-else-succeed': 'warn',
'effecttsgo/crypto-random-uuid': 'off',
'effecttsgo/crypto-random-uuid-in-effect': 'warn',
'effecttsgo/extends-native-error': 'warn',
'effecttsgo/global-console': 'off',
'effecttsgo/global-console-in-effect': 'warn',
'effecttsgo/global-date': 'off',
'effecttsgo/global-date-in-effect': 'warn',
'effecttsgo/global-fetch': 'off',
'effecttsgo/global-fetch-in-effect': 'warn',
'effecttsgo/global-random': 'off',
'effecttsgo/global-random-in-effect': 'warn',
'effecttsgo/global-timers': 'off',
'effecttsgo/global-timers-in-effect': 'warn',
'effecttsgo/instance-of-schema': 'off',
'effecttsgo/leaking-requirements': 'error',
'effecttsgo/new-promise': 'off',
'effecttsgo/node-builtin-import': 'warn',
'effecttsgo/prefer-schema-over-json': 'warn',
'effecttsgo/process-env': 'off',
'effecttsgo/process-env-in-effect': 'warn',
'effecttsgo/redundant-schema-tag-identifier': 'allow', // NOTE: this rule is allowed for now to reduce noise
'effecttsgo/unnecessary-fail-yieldable-error': 'warn',
'effecttsgo/unsafe-effect-type-assertion': 'warn',
'import/consistent-type-specifier-style': 'error',
'import/newline-after-import': 'warn',
'import/no-relative-parent-imports': 'error',
'import/unambiguous': 'warn',
'typescript/adjacent-overload-signatures': 'error',
'typescript/array-type': ['error', { default: 'generic', readonly: 'generic' }],
'typescript/consistent-type-exports': 'error',
'typescript/consistent-type-imports': ['error', { fixStyle: 'separate-type-imports', disallowTypeAnnotations: false }],
'typescript/no-explicit-any': 'error',
'typescript/no-misused-spread': 'off',
'typescript/no-unnecessary-boolean-literal-compare': 'warn',
'typescript/no-unnecessary-type-arguments': 'warn',
'typescript/no-unnecessary-type-constraint': 'warn',
'typescript/no-unnecessary-type-conversion': 'warn',
'typescript/prefer-nullish-coalescing': 'off',
'typescript/restrict-template-expressions': ['warn', { allowNever: true }],
'vite-plus/prefer-vite-plus-imports': 'error',
'vitest/no-conditional-expect': 'off',
'vitest/no-standalone-expect': 'off',
'vitest/require-to-throw-message': 'off',
yoda: 'warn',
},
},
run: { cache: { scripts: true } },
staged: {
'*': 'vp check --fix',
'*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx}': ["sh -c 'exec fallow --changed-since HEAD --type-aware --fail-on-issues'"],
},
test: { coverage: { exclude: ['**/test/**'] }, fsModuleCache: true, isolate: false },
});