JoshuaKGoldberg / eslint-plugin-package-json

Rules for consistent, readable, and valid package.json files. 🗂️
MIT License
124 stars 22 forks source link

🛠 Tooling: replace `jsonc-eslint-parser` with `@eslint/json` #655

Open rakleed opened 3 days ago

rakleed commented 3 days ago

Bug Report Checklist

Overview

As suggested in https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/601#issuecomment-2454704112, I am creating a separate issue to discuss replacing jsonc-eslint-parser dependency with @eslint/json.

@eslint/json is smaller and uses fewer dependencies than jsonc-eslint-parser. The announcement post also says that it can be used as a parser for other plugins.

The main problem is that the plugin only works since version 9.6.0 of ESLint, and you can use only a flat config. So you will have to stop supporting eslint@8, but now it still has more weekly downloads than eslint@9.

Additional Info

No response

JoshuaKGoldberg commented 3 days ago

Yeah 😞. As much as I'd love to use the new first-party package, I don't think it's time yet to drop support for ESLint 8. Once other popular plugins start to drop support then I think we can mark this as unblocked.

Thanks for filing!

ota-meshi commented 3 days ago

Hi there. I've created an experimental tool that converts jsonc-eslint-parser AST processing rules/plugins to be used with @eslint/json. https://www.npmjs.com/package/eslint-json-compat-utils Try it out if you want to use eslint-plugin-package-json and @eslint/json together now.

You can find a working example online here.

JoshuaKGoldberg commented 2 days ago

That's fantastic, thanks @ota-meshi! Marking as accepting PRs to switch this package to using the compat utils.

Note that doing so is probably not a trivial change. It'll probably touch most or all of the rules in the plugin.

JoshuaKGoldberg commented 2 days ago

@all-contributors please add @rakleed for tool.

🤖 Beep boop! This comment was added automatically by all-contributors-auto-action. Not all contributions can be detected from Git & GitHub alone. Please comment any missing contribution types this bot missed. ...and of course, thank you for contributing! 💙

allcontributors[bot] commented 2 days ago

@JoshuaKGoldberg

I've put up a pull request to add @rakleed! :tada: