mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +02:00
fix(client): update ESLint to latest
This commit is contained in:
parent
3c84d0558d
commit
c4f8e9605f
24
libraries/codemirror/eslint.js
vendored
24
libraries/codemirror/eslint.js
vendored
@ -44,29 +44,7 @@
|
||||
}
|
||||
|
||||
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);
|
||||
|
7
package-lock.json
generated
7
package-lock.json
generated
@ -44,6 +44,7 @@
|
||||
"electron-squirrel-startup": "1.0.1",
|
||||
"electron-window-state": "5.0.3",
|
||||
"escape-html": "1.0.3",
|
||||
"eslint-linter-browserify": "9.21.0",
|
||||
"express": "4.21.2",
|
||||
"express-rate-limit": "7.5.0",
|
||||
"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": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
||||
|
@ -100,6 +100,7 @@
|
||||
"electron-squirrel-startup": "1.0.1",
|
||||
"electron-window-state": "5.0.3",
|
||||
"escape-html": "1.0.3",
|
||||
"eslint-linter-browserify": "9.21.0",
|
||||
"express": "4.21.2",
|
||||
"express-rate-limit": "7.5.0",
|
||||
"express-session": "1.18.1",
|
||||
|
@ -43,7 +43,10 @@ const CODE_MIRROR: 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 = {
|
||||
@ -108,13 +111,17 @@ async function requireLibrary(library: Library) {
|
||||
}
|
||||
|
||||
if (library.js) {
|
||||
for (const scriptUrl of unwrapValue(library.js)) {
|
||||
for (const scriptUrl of await unwrapValue(library.js)) {
|
||||
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") {
|
||||
return (value as () => T)();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user