From 217fa40ddbb1ceb745ab81b6a4e623f5dfa73c26 Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 14 Aug 2025 14:57:20 +0200 Subject: [PATCH] Only forbid using console in application code --- .eslintrc.cjs | 11 +++++++++-- vite.config.ts | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index b734c520..98e6e4c8 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -28,8 +28,6 @@ module.exports = { rules: { "matrix-org/require-copyright-header": ["error", COPYRIGHT_HEADER], "jsx-a11y/media-has-caption": "off", - // We should use the js-sdk logger, never console directly. - "no-console": ["error"], "react/display-name": "error", // Encourage proper usage of Promises: "@typescript-eslint/no-floating-promises": "error", @@ -46,6 +44,15 @@ module.exports = { "rxjs/no-exposed-subjects": "error", "rxjs/finnish": ["error", { names: { "^this$": false } }], }, + overrides: [ + { + files: ["src/*/**"], + rules: { + // In application code we should use the js-sdk logger, never console directly. + "no-console": ["error"], + }, + }, + ], settings: { react: { version: "detect", diff --git a/vite.config.ts b/vite.config.ts index 115565bb..cfc80279 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -18,7 +18,7 @@ import { sentryVitePlugin } from "@sentry/vite-plugin"; import react from "@vitejs/plugin-react"; import { realpathSync } from "fs"; import * as fs from "node:fs"; -import { logger } from "matrix-js-sdk/lib/logger"; + // https://vitejs.dev/config/ // Modified type helper from defineConfig to allow for packageType (see defineConfig from vite) export default ({ @@ -86,7 +86,7 @@ export default ({ allow.push(realpathSync(path)); } catch {} } - logger.log("Allowed vite paths:", allow); + console.log("Allowed vite paths:", allow); return { server: {