mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-25 06:01:40 +08:00
feat(eslint): downgrade unused variables to warning
This commit is contained in:
parent
3756524ad3
commit
7ade401018
@ -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
|
||||
}
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
@ -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" }]
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user