Add linter for web folder
All checks were successful
Build and test project / build-and-test (push) Successful in 1m33s
All checks were successful
Build and test project / build-and-test (push) Successful in 1m33s
This commit is contained in:
4
test.sh
4
test.sh
@@ -39,6 +39,10 @@ fi
|
|||||||
echo "=== Installing web dependencies ==="
|
echo "=== Installing web dependencies ==="
|
||||||
cd "$SCRIPT_DIR/web" && npm install
|
cd "$SCRIPT_DIR/web" && npm install
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Linting ==="
|
||||||
|
cd "$SCRIPT_DIR/web" && npx eslint .
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "=== Building web app ==="
|
echo "=== Building web app ==="
|
||||||
cd "$SCRIPT_DIR/web" && node build.mjs
|
cd "$SCRIPT_DIR/web" && node build.mjs
|
||||||
|
|||||||
55
web/eslint.config.mjs
Normal file
55
web/eslint.config.mjs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
export default [
|
||||||
|
{
|
||||||
|
files: ['src/**/*.js'],
|
||||||
|
ignores: ['src/js/wasm_exec.js'],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2022,
|
||||||
|
sourceType: 'module',
|
||||||
|
globals: {
|
||||||
|
// Browser globals
|
||||||
|
window: 'readonly',
|
||||||
|
document: 'readonly',
|
||||||
|
console: 'readonly',
|
||||||
|
fetch: 'readonly',
|
||||||
|
URL: 'readonly',
|
||||||
|
Blob: 'readonly',
|
||||||
|
Uint8Array: 'readonly',
|
||||||
|
TextEncoder: 'readonly',
|
||||||
|
TextDecoder: 'readonly',
|
||||||
|
Event: 'readonly',
|
||||||
|
DOMException: 'readonly',
|
||||||
|
HTMLElement: 'readonly',
|
||||||
|
Worker: 'readonly',
|
||||||
|
requestAnimationFrame: 'readonly',
|
||||||
|
// JSZip loaded via script tag
|
||||||
|
JSZip: 'readonly',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
||||||
|
'no-undef': 'error',
|
||||||
|
'no-constant-condition': 'warn',
|
||||||
|
'eqeqeq': ['error', 'always'],
|
||||||
|
'no-var': 'error',
|
||||||
|
'prefer-const': 'warn',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Worker script uses importScripts, self, Go, globalThis, WebAssembly
|
||||||
|
files: ['src/js/patch-worker.js'],
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
self: 'readonly',
|
||||||
|
importScripts: 'readonly',
|
||||||
|
Go: 'readonly',
|
||||||
|
globalThis: 'readonly',
|
||||||
|
WebAssembly: 'readonly',
|
||||||
|
fetch: 'readonly',
|
||||||
|
console: 'readonly',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ignores: ['src/js/wasm_exec.js', 'dist/**', 'node_modules/**'],
|
||||||
|
},
|
||||||
|
];
|
||||||
1062
web/package-lock.json
generated
1062
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -3,10 +3,12 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node build.mjs",
|
"build": "node build.mjs",
|
||||||
"dev": "node build.mjs --dev"
|
"dev": "node build.mjs --dev",
|
||||||
|
"lint": "eslint ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"esbuild": "^0.27.4"
|
"esbuild": "^0.27.4",
|
||||||
|
"eslint": "^9.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jszip": "^3.10.1"
|
"jszip": "^3.10.1"
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import JSZip from 'jszip';
|
|||||||
|
|
||||||
// Check KOReader availability and mark the feature (best-effort, non-blocking).
|
// Check KOReader availability and mark the feature (best-effort, non-blocking).
|
||||||
const koreaderFeature = ALL_FEATURES.find(f => f.id === 'koreader');
|
const koreaderFeature = ALL_FEATURES.find(f => f.id === 'koreader');
|
||||||
const koreaderVersionReady = fetch('/koreader/release.json')
|
const koreaderVersionReady = fetch('/koreader/release.json') // eslint-disable-line no-unused-vars -- fire-and-forget; availability resolves before user reaches features step
|
||||||
.then(r => r.ok ? r.json() : null)
|
.then(r => r.ok ? r.json() : null)
|
||||||
.then(meta => {
|
.then(meta => {
|
||||||
if (meta && meta.version) {
|
if (meta && meta.version) {
|
||||||
@@ -148,7 +148,7 @@ import JSZip from 'jszip';
|
|||||||
|
|
||||||
// --- Step navigation ---
|
// --- Step navigation ---
|
||||||
|
|
||||||
let currentNavLabels = TL.NAV_DEFAULT;
|
let currentNavLabels = TL.NAV_DEFAULT; // eslint-disable-line no-unused-vars -- kept for debuggability; tracks which label set is active
|
||||||
|
|
||||||
const stepHistory = [stepConnect];
|
const stepHistory = [stepConnect];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user