-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
140 lines (138 loc) · 2.96 KB
/
Copy pathvite.config.ts
File metadata and controls
140 lines (138 loc) · 2.96 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
import { paraglideVitePlugin } from '@inlang/paraglide-js'
import react from '@vitejs/plugin-react'
import assert from 'node:assert'
import { defineConfig } from 'vite-plus'
const outDir = process.env['WEBAPP_OUT_DIR']
const base = process.env['WEBAPP_BASE_URL']
assert(outDir, 'WEBAPP_OUT_DIR env var is not set')
assert(base, 'WEBAPP_BASE_URL env var is not set')
export default defineConfig({
fmt: {
useTabs: true,
tabWidth: 2,
semi: false,
singleQuote: true,
trailingComma: 'all',
sortImports: {
internalPattern: ['#'],
partitionByComment: true,
groups: [
'side_effect',
'side_effect_style',
'type',
['builtin', 'external'],
['internal', 'subpath'],
['parent', 'sibling', 'index'],
'style',
'unknown',
],
},
sortPackageJson: { sortScripts: true },
ignorePatterns: ['public/mockServiceWorker.js'],
},
lint: {
ignorePatterns: ['scripts/steiger/**'],
plugins: ['import', 'react'],
categories: {
correctness: 'error',
suspicious: 'warn',
pedantic: 'off',
perf: 'warn',
style: 'off',
restriction: 'off',
nursery: 'off',
},
rules: {
'import/no-cycle': 'error',
'eslint/no-restricted-imports': [
'error',
{
paths: [
{
name: 'react',
importNames: [
'useEffect',
'useLayoutEffect',
'useMemo',
'useCallback',
'useState',
'useRef',
'useContext',
'useReducer',
'useImperativeHandle',
'useDebugValue',
'memo',
],
message: 'Find appropriate solution with reatom or ask user for guidance.',
},
],
},
],
'react/react-in-jsx-scope': 'off',
'import/no-unassigned-import': 'off',
'eslint/no-await-in-loop': 'off',
'eslint/no-underscore-dangle': 'off',
'vite-plus/prefer-vite-plus-imports': 'error',
},
overrides: [
{
files: ['**/shared/components/ui/**'],
rules: {
'eslint/no-shadow': 'off',
},
},
],
options: {
typeAware: true,
typeCheck: true,
},
jsPlugins: [
{
name: 'vite-plus',
specifier: 'vite-plus/oxlint-plugin',
},
],
},
build: {
outDir,
rolldownOptions: {
output: {
codeSplitting: {
groups: [
{
name: 'react-vendor',
test: /node_modules[\\/](react|react-dom)([\\/]|$)/,
priority: 30,
},
{
name: 'vendor-msw',
test: /node_modules[\\/](msw|@mswjs|@open-draft|headers-polyfill|is-node-process|outvariant|strict-event-emitter)([\\/]|$)/,
priority: 20,
},
{
name: 'ui-vendor',
test: /node_modules[\\/](@ark|@ui|@zag-js)/,
priority: 15,
},
{
name: 'vendor',
test: /node_modules/,
priority: 10,
},
{
name: 'common',
minShareCount: 2,
minSize: 10000,
priority: 5,
},
],
},
},
},
},
plugins: [
react(),
paraglideVitePlugin({ project: './project.inlang', outdir: './src/paraglide' }),
],
base,
} as never)