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:
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/**'],
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user