mirror of
https://github.com/ajurna/cbwebreader.git
synced 2026-11-02 10:36:55 +00:00
- Added Vitest configuration (`vitest.config.mjs`) for frontend unit testing with a `jsdom` environment. - Migrated and rewrote key frontend tests (`api.test.js`, `comiclist.test.js`, `comicreader.test.js`, `historytable.test.js`, `router.test.js`, `store.test.js`) to Vitest, improving maintainability. - Removed `tsconfig.json` and related TypeScript loaders from `webpack` configurations (`webpack.dev.js`, `webpack.prod.js`). - Adjusted `eslint.config.mjs` to support Vitest tests. - Updated `package-lock.json` to include Vitest, test utilities (`jsdom`, `@vue/test-utils`), and other associated packages. - Updated Nginx configuration for better compression on assets (`gzip` adjustments). - Enhanced `entrypoint.sh` to include first-run library indexing (`--if-empty` argument). - Simplified the `scan_comics` command with a dedicated test for empty database scans. This transition improves testing workflows and backend/frontend synergy while removing unused TypeScript dependencies.
61 lines
1.4 KiB
JavaScript
61 lines
1.4 KiB
JavaScript
import js from '@eslint/js'
|
|
import pluginVue from 'eslint-plugin-vue'
|
|
|
|
export default [
|
|
{ ignores: ['dist/**', 'node_modules/**', 'public/**'] },
|
|
js.configs.recommended,
|
|
...pluginVue.configs['flat/essential'],
|
|
|
|
// Build scripts (webpack.*.js) run in Node, so they use CommonJS globals.
|
|
{
|
|
files: ['**/*.js'],
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'commonjs',
|
|
globals: {
|
|
require: 'readonly',
|
|
module: 'readonly',
|
|
__dirname: 'readonly',
|
|
process: 'readonly',
|
|
console: 'readonly',
|
|
},
|
|
},
|
|
},
|
|
|
|
// Tests run under Vitest with a jsdom environment.
|
|
{
|
|
files: ['test/**'],
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'module',
|
|
globals: {
|
|
document: 'readonly',
|
|
localStorage: 'readonly',
|
|
console: 'readonly',
|
|
window: 'readonly',
|
|
HTMLElement: 'readonly',
|
|
KeyboardEvent: 'readonly',
|
|
},
|
|
},
|
|
},
|
|
|
|
// Application code is browser code bundled by webpack.
|
|
{
|
|
files: ['src/**'],
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'module',
|
|
globals: {
|
|
window: 'readonly',
|
|
document: 'readonly',
|
|
localStorage: 'readonly',
|
|
console: 'readonly',
|
|
setTimeout: 'readonly',
|
|
clearTimeout: 'readonly',
|
|
process: 'readonly',
|
|
},
|
|
},
|
|
rules: {},
|
|
},
|
|
]
|