2025-03-08 02:37:29 +02:00
|
|
|
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:37:29 +02:00
|
|
|
|
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 03:02:25 +02:00
|
|
|
},
|
2025-03-08 02:45:40 +02:00
|
|
|
},
|
2025-03-08 03:02:25 +02:00
|
|
|
rules: {
|
|
|
|
"no-unused-vars": [ "warn", { vars: "local", args: "after-used" }]
|
|
|
|
}
|
2025-03-08 02:45:40 +02:00
|
|
|
}
|
|
|
|
]);
|
2025-03-08 02:37:29 +02:00
|
|
|
|
|
|
|
}
|