Skip to content

Commit f33af04

Browse files
authored
chore: update eslint rule no-console (#48)
## Proposed changes Basically, the outputs of this extension will be outputted through the `OutputChannel` or UI of vscode. ## Types of changes [//]: # 'What types of changes does your code introduce to WebdriverIO?' [//]: # '_Put an `x` in the boxes that apply_' - [X] Polish (an improvement for an existing feature) - [ ] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update (improvements to the project's docs) - [ ] Internal updates (everything related to internal scripts, governance documentation and CI files) ## Checklist [//]: # "_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._" - [X] I have read the [CONTRIBUTING](https://github.com/webdriverio/vscode-webdriverio/blob/main/CONTRIBUTION.md) doc - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added the necessary documentation (if appropriate) - [ ] I have added proper type definitions for new commands (if appropriate) ## Further comments [//]: # 'If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...' ### Reviewers: @webdriverio/project-committers
1 parent 2cfd7da commit f33af04

5 files changed

Lines changed: 12 additions & 4 deletions

File tree

eslint.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ export default wdioEslint.config([
5656
],
5757
},
5858
},
59+
{
60+
files: ['packages/*/src/*.ts'],
61+
ignores: ['packages/vscode-wdio-worker/**/*'],
62+
rules: {
63+
'no-console': 'error',
64+
},
65+
},
5966
{
6067
files: ['tests/**/*.spec.ts', 'tests/**/*.test.ts'],
6168
rules: {

packages/vscode-wdio-api/src/worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class WdioExtensionWorker extends EventEmitter implements WdioExtensionWo
4040
try {
4141
this._workerProcess.kill('SIGKILL')
4242
} catch (e) {
43-
console.log(e)
43+
log.debug(e)
4444
}
4545
}
4646
}

packages/vscode-wdio-logger/src/logger.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export class VscodeWdioLogger implements LoggerInterface, vscode.Disposable {
8686
this._fileLogger.write(logMessage)
8787
} catch (error) {
8888
this._fileLogger = undefined
89-
console.log('====')
9089
this.error(error instanceof Error ? error.message : String(error))
9190
}
9291
}

packages/vscode-wdio-reporter/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default class VscodeJsonReporter extends WDIOReporter {
7777
fs.writeFileSync(logFile, content)
7878
} catch (error) {
7979
const errorMessage = error instanceof Error ? error.message : String(error)
80+
// eslint-disable-next-line no-console
8081
console.log(errorMessage)
8182
}
8283
}

packages/vscode-webdriverio/src/extension.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ class WdioExtension implements vscode.Disposable {
7777
configFileWatcher.enable()
7878
})
7979
} catch (error) {
80-
console.log(error)
81-
log.error(String(error))
80+
const msg = `Initialization failed: ${error instanceof Error ? error.message : String(error)}`
81+
vscode.window.showErrorMessage(msg)
82+
log.error(msg)
8283
}
8384
}
8485

0 commit comments

Comments
 (0)