feat(web): add eslint + prettier + vitest toolchain + web CI job (R8)
Added to web/package.json devDeps: eslint (9, flat config) + eslint-plugin-svelte + typescript-eslint + globals; prettier + prettier-plugin-svelte; vitest (jsdom env) + jsdom. New scripts: lint, lint:fix, format, format:check, test, test:watch. Configs: - web/eslint.config.js — flat config, TS + Svelte, browser/node globals, no-explicit-any as warn, unused-vars as error (ignores _-prefixed). - web/.prettierrc.json — single-quote, 100 width, svelte parser override. - web/.prettierignore — dist/node_modules/build/lockfiles. - web/vite.config.ts — vitest test block via reference directive, jsdom env, globals enabled. Sample test: web/src/lib/utils.test.ts (6 tests covering relativeTime, truncateMiddle, debounce — all passing). CI: new web job in .gitea/workflows/ci.yml (npm ci, check [advisory], lint [advisory], format:check [advisory], test [gate], build [gate]). Advisory steps use continue-on-error until the baseline is clean — matching the existing golangci-lint advisory pattern. Known baseline surfaced by the new toolchain (pre-existing, not caused by R8): svelte-check 154 errors (133-file config cascade), eslint 126 errors + 12 warnings (unused vars, @html XSS, unused CSS), prettier 175 unformatted files. Fixing these is a follow-up cleanup. VERSION 0.7.9 -> 0.7.10. Plan R8 marked done; C.1 updated.
This commit is contained in:
39
web/eslint.config.js
Normal file
39
web/eslint.config.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import js from '@eslint/js'
|
||||
import ts from 'typescript-eslint'
|
||||
import svelte from 'eslint-plugin-svelte'
|
||||
import globals from 'globals'
|
||||
|
||||
export default ts.config(
|
||||
js.configs.recommended,
|
||||
...ts.configs.recommended,
|
||||
...svelte.configs['flat/recommended'],
|
||||
{
|
||||
files: ['**/*.{ts,js,svelte}'],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.svelte'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
parser: ts.parser
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
ignores: ['dist/', 'node_modules/', 'build/', '*.config.{ts,js}']
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'warn',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' }
|
||||
]
|
||||
}
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user