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

Formatters sometimes omit important info from parser error messages #9154

Closed
not-an-aardvark opened this issue Aug 25, 2017 · 2 comments
Closed
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features

Comments

@not-an-aardvark
Copy link
Member

Tell us about your environment

  • ESLint Version: master
  • Node Version: 8.4.0
  • npm Version: 5.3.0

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

(no configuration)

What did you do? Please include the actual source code causing the issue.

I linted an invalid piece of JavaScript text which only consists of a single dot: .

$ echo '.' | eslint --stdin --no-eslintrc

What did you expect to happen?

I expected a parser error including the message Unexpected token .

What actually happened? Please include the actual, raw output from ESLint.

<text>
  1:1  error  Parsing error: Unexpected token

The stylish and codeframe formatters strip trailing . characters from report messages, presumably for stylistic reasons. However, this leads to confusing messages when the . is actually an important component of the message, rather than a period at the end of the sentence.

One way to address this would be to avoid removing the trailing . for fatal messages. Another solution would be to just stop removing trailing . characters entirely.

@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features labels Aug 25, 2017
@i-ron-y
Copy link
Contributor

i-ron-y commented Sep 6, 2017

How about keeping " ." but removing "." when there is no space in front of it? Seeing as that error message should've said "Unexpected token .", and the "." used as a punctuation in report messages would have some character that isn't a space immediately preceding it.

@i-ron-y
Copy link
Contributor

i-ron-y commented Sep 7, 2017

PR'd.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Mar 9, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Mar 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features
Projects
None yet
Development

No branches or pull requests

2 participants