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(eslint): downgrade unused variables to warning
Elian Doran7ade4010185a
diff --git a/src/public/app/services/eslint.spec.ts b/src/public/app/services/eslint.spec.tsindex 7070e8a698..cc21746bdc 100644--- a/src/public/app/services/eslint.spec.ts+++ b/src/public/app/services/eslint.spec.ts@@ -26,4 +26,23 @@ describe("Linter", () => {`);expect(result.length).toBe(0);});++ it("reports unused functions as warnings", async () => {+ const result = await lint(trimIndentation`+ function hello() { }+ function world() { }++ console.log("Hello world");+ `);+ expect(result).toMatchObject([+ {+ message: "'hello' is defined but never used.",+ severity: 1+ },+ {+ message: "'world' is defined but never used.",+ severity: 1+ }+ ]);+ });});diff --git a/src/public/app/services/eslint.ts b/src/public/app/services/eslint.tsindex c8b035a58e..33949b116f 100644--- a/src/public/app/services/eslint.ts+++ b/src/public/app/services/eslint.ts@@ -14,9 +14,11 @@ export async function lint(code: string) {globals: {...globals.browser,api: "readonly"- }+ },},- rules: { }+ rules: {+ "no-unused-vars": [ "warn", { vars: "local", args: "after-used" }]+ }}]);