Skip to content

Commit 0ccffa3

Browse files
authored
refactor(ci): enforce no-console rule in production code (JhaSourav07#601)
## Description This PR adds an ESLint no-console rule to warn against accidental console.log usage in production code while still allowing console.warn, console.error, and console.info. It also adds overrides for test files and scripts to avoid affecting development/debug workflows. Fixes JhaSourav07#379 --- ## Pillar - [x] Code Quality / Refactor - [ ] Bug Fix - [ ] Feature - [ ] Documentation --- ## Changes Made - Updated eslint.config.mjs - Added no-console ESLint rule - Allowed: - console.warn - console.error - console.info - Added overrides for: - test files - __tests__ - scripts/ - Verified no existing console.log usages remain in: - lib/ - app/api/ - utils/ --- ## Checklist - [x] I have read the CONTRIBUTING.md guidelines - [x] I ran npm run lint - [x] I ran npm run test - [x] I verified the production build passes - [x] This PR is linked to an assigned issue - [x] My changes are focused and minimal
2 parents 43f3521 + dee9485 commit 0ccffa3

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

eslint.config.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ const eslintConfig = defineConfig([
88
...nextTs,
99
eslintConfigPrettier,
1010
globalIgnores(['.next/**', 'out/**', 'build/**', 'next-env.d.ts', 'coverage/**', '.github/**']),
11+
{
12+
rules: {
13+
'no-console': ['warn', { allow: ['warn', 'error', 'info'] }],
14+
},
15+
},
16+
{
17+
files: ['**/*.test.{js,jsx,ts,tsx}', '**/__tests__/**/*.{js,jsx,ts,tsx}', 'scripts/**/*.{js,jsx,ts,tsx}'],
18+
rules: {
19+
'no-console': 'off',
20+
},
21+
},
1122
]);
1223

1324
export default eslintConfig;

0 commit comments

Comments
 (0)