Skip to content

Build your personal knowledge base with Trilium Notes

fix(eslint): disable linting of TypeScript due to types (closes #1503)

Elian Doranb0e584924bb7
diff --git a/src/public/app/services/eslint.spec.ts b/src/public/app/services/eslint.spec.ts
index c6b87162ae..42eac213c7 100644
--- a/src/public/app/services/eslint.spec.ts
+++ b/src/public/app/services/eslint.spec.ts
@@ -55,4 +55,8 @@ describe("Linter", () => {
expect(await lint(`module.exports("Hi");`, "application/javascript;env=backend")).toStrictEqual([]);
expect(await lint(`module.exports("Hi");`, "application/javascript;env=frontend")).toStrictEqual([]);
});
+
+ it("ignores TypeScript file", async () => {
+ expect(await lint("export async function lint(code: string, mimeType: string) {}", "text/typescript-jsx")).toStrictEqual([]);
+ });
});
diff --git a/src/public/app/services/eslint.ts b/src/public/app/services/eslint.ts
index 4563239e6b..bdb2dcaeec 100644
--- a/src/public/app/services/eslint.ts
+++ b/src/public/app/services/eslint.ts
@@ -10,6 +10,12 @@ export async function lint(code: string, mimeType: string) {
module: "readonly"
};
+ // Unsupported languages
+ if (mimeType.startsWith("text/typescript")) {
+ return [];
+ }
+
+ // Custom globals
if (mimeType === "application/javascript;env=frontend") {
globals = { ...globals, ...globalDefinitions.jquery };
} else if (mimeType === "application/javascript;env=backend") {