SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore: add eslint rules for no-console (#10071)
Ashwin Bhatkaldd0738ac7093
diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.jsindex d4b76612a4..7797256dca 100644--- a/frontend/.eslintrc.js+++ b/frontend/.eslintrc.js@@ -38,7 +38,7 @@ module.exports = {'import', // Import/export linting'sonarjs', // Code quality/complexity// TODO: Uncomment after running: yarn add -D eslint-plugin-spellcheck- // 'spellcheck',+ // 'spellcheck', // Correct spellings],settings: {react: {@@ -60,8 +60,7 @@ module.exports = {'no-debugger': 'error', // Disallows debugger statements in production codecurly: 'error', // Requires curly braces for all control statementseqeqeq: ['error', 'always', { null: 'ignore' }], // Enforces === and !== (allows == null for null/undefined check)- // TODO: Enable after fixing ~15 console.log statements- // 'no-console': ['error', { allow: ['warn', 'error'] }], // Warns on console.log, allows console.warn/error+ 'no-console': ['error', { allow: ['warn', 'error'] }], // Warns on console.log, allows console.warn/error// TypeScript rules'@typescript-eslint/explicit-function-return-type': 'error', // Requires explicit return types on functionsdiff --git a/frontend/src/components/QuickFilters/FilterRenderers/Slider/Slider.tsx b/frontend/src/components/QuickFilters/FilterRenderers/Slider/Slider.tsxindex 70b2fdceea..421de26e82 100644--- a/frontend/src/components/QuickFilters/FilterRenderers/Slider/Slider.tsx+++ b/frontend/src/components/QuickFilters/FilterRenderers/Slider/Slider.tsx@@ -1,14 +1,5 @@import './Slider.styles.scss';-import { IQuickFiltersConfig } from 'components/QuickFilters/types';--interface ISliderProps {- filter: IQuickFiltersConfig;-}--// not needed for now build when required-export default function Slider(props: ISliderProps): JSX.Element {- const { filter } = props;- console.log(filter);+export default function Slider(): JSX.Element {return <div>Slider</div>;}diff --git a/frontend/src/components/QuickFilters/QuickFilters.tsx b/frontend/src/components/QuickFilters/QuickFilters.tsxindex 31bbd4f175..6a0146a48d 100644--- a/frontend/src/components/QuickFilters/QuickFilters.tsx+++ b/frontend/src/components/QuickFilters/QuickFilters.tsx@@ -311,7 +311,7 @@ export default function QuickFilters(props: IQuickFiltersProps): JSX.Element {/>);case FiltersType.SLIDER:- return <Slider filter={filter} />;+ return <Slider />;// eslint-disable-next-line sonarjs/no-duplicated-branchesdefault:return (diff --git a/frontend/src/container/NewWidget/RightContainer/ContextLinks/UpdateContextLinks.tsx b/frontend/src/container/NewWidget/RightContainer/ContextLinks/UpdateContextLinks.tsxindex 6c41f0e971..1422627124 100644--- a/frontend/src/container/NewWidget/RightContainer/ContextLinks/UpdateContextLinks.tsx+++ b/frontend/src/container/NewWidget/RightContainer/ContextLinks/UpdateContextLinks.tsx@@ -166,7 +166,7 @@ function UpdateContextLinks({onSave(newContextLink);} catch (error) {// Form validation failed, don't call onSave- console.log('Form validation failed:', error);+ console.error('Form validation failed:', error);}};diff --git a/frontend/src/container/QueryTable/Drilldown/useBaseAggregateOptions.tsx b/frontend/src/container/QueryTable/Drilldown/useBaseAggregateOptions.tsxindex 35d2b8ae05..c71fedb2e7 100644--- a/frontend/src/container/QueryTable/Drilldown/useBaseAggregateOptions.tsx+++ b/frontend/src/container/QueryTable/Drilldown/useBaseAggregateOptions.tsx@@ -129,7 +129,6 @@ const useBaseAggregateOptions = ({const handleBaseDrilldown = useCallback((key: string): void => {- console.log('Base drilldown:', { key, aggregateData });const route = getRoute(key);const timeRange = aggregateData?.timeRange;const filtersToAdd = aggregateData?.filters || [];diff --git a/frontend/src/container/QueryTable/Drilldown/useDashboardVarConfig.tsx b/frontend/src/container/QueryTable/Drilldown/useDashboardVarConfig.tsxindex 6f8cb34c94..430ae6bc3b 100644--- a/frontend/src/container/QueryTable/Drilldown/useDashboardVarConfig.tsx+++ b/frontend/src/container/QueryTable/Drilldown/useDashboardVarConfig.tsx@@ -83,11 +83,6 @@ const useDashboardVarConfig = ({dashboardVar: [string, IDashboardVariable],fieldValue: any,) => {- console.log('Setting variable:', {- fieldName,- dashboardVarId: dashboardVar[0],- fieldValue,- });onValueUpdate(fieldName, dashboardVar[1]?.id, fieldValue, false);onClose();},@@ -96,10 +91,6 @@ const useDashboardVarConfig = ({const handleUnsetVariable = useCallback((fieldName: string, dashboardVar: [string, IDashboardVariable]) => {- console.log('Unsetting variable:', {- fieldName,- dashboardVarId: dashboardVar[0],- });onValueUpdate(fieldName, dashboardVar[0], null, false);onClose();},@@ -109,12 +100,6 @@ const useDashboardVarConfig = ({const handleCreateVariable = useCallback((fieldName: string, fieldValue: string | number | boolean) => {const source = getSourceFromQuery();- console.log('Creating variable from drilldown:', {- fieldName,- fieldValue,- source,- widgetId,- });createVariable(fieldName,fieldValue,@@ -125,7 +110,7 @@ const useDashboardVarConfig = ({);onClose();},- [createVariable, getSourceFromQuery, widgetId, onClose],+ [createVariable, getSourceFromQuery, onClose],);const contextItems = useMemo(diff --git a/frontend/src/hooks/useDragColumns/index.ts b/frontend/src/hooks/useDragColumns/index.tsindex 37acc01e7f..126ad24972 100644--- a/frontend/src/hooks/useDragColumns/index.ts+++ b/frontend/src/hooks/useDragColumns/index.ts@@ -55,7 +55,7 @@ const useDragColumns = <T>(storageKey: LOCALSTORAGE): UseDragColumns<T> => {const parsedDraggedColumns = await JSON.parse(localStorageColumns);nextDraggedColumns = parsedDraggedColumns;} catch (e) {- console.log('error while parsing json');+ console.error('error while parsing json: ', e);} finally {redirectWithDraggedColumns(nextDraggedColumns);}diff --git a/frontend/src/lib/__tests__/logql/parser.test.ts b/frontend/src/lib/__tests__/logql/parser.test.tsindex e5e813d921..56f8bcb16a 100644--- a/frontend/src/lib/__tests__/logql/parser.test.ts+++ b/frontend/src/lib/__tests__/logql/parser.test.ts@@ -4,11 +4,6 @@ import parser from 'lib/logql/parser';describe('lib/logql/parser', () => {test('parse valid queries', () => {logqlQueries.forEach((queryObject) => {- try {- parser(queryObject.query);- } catch (e) {- console.log(e);- }expect(parser(queryObject.query)).toEqual(queryObject.parsedQuery);});});diff --git a/frontend/src/lib/__tests__/logql/reverseParser.test.ts b/frontend/src/lib/__tests__/logql/reverseParser.test.tsindex 463512af44..1d5d8a6145 100644--- a/frontend/src/lib/__tests__/logql/reverseParser.test.ts+++ b/frontend/src/lib/__tests__/logql/reverseParser.test.ts@@ -4,11 +4,7 @@ import { reverseParser } from 'lib/logql/reverseParser';describe('lib/logql/reverseParser', () => {test('reverse parse valid queries', () => {logqlQueries.forEach((queryObject) => {- try {- expect(reverseParser(queryObject.parsedQuery)).toEqual(queryObject.query);- } catch (e) {- console.log(e);- }+ expect(reverseParser(queryObject.parsedQuery)).toEqual(queryObject.query);});});});diff --git a/frontend/src/lib/uPlotLib/utils/getYAxisScale.test.ts b/frontend/src/lib/uPlotLib/utils/getYAxisScale.test.tsindex 708357ab48..b333759a5f 100644--- a/frontend/src/lib/uPlotLib/utils/getYAxisScale.test.ts+++ b/frontend/src/lib/uPlotLib/utils/getYAxisScale.test.ts@@ -11,8 +11,8 @@ describe('getYAxisScale', () => {keyIndex: 1,thresholdValue: 10,thresholdUnit: 'percentunit',- moveThreshold(dragIndex, hoverIndex): void {- console.log(dragIndex, hoverIndex);+ moveThreshold(): void {+ // no-op},selectedGraph: PANEL_TYPES.TIME_SERIES,},@@ -21,8 +21,8 @@ describe('getYAxisScale', () => {keyIndex: 2,thresholdValue: 20,thresholdUnit: 'percentunit',- moveThreshold(dragIndex, hoverIndex): void {- console.log(dragIndex, hoverIndex);+ moveThreshold(): void {+ // no-op},selectedGraph: PANEL_TYPES.TIME_SERIES,},diff --git a/frontend/src/store/actions/trace/parseFilter/parseSpanKind.ts b/frontend/src/store/actions/trace/parseFilter/parseSpanKind.tsindex c4626b44f7..0ad046696d 100644--- a/frontend/src/store/actions/trace/parseFilter/parseSpanKind.ts+++ b/frontend/src/store/actions/trace/parseFilter/parseSpanKind.ts@@ -20,8 +20,7 @@ export const parseQueryIntoSpanKind = (current = parsedValue;}} catch (error) {- console.log(error);- console.log('error while parsing json');+ console.error('error while parsing json: ', error);}}diff --git a/frontend/src/store/actions/trace/parseFilter/spanAggregateCurrentPage.ts b/frontend/src/store/actions/trace/parseFilter/spanAggregateCurrentPage.tsindex 3135992558..f55561852e 100644--- a/frontend/src/store/actions/trace/parseFilter/spanAggregateCurrentPage.ts+++ b/frontend/src/store/actions/trace/parseFilter/spanAggregateCurrentPage.ts@@ -19,7 +19,7 @@ export const parseQueryIntoCurrent = (current = parseInt(parsedValue, 10);}} catch (error) {- console.log('error while parsing json');+ console.error('error while parsing json: ', error);}}diff --git a/frontend/src/store/actions/trace/parseFilter/spanAggregateOrder.ts b/frontend/src/store/actions/trace/parseFilter/spanAggregateOrder.tsindex 47d55bd218..b78f95a736 100644--- a/frontend/src/store/actions/trace/parseFilter/spanAggregateOrder.ts+++ b/frontend/src/store/actions/trace/parseFilter/spanAggregateOrder.ts@@ -20,8 +20,7 @@ export const parseQueryIntoOrder = (current = parsedValue;}} catch (error) {- console.log(error);- console.log('error while parsing json');+ console.error('error while parsing json: ', error);}}diff --git a/frontend/src/store/actions/trace/parseFilter/spanAggregateOrderParam.ts b/frontend/src/store/actions/trace/parseFilter/spanAggregateOrderParam.tsindex 129fc2b9f8..3254adb7d9 100644--- a/frontend/src/store/actions/trace/parseFilter/spanAggregateOrderParam.ts+++ b/frontend/src/store/actions/trace/parseFilter/spanAggregateOrderParam.ts@@ -20,8 +20,7 @@ export const parseAggregateOrderParams = (current = parsedValue;}} catch (error) {- console.log(error);- console.log('error while parsing json');+ console.error('error while parsing json: ', error);}}