From ffbf7e5ea83c0835effad200dac969d2e74da883 Mon Sep 17 00:00:00 2001 From: JC Franco Date: Wed, 18 Dec 2024 13:45:36 -0800 Subject: [PATCH 1/2] chore(linting): enable no-console rule to promote using the logger --- packages/calcite-components/.eslintrc.cjs | 1 + packages/calcite-components/src/utils/logger.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/calcite-components/.eslintrc.cjs b/packages/calcite-components/.eslintrc.cjs index 7da92a9b971..f67bb4e783b 100644 --- a/packages/calcite-components/.eslintrc.cjs +++ b/packages/calcite-components/.eslintrc.cjs @@ -78,6 +78,7 @@ module.exports = { "jsdoc/require-returns-type": "off", "jsdoc/tag-lines": ["error", "any", { startLines: 1 }], "no-eval": "error", + "no-console": ["error"], "no-implied-eval": "error", "no-multiple-empty-lines": [ "error", diff --git a/packages/calcite-components/src/utils/logger.ts b/packages/calcite-components/src/utils/logger.ts index 2fd7fba401f..01300389315 100644 --- a/packages/calcite-components/src/utils/logger.ts +++ b/packages/calcite-components/src/utils/logger.ts @@ -45,6 +45,7 @@ function forwardToConsole(level: LogLevel, ...data: any[]): void { const badgeTemplate = "%ccalcite"; const badgeStyle = "background: #007AC2; color: #fff; border-radius: 4px; padding: 2px 4px;"; + // eslint-disable-next-line no-console -- official messaging is managed through this module console[level].call(this, badgeTemplate, badgeStyle, ...data); } From 6efeeea4390b18d0b0fba52f66b01a61ba05c457 Mon Sep 17 00:00:00 2001 From: JC Franco Date: Wed, 18 Dec 2024 13:49:12 -0800 Subject: [PATCH 2/2] scope no-console to source dir --- packages/calcite-components/.eslintrc.cjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/calcite-components/.eslintrc.cjs b/packages/calcite-components/.eslintrc.cjs index f67bb4e783b..aa23adea6ff 100644 --- a/packages/calcite-components/.eslintrc.cjs +++ b/packages/calcite-components/.eslintrc.cjs @@ -78,7 +78,6 @@ module.exports = { "jsdoc/require-returns-type": "off", "jsdoc/tag-lines": ["error", "any", { startLines: 1 }], "no-eval": "error", - "no-console": ["error"], "no-implied-eval": "error", "no-multiple-empty-lines": [ "error", @@ -181,6 +180,12 @@ module.exports = { "@esri/calcite-components/no-dynamic-createelement": "off", }, }, + { + files: ["src/**/*"], + rules: { + "no-console": ["error"], + }, + }, { extends: ["plugin:@typescript-eslint/disable-type-checked"], files: ["*.cjs"],