`npm run lint` fails on main, and has since CI was added, so every pull
request opened against it starts red for a reason that has nothing to do
with the change in it. Two unrelated PRs came back with the same failure,
which is how it was found.
vite.config.ts
1:1 error Do not use a triple slash reference for vitest/config,
use `import` style instead
The reference was doing one job: putting the `test` key in scope for
defineConfig. Importing defineConfig from vitest/config rather than vite
does the same job in the style the rule asks for, and the file already
imported configDefaults from there on the next line.
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
// defineConfig comes from vitest/config rather than vite, which is what puts
|
|
// the `test` key below in scope. It replaces a triple-slash reference that did
|
|
// the same job and that eslint rejects.
|
|
import { configDefaults, defineConfig } from 'vitest/config'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import path from 'path'
|
|
import { version } from './package.json' with { type: 'json' }
|
|
// INBUXA's own dated version lives apart from package.json, whose version
|
|
// follows upstream WebUI so its bumps merge without conflicts.
|
|
import inbuxa from './inbuxa-version.json' with { type: 'json' }
|
|
import { sourceArchive, sourceIdentity } from './source-archive'
|
|
|
|
const source = sourceIdentity(import.meta.dirname)
|
|
|
|
export default defineConfig({
|
|
base: './',
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(`${inbuxa.version} (base ${version})`),
|
|
// The tree this build came from; source.tar.gz next to the app holds it.
|
|
__SOURCE_ID__: JSON.stringify(source.id),
|
|
},
|
|
plugins: [react(), tailwindcss(), sourceArchive(import.meta.dirname, 'inbuxa-admin', source)],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(import.meta.dirname, './src'),
|
|
},
|
|
},
|
|
test: {
|
|
globals: false,
|
|
environment: 'happy-dom',
|
|
exclude: [...configDefaults.exclude, '**/.ignore/**'],
|
|
},
|
|
})
|