eslint-plugin-compat icon indicating copy to clipboard operation
eslint-plugin-compat copied to clipboard

feat: support flat config

Open nix6839 opened this issue 1 year ago • 1 comments

!! IMPORTANT !!

If user previously imported this package using ESM, import { configs, rules } from 'eslint-plugin-compat' will not work.

This is a BREAKING CHANGE, so need to increase a major version to release it.

If you agree to a major version upgrade, it would be good to also remove config.

If you don't want to make a BREAKING CHANGE, I can maintain compatibility by splitting the package entry point into .mts and .cts. (I had implemented it once, but the code was too complicated, so I deleted it for now: https://github.com/amilajack/eslint-plugin-compat/commit/686d75a45bc84c33071ca36b5efb497fd0143044)

Please feel free to let me know which method you prefer. :)

What's Changed

  • Support flat config (Thank you for being a reference, eslint-plugin-n!)
  • Bump dependencies
  • Fix test errors with update snapshots
  • Replace babel-eslint to @babel/eslint-parser (See: https://github.com/babel/babel-eslint#note-babel-eslint-is-now-babeleslint-parser-and-has-moved-into-the-babel-monorepo)
  • Deprecate named export
  • Provide type declaration

Resolves: #603

P.S. ESLint v9 has been released. IMO, it's a good time to drop support for versions below ESLint v8.57.0!

nix6839 avatar Dec 17 '23 03:12 nix6839

@amilajack now that eslint v9 is released, do you think merging this would be an option for you? :pray:

dargmuesli avatar Apr 12 '24 00:04 dargmuesli

Sorry for the delay here. I've published this as eslint-plugin-compat@next. Feel free to test, as I will as well.

amilajack avatar May 21 '24 08:05 amilajack

Thank you @amilajack! I tried 5.0.0-2 in a project of mine and it looks good.

@nix6839 I understand that this PR only adds flat config support. I still want to mention that with ESLint v9.3.0 I get the TypeError: context.getAncestors is not a function. Might be possible to fix this in this PR too as described under the link?

dargmuesli avatar May 22 '24 02:05 dargmuesli

@nix6839 I understand that this PR only adds flat config support. I still want to mention that with ESLint v9.3.0 I get the TypeError: context.getAncestors is not a function. Might be possible to fix this in this PR too as described under the link?

I think it's going to be a big task, so it should be worked on in a separate PR.

nix6839 avatar May 22 '24 04:05 nix6839

Might be possible to fix this in this PR too as described under the link?

@dargmuesli would you be interested in submitting a PR for this?

amilajack avatar May 22 '24 20:05 amilajack

would you be interested in submitting a PR for this?

Out of time right now. Depending on other work on this I might come back to it in the future. Other contributions are welcome.

dargmuesli avatar May 22 '24 21:05 dargmuesli