Skip to content

Commit 530602e

Browse files
committed
chore(lint): added no-console rule
1 parent aef7552 commit 530602e

File tree

14 files changed

+78
-20
lines changed

14 files changed

+78
-20
lines changed

.eslintrc.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ module.exports = {
4444
'@typescript-eslint/explicit-module-boundary-types': 'off',
4545
camelcase: 'warn',
4646
'no-prototype-builtins': 'off',
47-
'no-use-before-define': 'off'
47+
'no-use-before-define': 'off',
48+
'no-console': ['error', { allow: ['warn', 'error'] }]
4849
},
4950
ignorePatterns: [
5051
'node_modules/',
@@ -81,7 +82,8 @@ module.exports = {
8182
rules: {
8283
'@typescript-eslint/no-unused-vars': 'off',
8384
'vue/require-default-prop': 'off',
84-
'vue/require-prop-types': 'off'
85+
'vue/require-prop-types': 'off',
86+
'no-console': 'off'
8587
}
8688
}
8789
]

packages/app-backend-core/src/component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export async function sendSelectedComponentData (appRecord: AppRecord, instanceI
6262
}
6363
}
6464
if (SharedData.debugInfo) {
65+
// eslint-disable-next-line no-console
6566
console.log('[DEBUG] inspect', instance)
6667
}
6768
const parentInstances = await appRecord.backend.api.walkComponentParents(instance)

packages/app-backend-core/src/hook.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,10 @@ export function installHook (target, isIframe = false) {
210210
if (typeof path === 'string') path = [path]
211211
hook.storeModules.push({ path, module, options })
212212
origRegister(path, module, options)
213-
if (process.env.NODE_ENV !== 'production') console.log('early register module', path, module, options)
213+
if (process.env.NODE_ENV !== 'production') {
214+
// eslint-disable-next-line no-console
215+
console.log('early register module', path, module, options)
216+
}
214217
}
215218
origUnregister = store.unregisterModule.bind(store)
216219
store.unregisterModule = (path) => {
@@ -219,7 +222,10 @@ export function installHook (target, isIframe = false) {
219222
const index = hook.storeModules.findIndex(m => m.path.join('/') === key)
220223
if (index !== -1) hook.storeModules.splice(index, 1)
221224
origUnregister(path)
222-
if (process.env.NODE_ENV !== 'production') console.log('early unregister module', path)
225+
if (process.env.NODE_ENV !== 'production') {
226+
// eslint-disable-next-line no-console
227+
console.log('early unregister module', path)
228+
}
223229
}
224230
}
225231
hook.flushStoreModules = () => {

packages/app-backend-core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ function connectBridge () {
554554
} else if (payload.revive) {
555555
value = revive(value)
556556
}
557+
// eslint-disable-next-line no-console
557558
console[payload.level](value)
558559
})
559560

