mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 03:30:40 +00:00
refactor(debug): add ESLint no-console rule with targeted allowlist
- Add 'no-console': 'error' to main source files (packages/core/src, packages/cli/src) - Configure targeted allowlist for: - Test files and scripts - VS Code extension (out of scope) - WebUI package (UI component library) - Integration tests - Intentionally excluded files (acpAgent.ts, stdioHelpers.ts) - Consolidate no-console overrides into a single clearly-marked section - Enforced in CI via npm run lint:ci Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
340becefb4
commit
7f4579ee6a
1 changed files with 25 additions and 30 deletions
|
|
@ -145,6 +145,7 @@ export default tseslint.config(
|
|||
},
|
||||
],
|
||||
'no-unsafe-finally': 'error',
|
||||
'no-console': 'error',
|
||||
'no-unused-expressions': 'off', // Disable base rule
|
||||
'@typescript-eslint/no-unused-expressions': [
|
||||
// Enable TS version
|
||||
|
|
@ -216,6 +217,28 @@ export default tseslint.config(
|
|||
'no-undef': 'off',
|
||||
},
|
||||
},
|
||||
// ==================== no-console allowlist ====================
|
||||
// The following files/packages are allowed to use console.*
|
||||
|
||||
// VS Code IDE companion - out of scope for no-console rule
|
||||
{
|
||||
files: ['packages/vscode-ide-companion/**/*.ts', 'packages/vscode-ide-companion/**/*.tsx', 'packages/vscode-ide-companion/**/*.js'],
|
||||
rules: { 'no-console': 'off' },
|
||||
},
|
||||
// WebUI package - UI component library with Storybook
|
||||
{
|
||||
files: ['packages/webui/**/*.ts', 'packages/webui/**/*.tsx', 'packages/webui/**/*.js'],
|
||||
rules: { 'no-console': 'off' },
|
||||
},
|
||||
// Specific CLI files that intentionally wrap console usage
|
||||
{
|
||||
files: [
|
||||
'packages/cli/src/acp-integration/acpAgent.ts', // console infrastructure for ACP mode
|
||||
'packages/cli/src/utils/stdioHelpers.ts', // wraps console.clear()
|
||||
],
|
||||
rules: { 'no-console': 'off' },
|
||||
},
|
||||
// Specific esbuild configs not covered by scripts pattern
|
||||
{
|
||||
files: ['packages/vscode-ide-companion/esbuild.js'],
|
||||
languageOptions: {
|
||||
|
|
@ -228,36 +251,7 @@ export default tseslint.config(
|
|||
rules: {
|
||||
'no-restricted-syntax': 'off',
|
||||
'@typescript-eslint/no-require-imports': 'off',
|
||||
},
|
||||
},
|
||||
// extra settings for scripts that we run directly with node
|
||||
{
|
||||
files: ['packages/vscode-ide-companion/scripts/**/*.js'],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
process: 'readonly',
|
||||
console: 'readonly',
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'no-restricted-syntax': 'off',
|
||||
'@typescript-eslint/no-require-imports': 'off',
|
||||
},
|
||||
},
|
||||
// extra settings for core package scripts
|
||||
{
|
||||
files: ['packages/core/scripts/**/*.js'],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
process: 'readonly',
|
||||
console: 'readonly',
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'no-restricted-syntax': 'off',
|
||||
'@typescript-eslint/no-require-imports': 'off',
|
||||
'no-console': 'off',
|
||||
},
|
||||
},
|
||||
// Prettier config must be last
|
||||
|
|
@ -273,6 +267,7 @@ export default tseslint.config(
|
|||
},
|
||||
},
|
||||
rules: {
|
||||
'no-console': 'off', // Allow console in integration tests
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue