From be6e56fbe8905df657d1422e84ce43e36b760a16 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 9 Mar 2025 21:41:13 +0200 Subject: [PATCH] feat(eslint): add support for module.exports --- src/public/app/services/eslint.spec.ts | 5 +++++ src/public/app/services/eslint.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/public/app/services/eslint.spec.ts b/src/public/app/services/eslint.spec.ts index 74e6edabd..1dc271d89 100644 --- a/src/public/app/services/eslint.spec.ts +++ b/src/public/app/services/eslint.spec.ts @@ -50,4 +50,9 @@ describe("Linter", () => { expect(await lint(`$("
");`, "application/javascript;env=backend")).toMatchObject([{ "ruleId": "no-undef" }]); expect(await lint(`console.log($("
"));`, "application/javascript;env=frontend")).toStrictEqual([]); }); + + it("supports module.exports", async () => { + expect(await lint(`module.exports("Hi");`, "application/javascript;env=backend")).toStrictEqual([]); + expect(await lint(`module.exports("Hi");`, "application/javascript;env=frontend")).toStrictEqual([]); + }); }); diff --git a/src/public/app/services/eslint.ts b/src/public/app/services/eslint.ts index 6ccb0c9bf..4563239e6 100644 --- a/src/public/app/services/eslint.ts +++ b/src/public/app/services/eslint.ts @@ -6,7 +6,8 @@ export async function lint(code: string, mimeType: string) { let globals: Record = { ...globalDefinitions.browser, - api: "readonly" + api: "readonly", + module: "readonly" }; if (mimeType === "application/javascript;env=frontend") {