webui: add ESLint and eslint-typescript
I've historically found this stuff worthwhile, so let's swallow the pill.
Fortunately, sketch was happy to oblige.
- Install ESLint, @eslint/js, and typescript-eslint packages
- Configure eslint.config.mjs with recommended TypeScript ESLint rules
- Add browser globals support for DOM and web APIs
- Integrate ESLint into npm test workflow via package.json scripts
- Update Makefile to run lint checks as part of test suite
- Fix 249+ linting issues including:
* Remove unused imports and variables (with _ prefix convention)
* Fix case declaration issues with eslint-disable blocks
* Remove unnecessary escape characters
* Address prefer-const violations
* Handle unused function parameters appropriately
- Configure ignore patterns to exclude dist/ and node_modules/
- Set rules to allow explicit 'any' types temporarily
- Convert warnings for ts-ignore, async promise executors, and unsafe optional chaining
Results:
- ESLint now runs successfully with 0 errors and only 6 warnings
- TypeScript compilation continues to work correctly
- Linting integrated into test workflow for continuous quality enforcement
- Codebase follows consistent ESLint TypeScript recommended practices
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: sd7b538be0a28d294k
diff --git a/webui/package.json b/webui/package.json
index 6454fb8..7ec0192 100644
--- a/webui/package.json
+++ b/webui/package.json
@@ -23,7 +23,9 @@
"build": "go run ../cmd/go2ts -o src/types.ts && tsc",
"watch": "tsc --watch",
"tailwind": "tailwindcss -i ./src/global.css -o ./dist/tailwind.css",
- "test": "tsc && tailwindcss -i ./src/global.css -o ./dist/tailwind.css && npm run test:playwright",
+ "lint": "eslint .",
+ "lint:fix": "eslint . --fix",
+ "test": "tsc && tailwindcss -i ./src/global.css -o ./dist/tailwind.css && npm run lint && npm run test:playwright",
"test:playwright": "playwright test -c playwright-ct.config.ts"
},
"dependencies": {
@@ -42,6 +44,7 @@
"tailwindcss": "^4.1.10"
},
"devDependencies": {
+ "@eslint/js": "^9.30.0",
"@sand4rt/experimental-ct-web": "^1.51.1",
"@types/marked": "^5.0.2",
"@types/mocha": "^10.0.7",
@@ -50,9 +53,11 @@
"@web/test-runner-puppeteer": "^0.18.0",
"autoprefixer": "^10.4.21",
"esbuild": "^0.25.1",
+ "eslint": "^9.30.0",
"msw": "^2.7.5",
"prettier": "3.5.3",
"typescript": "^5.8.3",
+ "typescript-eslint": "^8.35.1",
"vite": "^6.3.4",
"vite-plugin-web-components-hmr": "^0.1.3"
},