Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(client): add recommended rules
Elian Doran79adb0b20e2e
diff --git a/package-lock.json b/package-lock.jsonindex dbb671f4f9..0ee0454d62 100644--- a/package-lock.json+++ b/package-lock.json@@ -166,6 +166,7 @@"electron": "34.3.1","eslint": "9.21.0","esm": "3.2.25",+ "globals": "16.0.0","happy-dom": "17.3.0","i18next-http-backend": "3.0.2","jsdoc": "4.0.4",@@ -2242,6 +2243,19 @@"url": "https://github.com/sponsors/epoberezkin"}},+ "node_modules/@eslint/eslintrc/node_modules/globals": {+ "version": "14.0.0",+ "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",+ "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": {"version": "0.4.1","resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",@@ -11605,9 +11619,9 @@}},"node_modules/globals": {- "version": "14.0.0",- "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",- "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",+ "version": "16.0.0",+ "resolved": "https://registry.npmjs.org/globals/-/globals-16.0.0.tgz",+ "integrity": "sha512-iInW14XItCXET01CQFqudPOWP2jYMl7T+QRQT+UNcR/iQncN/F0UNpgd76iFkBPgNQb4+X3LV9tLJYzwh+Gl3A==","dev": true,"license": "MIT","engines": {diff --git a/package.json b/package.jsonindex 6677989f01..6e4b29d38e 100644--- a/package.json+++ b/package.json@@ -219,6 +219,7 @@"electron": "34.3.1","eslint": "9.21.0","esm": "3.2.25",+ "globals": "16.0.0","happy-dom": "17.3.0","i18next-http-backend": "3.0.2","jsdoc": "4.0.4",diff --git a/src/public/app/services/eslint.ts b/src/public/app/services/eslint.tsindex 43abd8adab..c8b035a58e 100644--- a/src/public/app/services/eslint.ts+++ b/src/public/app/services/eslint.ts@@ -1,9 +1,23 @@export async function lint(code: string) {const Linter = (await import("eslint-linter-browserify")).Linter;+ const js = (await import("@eslint/js"));+ const globals = (await import("globals"));- return new Linter().verify(code, {-- });+ return new Linter().verify(code, [+ js.configs.recommended,+ {+ languageOptions: {+ parserOptions: {+ ecmaVersion: 2024+ },+ globals: {+ ...globals.browser,+ api: "readonly"+ }+ },+ rules: { }+ }+ ]);}