Skip to content
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

Support ESLint v9 (including Flat Config) #122

Open
FloEdelmann opened this issue Mar 19, 2024 · 16 comments
Open

Support ESLint v9 (including Flat Config) #122

FloEdelmann opened this issue Mar 19, 2024 · 16 comments

Comments

@FloEdelmann
Copy link

FloEdelmann commented Mar 19, 2024

ESLint v8 already supports the new "flat" configuration format and in ESLint v9, it will become the default. It will still be possible to use this plugin then, but it'll require a legacy wrapper. It would be nice if this plugin could add native support for flat config.

Some helpful links:


EDIT: ESLint v9 has been released now.

@FloEdelmann FloEdelmann changed the title Support Flat Config Support ESLint v9 (including Flat Config) Apr 8, 2024
@jamiehaywood
Copy link

so the workaround config for ESLint 9 is to create an object in your flat config:

import jestFormatting from 'eslint-plugin-jest-formatting'

export default [
...
  {
    files: jestFormatting.configs.recommended.overrides[0].files,
    rules: jestFormatting.configs.recommended.overrides[0].rules,
    plugins: {
      "jest-formatting": jestFormatting,
    },
  }
]

@jamiehaywood
Copy link

jamiehaywood commented Apr 9, 2024

I'm thinking a good example for supporting flat config is eslint-plugin-jest.

They have a createFlatConfig and add a flat/ appendix to the exports containing flat config.

I'll raise a draft PR over the next couple of weeks to sketch out backward compatible flat config support

@G-Rath
Copy link

G-Rath commented Apr 19, 2024

Core maintainer of eslint-plugin-jest here 👋

I personally really like this plugin and want to make sure it's well supported - it doesn't look like there's been activity though in 2 years.

I technically don't have the authority to do this but I'm pretty sure @SimenB wouldn't object to having ownership of this plugin transferred to @jest-community to sit alongside eslint-plugin-jest and allow myself and others to help with the maintenance if that's something @dangreenisrael would be interested in.

Personally I'm also happy to have these rules live directly in eslint-plugin-jest though there might be a strong technical reason for why that shouldn't happen.

I'm also happy to help with the ESLint v9 support - @jamiehaywood let me know if you're still interested in doing that, have questions, etc; otherwise I can also pick it up if you're too busy.

@jamiehaywood
Copy link

jamiehaywood commented Apr 23, 2024

hi @G-Rath! thanks for tagging me. Would be keen to raise a PR add ESLint 9 support - couple of questions:

  1. Would v9 support PR come before or after migration into eslint-plugin-jest?
  2. Has there been a reconsideration of this comment by @SimenB a couple of years ago? As I believe this is the reason that eslint-plugin-jest-formatting became its own plugin in the first place.

@benkimpel
Copy link
Collaborator

I'm not sure of @dangreenisrael's status, but I can merge PRs if I have another reviewer approval. What I can't do is a release to npm.

@hockeybuggy or @ryanwilsonperkin I know you work/worked with Dan. Do you know his status?

@G-Rath @jamiehaywood I'd be happy to review and merge if you want to take a chance that it might not make it to npm. We can do this while the ownership/maintenance discussions play out.

@hockeybuggy
Copy link
Collaborator

I know you work/worked with Dan. Do you know his status?

Alive but a father of young children (child?) so I think his availability has been (reasonably) limited. I'll try to track him down so we can figure out publishing and ownership/maintenance.

Feel free to tag me for a second reviewer. I am glad that people have found some utility here.

@benkimpel
Copy link
Collaborator

Alive

Phew! Glad to hear it.

@dangreenisrael
Copy link
Owner

I'm alive 🎉. I've heads down at a new job for the last few monhts.

@dangreenisrael
Copy link
Owner

If @benkimpel can merge it, I can get it onto NPM.

@dangreenisrael
Copy link
Owner

Has there been a reconsideration of jest-community/eslint-plugin-jest#17 (comment) by @SimenB a couple of years ago? As I believe this is the reason that eslint-plugin-jest-formatting became its own plugin in the first place.

I haven't heard anything from him.

@G-Rath
Copy link

G-Rath commented Apr 23, 2024

@dangreenisrael glad to hear you're alive, and congrats (I hope 😄) on the new job!

Would v9 support PR come before or after migration into eslint-plugin-jest?

The order of operations shouldn't matter, so I say go for it.

I haven't heard anything from him.

I'll see if I can grab @SimenB for a chat, though it might take awhile so I would continue as you were in the meantime.

fwiw if this plugin does move the community, it would be ideal to switch to using GitHub Actions for CI (so that its one less SaaS to manage) and to use semantic-release for automatically releasing (so we don't need direct access to the package on npm) - both are things we use in the other eslint plugins and that I'd be happy to help setup if you're happy to switch to them now.

@benkimpel
Copy link
Collaborator

benkimpel commented Apr 23, 2024

fwiw if this plugin does move the community, it would be ideal to switch to using GitHub Actions for CI (so that its one less SaaS to manage) and to use semantic-release for automatically releasing (so we don't need direct access to the package on npm) - both are things we use in the other eslint plugins and that I'd be happy to help setup if you're happy to switch to them now.

I think that'd be fine as it would make it easier for contributors to other eslint packages to be more comfortable in this one, whether it moves into the community or not.

@SimenB
Copy link

SimenB commented Apr 25, 2024

Hello! Sorry about the slow reply.

Has there been a reconsideration of this comment by @SimenB a couple of years ago? As I believe this is the reason that eslint-plugin-jest-formatting became its own plugin in the first place.

I've softened my stance on this - happy to have the rules be part of the "core" plugin 👍 I think the publishing and testing infra we have in that repo (and the wonderful maintenance work by @G-Rath 🙏) have reduced the vague worries I had about bloat slowing us down or stopping us from making changes. It's been very stable for a long time, so happy to expand the scope if the maintainers here are willing to donate. 🙂

@G-Rath
Copy link

G-Rath commented Apr 25, 2024

Awesome! I've opened jest-community/eslint-plugin-jest#1563 porting the rules over if @dangreenisrael is happy for that to happen - there's still a bit of refactoring that can happen (including switching to using parseJestFnCall) but should be good for review.

@lasersio2
Copy link

I am also interested in flat config for this rule.

@dangreenisrael or @hockeybuggy can you, please, review ownership question from the PR above? jest-community/eslint-plugin-jest#1563 Thanks!

@G-Rath
Copy link

G-Rath commented Aug 9, 2024

We've shipped the formatting rules in https://github.com/jest-community/eslint-plugin-jest/releases/tag/v28.8.0 - I will release a follow-up version in the next couple of days that adds an official formatting config too assuming no one reports any issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants