Skip to content

Commit fda5192

Browse files
authored
chore: disallow console statement (#9986)
1 parent 0ae651a commit fda5192

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

.eslintrc.cjs

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = {
1919
plugins: ['jest', 'import', '@typescript-eslint'],
2020
rules: {
2121
'no-debugger': 'error',
22+
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
2223
// most of the codebase are expected to be env agnostic
2324
'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals],
2425

@@ -58,6 +59,7 @@ module.exports = {
5859
{
5960
files: ['**/__tests__/**', 'packages/dts-test/**'],
6061
rules: {
62+
'no-console': 'off',
6163
'no-restricted-globals': 'off',
6264
'no-restricted-syntax': 'off',
6365
'jest/no-disabled-tests': 'error',
@@ -92,6 +94,7 @@ module.exports = {
9294
rules: {
9395
'no-restricted-globals': ['error', ...NodeGlobals],
9496
'no-restricted-syntax': ['error', banConstEnum],
97+
'no-console': 'off',
9598
},
9699
},
97100
// JavaScript files
@@ -113,6 +116,7 @@ module.exports = {
113116
rules: {
114117
'no-restricted-globals': 'off',
115118
'no-restricted-syntax': ['error', banConstEnum],
119+
'no-console': 'off',
116120
},
117121
},
118122
// Import nodejs modules in compiler-sfc

packages/runtime-core/src/components/Suspense.ts

+1
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ function createSuspenseBoundary(
444444
if (__DEV__ && !__TEST__ && !hasWarned) {
445445
hasWarned = true
446446
// @ts-expect-error `console.info` cannot be null error
447+
// eslint-disable-next-line no-console
447448
console[console.info ? 'info' : 'log'](
448449
`<Suspense> is an experimental feature and its API will likely change.`,
449450
)

packages/server-renderer/src/renderToStream.ts

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ export function pipeToWebWritable(
206206
},
207207
destroy(err) {
208208
// TODO better error handling?
209+
// eslint-disable-next-line no-console
209210
console.log(err)
210211
writer.close()
211212
},

0 commit comments

Comments
 (0)