Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: disallow console statement #9986

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = {
plugins: ['jest', 'import', '@typescript-eslint'],
rules: {
'no-debugger': 'error',
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
// most of the codebase are expected to be env agnostic
'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals],

Expand Down Expand Up @@ -58,6 +59,7 @@ module.exports = {
{
files: ['**/__tests__/**', 'packages/dts-test/**'],
rules: {
'no-console': 'off',
'no-restricted-globals': 'off',
'no-restricted-syntax': 'off',
'jest/no-disabled-tests': 'error',
Expand Down Expand Up @@ -92,6 +94,7 @@ module.exports = {
rules: {
'no-restricted-globals': ['error', ...NodeGlobals],
'no-restricted-syntax': ['error', banConstEnum],
'no-console': 'off',
},
},
// JavaScript files
Expand All @@ -113,6 +116,7 @@ module.exports = {
rules: {
'no-restricted-globals': 'off',
'no-restricted-syntax': ['error', banConstEnum],
'no-console': 'off',
},
},
// Import nodejs modules in compiler-sfc
Expand Down
2 changes: 0 additions & 2 deletions packages/compiler-ssr/src/transforms/ssrTransformComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ export const ssrTransformComponent: NodeTransform = (node, context) => {
const vnodeBranches: ReturnStatement[] = []
const clonedNode = clone(node)

console.log(clonedNode)

return function ssrPostTransformComponent() {
// Using the cloned node, build the normal VNode-based branches (for
// fallback in case the child is render-fn based). Store them in an array
Expand Down
1 change: 1 addition & 0 deletions packages/runtime-core/src/components/Suspense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ function createSuspenseBoundary(
if (__DEV__ && !__TEST__ && !hasWarned) {
hasWarned = true
// @ts-expect-error `console.info` cannot be null error
// eslint-disable-next-line no-console
console[console.info ? 'info' : 'log'](
`<Suspense> is an experimental feature and its API will likely change.`,
)
Expand Down
1 change: 1 addition & 0 deletions packages/server-renderer/src/renderToStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ export function pipeToWebWritable(
},
destroy(err) {
// TODO better error handling?
// eslint-disable-next-line no-console
console.log(err)
writer.close()
},
Expand Down