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") {