feat(eslint): downgrade unused variables to warning

This commit is contained in:
Elian Doran 2025-03-08 03:02:25 +02:00
parent 3756524ad3
commit 7ade401018
No known key found for this signature in database
2 changed files with 23 additions and 2 deletions

View File

@ -26,4 +26,23 @@ describe("Linter", () => {
`); `);
expect(result.length).toBe(0); 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
}
]);
});
}); });

View File

@ -14,9 +14,11 @@ export async function lint(code: string) {
globals: { globals: {
...globals.browser, ...globals.browser,
api: "readonly" api: "readonly"
}
}, },
rules: { } },
rules: {
"no-unused-vars": [ "warn", { vars: "local", args: "after-used" }]
}
} }
]); ]);