-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
crash on malformed package.json #10364
Comments
Hi @jacekkopecky, thanks for the issue. I agree this is a bug, and at the very least we should have a more sensible error message. Feel free to submit a PR if you wish 😄 |
Hi, I'd love to have a stab at it but I'm too busy with the day job until July easily. |
Should the error stack be outputed? |
I think it would be nice to output the error message, but outputting the stack is probably not necessary. So the output could look something like this:
|
How about removing the stack info before throwing error? |
We already have code in place for pretty-printing error messages by adding a For example, see: Lines 255 to 263 in a812845
edit: the message templates are in the |
Thanks! I'll check it. |
If
package.json
is malformed, eslint fails by crashing. This is relevant because then in Atom, every file that is to be checked by eslint is marked as invalid.Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
original
package.json
so I cannpm i
eslint:No
.eslintrc
or anything like that.What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
I was editing package.json and introduced a syntax error - the usual extra comma (near the end of the file below).
Then I want to lint the project:
eslint .
What did you expect to happen?
Eslint should either fail gracefully with a warning because it can't parse
package.json
, or it assumes there's nothing inpackage.json
of interest to eslint (which is correct) and proceeds to check the directory, which is otherwise empty so eslint succeeds quietly. If eslint fails, its output should clearly blamepackage.json
in the normal »this file has a linting error« format.What actually happened? Please include the actual, raw output from ESLint.
Crash.
The text was updated successfully, but these errors were encountered: