fix(client): update ESLint to latest

This commit is contained in:
Elian Doran 2025-03-08 02:20:56 +02:00
parent 3c84d0558d
commit c4f8e9605f
No known key found for this signature in database
4 changed files with 19 additions and 26 deletions

View File

@ -44,29 +44,7 @@
} }
const errors = new eslint().verify(text, { const errors = new eslint().verify(text, {
root: true,
parserOptions: {
ecmaVersion: "2019"
},
extends: ['eslint:recommended', 'airbnb-base'],
env: {
'browser': true,
'node': true
},
rules: {
'import/no-unresolved': 'off',
'func-names': 'off',
'comma-dangle': ['warn'],
'padded-blocks': 'off',
'linebreak-style': 'off',
'class-methods-use-this': 'off',
'no-unused-vars': ['warn', { vars: 'local', args: 'after-used' }],
'no-nested-ternary': 'off',
'no-underscore-dangle': ['error', {'allow': ['_super', '_lookupFactory']}]
},
globals: {
"api": "readonly"
}
}); });
console.log(errors); console.log(errors);

7
package-lock.json generated
View File

@ -44,6 +44,7 @@
"electron-squirrel-startup": "1.0.1", "electron-squirrel-startup": "1.0.1",
"electron-window-state": "5.0.3", "electron-window-state": "5.0.3",
"escape-html": "1.0.3", "escape-html": "1.0.3",
"eslint-linter-browserify": "9.21.0",
"express": "4.21.2", "express": "4.21.2",
"express-rate-limit": "7.5.0", "express-rate-limit": "7.5.0",
"express-session": "1.18.1", "express-session": "1.18.1",
@ -10117,6 +10118,12 @@
} }
} }
}, },
"node_modules/eslint-linter-browserify": {
"version": "9.21.0",
"resolved": "https://registry.npmjs.org/eslint-linter-browserify/-/eslint-linter-browserify-9.21.0.tgz",
"integrity": "sha512-6/VTsxcyzWkqAOZJdZluk68SZsdm3UaMrImyJzuixIDK9ZxItdGwHU1Ti8XVYgMGyEOdLgTK3csZDBk4oUPefg==",
"license": "MIT"
},
"node_modules/eslint-scope": { "node_modules/eslint-scope": {
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",

View File

@ -100,6 +100,7 @@
"electron-squirrel-startup": "1.0.1", "electron-squirrel-startup": "1.0.1",
"electron-window-state": "5.0.3", "electron-window-state": "5.0.3",
"escape-html": "1.0.3", "escape-html": "1.0.3",
"eslint-linter-browserify": "9.21.0",
"express": "4.21.2", "express": "4.21.2",
"express-rate-limit": "7.5.0", "express-rate-limit": "7.5.0",
"express-session": "1.18.1", "express-session": "1.18.1",

View File

@ -43,7 +43,10 @@ const CODE_MIRROR: Library = {
}; };
const ESLINT: Library = { const ESLINT: Library = {
js: ["libraries/eslint/eslint.js"] js: async () => {
(window as any).eslint = (await import("eslint-linter-browserify")).Linter;
return [];
}
}; };
const RELATION_MAP: Library = { const RELATION_MAP: Library = {
@ -108,13 +111,17 @@ async function requireLibrary(library: Library) {
} }
if (library.js) { if (library.js) {
for (const scriptUrl of unwrapValue(library.js)) { for (const scriptUrl of await unwrapValue(library.js)) {
await requireScript(scriptUrl); await requireScript(scriptUrl);
} }
} }
} }
function unwrapValue<T>(value: T | (() => T)) { async function unwrapValue<T>(value: T | (() => T) | Promise<(() => T)>) {
if (value && typeof value === "object" && "then" in value) {
return (await (value as Promise<() => T>))();
}
if (typeof value === "function") { if (typeof value === "function") {
return (value as () => T)(); return (value as () => T)();
} }