26 lines
685 B
TypeScript
Raw Normal View History

export async function lint(code: string) {
const Linter = (await import("eslint-linter-browserify")).Linter;
2025-03-08 02:45:40 +02:00
const js = (await import("@eslint/js"));
const globals = (await import("globals"));
2025-03-08 02:45:40 +02:00
return new Linter().verify(code, [
js.configs.recommended,
{
languageOptions: {
parserOptions: {
ecmaVersion: 2024
},
globals: {
...globals.browser,
api: "readonly"
},
2025-03-08 02:45:40 +02:00
},
rules: {
"no-unused-vars": [ "warn", { vars: "local", args: "after-used" }]
}
2025-03-08 02:45:40 +02:00
}
]);
}