Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Version check warning breaks parsing output of eslint --format=json #1060

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

Closed
NilSet opened this issue Oct 9, 2019 · 3 comments · Fixed by #1121
Closed

Version check warning breaks parsing output of eslint --format=json #1060

NilSet opened this issue Oct 9, 2019 · 3 comments · Fixed by #1121
Labels
awaiting response Issues waiting for a reply from the OP or another party package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@NilSet
Copy link
Contributor

NilSet commented Oct 9, 2019

Repro
install a typescript version ahead of what the parser supports and run
eslint --format=json aFileWithErrors.ts | json_pp

Expected Result
successful parse, and pretty printed json

Actual Result
malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "=============\n\nWAR...") at /usr/local/bin/json_pp line 51.

Additional Info
The parser is printing the following warning to stdout

=============

WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=3.2.1 <3.7.0

YOUR TYPESCRIPT VERSION: 3.7.0-dev.20191009

Please only submit bug reports when using the officially supported version.

=============

This interferes with structured output formats of eslint such as json, which are consumed by other tools.

The actual use case this breaks for me is using the eslint autofixer of https://github.com/dense-analysis/ale .

Suggested solution: change the default log output of the parser to stderr, or configure it to use stderr in the eslint plugin.

Versions

package version
@typescript-eslint/eslint-plugin 2.3.3
@typescript-eslint/parser 2.3.3
TypeScript 3.7.0-beta
ESLint 6.5.1
node 10.13.0
npm 6.4.1
@NilSet NilSet added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Oct 9, 2019
@bradzacher
Copy link
Member

bradzacher commented Oct 9, 2019

You can use the parserOptions.warnOnUnsupportedTypeScriptVersion config option to turn off this warning, if you're intentionally using an unsupported version of TS.

See parser documentation:
https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#configuration

@bradzacher bradzacher added awaiting response Issues waiting for a reply from the OP or another party and removed triage Waiting for team members to take a look labels Oct 9, 2019
@NilSet
Copy link
Contributor Author

NilSet commented Oct 9, 2019

I can personally work around it this way, but the warning should not pollute the structured output of eslint.

@bradzacher
Copy link
Member

happy to accept a PR to fix it!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
awaiting response Issues waiting for a reply from the OP or another party package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants