diff --git a/CHANGELOG.md b/CHANGELOG.md index 431f60dd..49e061b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ planned for 2025-07-01 - Removed as many of the date conversions as possible - Use `moment-timezone` when calculating recurring events, this will fix problems from the past with offsets and DST not being handled properly - Added some tests to test the behavior of the refactored methods to make sure the correct event dates are returned +- [linter] Enable ESLint rule `no-console` and replace `console` with `Log` in some files ### Fixed diff --git a/eslint.config.mjs b/eslint.config.mjs index a22a0dc6..b046879d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -84,6 +84,16 @@ export default defineConfig([ "sort-keys": "off" } }, + { + files: ["**/*.js"], + ignores: [ + "clientonly/index.js", + "modules/default/calendar/debug.js", + "js/logger.js", + "tests/**/*.js" + ], + rules: {"no-console": "error"} + }, { files: ["**/package.json"], plugins: {packageJson}, diff --git a/js/app.js b/js/app.js index 00d714de..72d9e852 100644 --- a/js/app.js +++ b/js/app.js @@ -364,7 +364,7 @@ function App () { } } catch (error) { Log.error(`Error when stopping node_helper for module ${nodeHelper.name}:`); - console.error(error); + Log.error(error); } } diff --git a/js/main.js b/js/main.js index c2a56053..58740285 100644 --- a/js/main.js +++ b/js/main.js @@ -617,7 +617,7 @@ const MM = (function () { if (startUp !== curr) { startUp = ""; window.location.reload(true); - console.warn("Refreshing Website because server was restarted"); + Log.warn("Refreshing Website because server was restarted"); } } catch (err) { Log.error(`MagicMirror not reachable: ${err}`); diff --git a/js/utils.js b/js/utils.js index de3032a4..636e26d2 100644 --- a/js/utils.js +++ b/js/utils.js @@ -70,7 +70,7 @@ module.exports = { fs.writeFileSync(discoveredPositionsJSFilename, `const modulePositions=${JSON.stringify(modulePositions)}`); } catch (error) { - console.error("unable to write js/positions.js with the discovered module positions\nmake the MagicMirror/js folder writeable by the user starting MagicMirror"); + Log.error("unable to write js/positions.js with the discovered module positions\nmake the MagicMirror/js folder writeable by the user starting MagicMirror"); } } // return the list to the caller