packages/shared-utils/src/shared-data.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ export function initSharedData (params: SharedDataParams) {
8080
persist = !!params.persist
8181

8282
if (persist) {
83-
if (process.env.NODE_ENV !== 'production') console.log('[shared data] Master init in progress...')
83+
if (process.env.NODE_ENV !== 'production') {
84+
// eslint-disable-next-line no-console
85+
console.log('[shared data] Master init in progress...')
86+
}
8487
// Load persisted fields
8588
persisted.forEach(key => {
8689
const value = getStorage(`vue-devtools-${storageVersion}:shared-data:${key}`)
@@ -96,7 +99,10 @@ export function initSharedData (params: SharedDataParams) {
9699
bridge.send('shared-data:load-complete')
97100
})
98101
bridge.on('shared-data:init-complete', () => {
99-
if (process.env.NODE_ENV !== 'production') console.log('[shared data] Master init complete')
102+
if (process.env.NODE_ENV !== 'production') {
103+
// eslint-disable-next-line no-console
104+
console.log('[shared data] Master init complete')
105+
}
100106
clearInterval(initRetryInterval)
101107
resolve()
102108
})
@@ -110,7 +116,10 @@ export function initSharedData (params: SharedDataParams) {
110116
initRetryCount = 0
111117
clearInterval(initRetryInterval)
112118
initRetryInterval = setInterval(() => {
113-
if (process.env.NODE_ENV !== 'production') console.log('[shared data] Master init retrying...')
119+
if (process.env.NODE_ENV !== 'production') {
120+
// eslint-disable-next-line no-console
121+
console.log('[shared data] Master init retrying...')
122+
}
114123
bridge.send('shared-data:master-init-waiting')
115124
initRetryCount++
116125
if (initRetryCount > 30) {
@@ -119,13 +128,22 @@ export function initSharedData (params: SharedDataParams) {
119128
}
120129
}, 2000)
121130
} else {
122-
if (process.env.NODE_ENV !== 'production') console.log('[shared data] Slave init in progress...')
131+
if (process.env.NODE_ENV !== 'production') {
132+
// eslint-disable-next-line no-console
133+
console.log('[shared data] Slave init in progress...')
134+
}
123135
bridge.on('shared-data:master-init-waiting', () => {
124-
if (process.env.NODE_ENV !== 'production') console.log('[shared data] Slave loading data...')
136+
if (process.env.NODE_ENV !== 'production') {
137+
// eslint-disable-next-line no-console
138+
console.log('[shared data] Slave loading data...')
139+
}
125140
// Load all persisted shared data
126141
bridge.send('shared-data:load')
127142
bridge.once('shared-data:load-complete', () => {
128-
if (process.env.NODE_ENV !== 'production') console.log('[shared data] Slave init complete')
143+
if (process.env.NODE_ENV !== 'production') {
144+
// eslint-disable-next-line no-console
145+
console.log('[shared data] Slave init complete')
146+
}
129147
bridge.send('shared-data:init-complete')
130148
resolve()
131149
})

packages/shared-utils/src/util.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ export function getCustomHTMLElementDetails (value: HTMLElement): CustomState {
370370
icon: 'input',
371371
tooltip: 'Log element to console',
372372
action: () => {
373+
// eslint-disable-next-line no-console
373374
console.log(value)
374375
}
375376
}

packages/shell-chrome/src/background.js

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ function installProxy (tabId) {
3939
if (!res) {
4040
ports[tabId].devtools.postMessage('proxy-fail')
4141
} else {
42-
if (process.env.NODE_ENV !== 'production') { console.log('injected proxy to tab ' + tabId) }
42+
if (process.env.NODE_ENV !== 'production') {
43+
// eslint-disable-next-line no-console
44+
console.log('injected proxy to tab ' + tabId)
45+
}
4346
}
4447
})
4548
}
@@ -48,21 +51,32 @@ function doublePipe (id, one, two) {
4851
one.onMessage.addListener(lOne)
4952
function lOne (message) {
5053
if (message.event === 'log') {
54+
// eslint-disable-next-line no-console
5155
return console.log('tab ' + id, message.payload)
5256
}
53-
if (process.env.NODE_ENV !== 'production') { console.log('devtools -> backend', message) }
57+
if (process.env.NODE_ENV !== 'production') {
58+
// eslint-disable-next-line no-console
59+
console.log('devtools -> backend', message)
60+
}
5461
two.postMessage(message)
5562
}
5663
two.onMessage.addListener(lTwo)
5764
function lTwo (message) {
5865
if (message.event === 'log') {
66+
// eslint-disable-next-line no-console
5967
return console.log('tab ' + id, message.payload)
6068
}
61-
if (process.env.NODE_ENV !== 'production') { console.log('backend -> devtools', message) }
69+
if (process.env.NODE_ENV !== 'production') {
70+
// eslint-disable-next-line no-console
71+
console.log('backend -> devtools', message)
72+
}
6273
one.postMessage(message)
6374
}
6475
function shutdown () {
65-
if (process.env.NODE_ENV !== 'production') { console.log('tab ' + id + ' disconnected.') }
76+
if (process.env.NODE_ENV !== 'production') {
77+
// eslint-disable-next-line no-console
78+
console.log('tab ' + id + ' disconnected.')
79+
}
6680
one.onMessage.removeListener(lOne)
6781
two.onMessage.removeListener(lTwo)
6882
one.disconnect()
@@ -71,7 +85,10 @@ function doublePipe (id, one, two) {
7185
}
7286
one.onDisconnect.addListener(shutdown)
7387
two.onDisconnect.addListener(shutdown)
74-
if (process.env.NODE_ENV !== 'production') { console.log('tab ' + id + ' connected.') }
88+
if (process.env.NODE_ENV !== 'production') {
89+
// eslint-disable-next-line no-console
90+
console.log('tab ' + id + ' connected.')
91+
}
7592
}
7693

7794
chrome.runtime.onMessage.addListener((req, sender) => {

packages/shell-chrome/src/devtools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function injectScript (scriptName, cb) {
7171
`
7272
chrome.devtools.inspectedWindow.eval(src, function (res, err) {
7373
if (err) {
74-
console.log(err)
74+
console.error(err)
7575
}
7676
cb()
7777
})

packages/shell-electron/server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ io.on('connection', function (socket) {
3333
})
3434

3535
http.listen(port, '0.0.0.0', () => {
36+
// eslint-disable-next-line no-console
3637
console.log('listening on 0.0.0.0:' + port)
3738
})

packages/shell-electron/src/backend.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ socket.on('connect', () => {
3131
// Global disconnect handler. Fires in two cases:
3232
// - after calling above socket.disconnect()
3333
// - once devtools is closed (that's why we need socket.disconnect() here too, to prevent further polling)
34-
socket.on('disconnect', (reason) => {
34+
socket.on('disconnect', () => {
3535
socket.disconnect()
3636
disconnectedMessage()
3737
})

packages/shell-electron/src/devtools.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ socket.on('vue-devtools-init', () => {
3333
socket.on('vue-message', data => fn(data))
3434
},
3535
send (data) {
36-
console.log('devtools -> backend', data)
36+
if (process.env.NODE_ENV !== 'production') {
37+
// eslint-disable-next-line no-console
38+
console.log('devtools -> backend', data)
39+
}
3740
socket.emit('vue-message', data)
3841
}
3942
}

packages/shell-host/src/backend.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ const bridge = new Bridge({
66
window.addEventListener('message', evt => fn(evt.data))
77
},
88
send (data) {
9-
console.log('backend -> devtools', data)
9+
if (process.env.NODE_ENV !== 'production') {
10+
// eslint-disable-next-line no-console
11+
console.log('backend -> devtools', data)
12+
}
1013
window.parent.postMessage(data, '*')
1114
}
1215
})

packages/shell-host/src/devtools.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ target.onload = () => {
1818
targetWindow.parent.addEventListener('message', evt => fn(evt.data))
1919
},
2020
send (data) {
21-
console.log('devtools -> backend', data)
21+
if (process.env.NODE_ENV !== 'production') {
22+
// eslint-disable-next-line no-console
23+
console.log('devtools -> backend', data)
24+
}
2225
targetWindow.postMessage(data, '*')
2326
}
2427
}))

sign-firefox.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable no-console */
2+
13
const path = require('path')
24
const fs = require('fs')
35
const execa = require('execa')

0 commit comments

Comments
 (0)