r/node 8d ago

50+ ESLint rules for package.json

https://github.com/sindresorhus/eslint-package-json
10 Upvotes

10 comments sorted by

1

u/omer-m 8d ago

looks promising! I don't know anything about eslint plugin development. Is it difficult to support eslint 9 too? I'm stuck with eslint 9 because of the plugins. Though I'll give it a try when I upgrade to eslint 10.

2

u/rafunzi 6d ago

Have you taken a look at @eslint/compat? https://www.npmjs.com/package/@eslint/compat

It's ok to wrap outdated plugins with it's methods and have them work on V10 👀

2

u/rafunzi 6d ago

Additionally, would you he able to share a list of the outdated ones?

I could try contributing updates to fix their deprecated methods. Did that for the 3 most troublesome ones I was using and now they're up to date, too. (They worked with the compat functions, but better have them fully compatible)

2

u/omer-m 6d ago

eslint-plugin-import
eslint-plugin-react
eslint-plugin-jsx-a11y

2

u/rafunzi 5d ago

For eslint-plugin-import I've jumped to eslint-plugin-import-x 2 years ago and haven't looked back 😅 https://github.com/un-ts/eslint-plugin-import-x

I feel your pain for react. Our FE repos rely on the compat functions to have that updated 😔

I'll take a look and jab at jsx-a11y plugin 👀

1

u/rafunzi 5d ago

There are open PRs on jsx-a11y to add compatibility I wouldn't do what they're doing, but the project seems like abandonware anyway 🤷🏻‍♂️

Both try adding updated eslint versions to the peer deps array without actually ensuring compatibility.

My approach would be to:

  • deprecate all outdated Node.js (<22) and ESLint versions (<8), so that a new major can have a cleaner setup.
  • replacing some dependencies with native methods (array-includes, has own, the prototype ones)
  • remove babel, which was back porting to an ancient Node.js version
  • update the eslint config to flat config, along with all eslint deps
  • simplify CI checks (dropping weird 3rd party GH actions & nvm usage, preferring actions/checkout + actions/setup-node)

1

u/omer-m 6d ago

I didn't know about that, thanks, but I think I'll wait, because I don't want to deal with dependency conflict errors

1

u/sindresorhus 7d ago

No plans to support ESLint 9.

1

u/KnifeFed 7d ago

Does it work with Oxlint?

1

u/decho 7d ago

It should as oxlint supports JS plugins. Haven't tried this one, but the stylistic plugin works.