chore: add JS/ESLint toolchain, refactor onclick to event delegation
- Add ESLint config for web/ui (flat config, golangci-lint-compatible) - Add js-lint task to mise.toml (npm run lint in web/ui) - Add ESLint check to check-toolchain.sh - Add .golangci.yml for golangci-lint v2 with correct exclusions - Refactor app.js: replace inline onclick with data-action + event delegation - Add null checks and HTTP status checks to browseWavs - Add web/ui/node_modules/ to .gitignore
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
const globals = require('globals');
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
files: ['**/*.js'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2022,
|
||||
sourceType: 'script',
|
||||
globals: {
|
||||
...globals.browser,
|
||||
AudioContext: 'readonly',
|
||||
requestAnimationFrame: 'readonly',
|
||||
cancelAnimationFrame: 'readonly',
|
||||
fetch: 'readonly',
|
||||
EventSource: 'readonly',
|
||||
document: 'readonly',
|
||||
console: 'readonly',
|
||||
setTimeout: 'readonly',
|
||||
Math: 'readonly',
|
||||
JSON: 'readonly',
|
||||
location: 'readonly',
|
||||
encodeURIComponent: 'readonly',
|
||||
decodeURIComponent: 'readonly',
|
||||
parseInt: 'readonly',
|
||||
Number: 'readonly',
|
||||
Promise: 'readonly',
|
||||
Object: 'readonly',
|
||||
Array: 'readonly',
|
||||
Map: 'readonly',
|
||||
process: 'readonly',
|
||||
__dirname: 'readonly',
|
||||
require: 'readonly',
|
||||
module: 'readonly',
|
||||
exports: 'readonly'
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
"no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
|
||||
"no-redeclare": "warn",
|
||||
"no-unreachable": "warn",
|
||||
"eqeqeq": ["error", "always"],
|
||||
"prefer-const": "warn"
|
||||
}
|
||||
}
|
||||
];
|
||||
Reference in New Issue
Block a user