Giter Club home page Giter Club logo

Comments (5)

ota-meshi avatar ota-meshi commented on June 9, 2024 2

Thank you for sharing the repository. I looked it up.
It seems that the parser configured with eslint-config-next is being used.
As you did, if you put plugin: jsonc/recommended-with-jsoncat the end of extends will cause the .json file to select the json parser.
If you don't want to change the order of extends, you need to add parser settings.
https://ota-meshi.github.io/eslint-plugin-jsonc/user-guide/#parser-configuration

from eslint-plugin-jsonc.

thany avatar thany commented on June 9, 2024 1

It's not on github yet, I'll push it within a few days when I've set up some things.

from eslint-plugin-jsonc.

thany avatar thany commented on June 9, 2024 1

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.

from eslint-plugin-jsonc.

ota-meshi avatar ota-meshi commented on June 9, 2024

Thank you for posting issue.
I don't know the cause of your problem. Can you share your repository that can reproduce the problem?

from eslint-plugin-jsonc.

thany avatar thany commented on June 9, 2024

And here's a simplified reproduction repo:
https://github.com/thany/jsonc-error-repro

If I did it right, here's how to reproduce:

  1. Checkout the repo
  2. Run npm i on it
  3. Install eslint globally: npm i -g eslint
  4. Run it against the test.json: eslint test.json

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 next from the extend array makes the error go away. But I really need that one in there, because of the nature of the project.

Also when I move plugin:jsonc/recommended-with-jsonc to the end of the extend array, the error also goes away. But that too seems only a temporary workaround: let's say I wanted to include another plugin, which also needs to be last in the list. There can be only one last.

from eslint-plugin-jsonc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.