-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Cannot parse or format JSON files in VScode, or CLI #154
Comments
Thank you for posting issue. |
It's not on github yet, I'll push it within a few days when I've set up some things. |
And here's a simplified reproduction repo: If I did it right, here's how to reproduce:
Unfortunately, Next.js's built-in lint command doesn't test that file. Don't know why, and it doesn't matter. But that the only reason you'll need eslint available as a CLI command. I did some further testing myself, and it seems removing Also when I move |
Thank you for sharing the repository. I looked it up. |
Thanks for looking into it. I think I'd rather add parser configuration. Messing with plugin order theoretically shouldn't matter, but in practice it sometimes does matter. It might be helpful for future users to add a paragraph about Next.js to the documentation describing how to prevent this issue. |
So I've done the following:
1. Install the package:
2. Added only to the
extends
section in my.eslintrc.json
, like so:I did not configure anything else there. Just this!
And yes, it's a Next.js project. Shouldn't matter, but there you go.
3. Added the following configuration to my workspace settings: (in
./.vscode/settings.json
)And restarted VSCode.
(It doesn't actually matter where (workspace/user settings) or if at all this is added, as you'll see further on. It'll break on the commandline before anything else, so I might as well leave this whole step out, frankly. I'm going to leave it in for completeness though.)
4. Time to test it out!
So I've added a dead simple file, called
test.json
:Results
On the commandline
First I installed eslint globally:
When executing
eslint test.json
I get the following error:Semicolons in JSON 🤨 It doesn't feel quite right to me...
In VSCode
Opening that marvellously simple test file again, I get the same error on the problems panel.
When pressing Ctrl+S, I get a message on the status bar that says:
This makes sense given that ESLint cannot even seem to parse a super simple json file... If it can't parse them properly, how could it ever format them, right?
What's going on? It's probably some stupid setting or a tiny little thing I've missed, because I can't believe this package being utterly broken. It doesn't feel like that kind of package 😊 It feels professional 😎 So maybe something is borking things up 🤔
The text was updated successfully, but these errors were encountered: