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

[Feature]: ESLint flat config support for @redwoodjs/eslint-config #10897

Open
1 task
Tracked by #18093
JoshuaKGoldberg opened this issue Jul 1, 2024 · 2 comments
Open
1 task
Tracked by #18093

Comments

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Jul 1, 2024

What's not working?

👋 Coming over from eslint/eslint#18093: ESLint is migrating to a new "flat config" format that will be the default in ESLint v9.

It doesn't look like @redwoodjs/eslint-config has support yet. I'm posting this issue here as a reference & cross-linking it to the table in eslint/eslint#18093. If there's anything technical blocking the extension from supporting flat configs, please let us know - we'd be happy to try to help! 💜

Additional resources:

How do we reproduce the bug?

  1. npm i @redwoodjs/eslint-config eslint -D
  2. Create an eslint.config.js with... well, there's no actual exported config from @redwoodjs/eslint-config to use there!

Just for fun, I tried out:

import redwood from '@redwoodjs/eslint-config'

export default [redwood]

...but npx eslint fails on that with:

Oops! Something went wrong! :(

ESLint: 8.57.0

A config object is using the "extends" key, which is not supported in flat config system.

Instead of "extends", you can include config objects that you'd like to extend from directly in the flat config array.

Please see the following page for more information:
https://eslint.org/docs/latest/use/configure/migration-guide#predefined-and-shareable-configs

What's your environment? (If it applies)

System:
    OS: macOS 13.2
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 20.11.0 - /var/folders/sr/j__6_9gn0dv557z0xf3p7y8h0000gn/T/yarn--1719857847260-0.8362240404148904/node
    Yarn: 1.22.19 - /var/folders/sr/j__6_9gn0dv557z0xf3p7y8h0000gn/T/yarn--1719857847260-0.8362240404148904/yarn

Are you interested in working on this?

  • I'm interested in working on this
@JoshuaKGoldberg JoshuaKGoldberg added the bug/needs-info More information is needed for reproduction label Jul 1, 2024
@Tobbe Tobbe added topic/fully-integrated-dx and removed bug/needs-info More information is needed for reproduction labels Jul 1, 2024
@ahaywood
Copy link
Contributor

ahaywood commented Jul 1, 2024

😎 Thanks for filing @JoshuaKGoldberg !! ... I think you've been working with @Tobbe on this already? Anything else you need from us?

@JoshuaKGoldberg
Copy link
Contributor Author

JoshuaKGoldberg commented Jul 4, 2024

Awesome, thanks @ahaywood!

Digging into the code, it looks like there are two things we could mean by "flat config support":

  • 🍎 @redwoodjs/eslint-config: switching it to use the flat config format
  • 🍌 @redwoodjs/eslint-plugin: getting it to export plugin metadata

The 🍎 config would be a lot more work, as it's got a lot of dependencies & listings that'd need to switch. I don't think I'm well-positioned as a first-time external contributor to do that.

But the 🍌 I'd be happy to. It's common for ESLint plugins to also export a "recommended" ruleset - doing that here would be a happy point. So if you don't mind, I just renamed this issue, will file a new one for the plugin, & can work on that now.

@JoshuaKGoldberg JoshuaKGoldberg changed the title [Feature]: ESLint flat config support [Feature]: ESLint flat config support for @redwoodjs/eslint-plugin Jul 4, 2024
@JoshuaKGoldberg JoshuaKGoldberg changed the title [Feature]: ESLint flat config support for @redwoodjs/eslint-plugin [Feature]: ESLint flat config support for @redwoodjs/eslint-config Jul 4, 2024
Josh-Walker-GM added a commit that referenced this issue Aug 13, 2024
This applies two internal tooling updates:

* Bumps typescript-eslint to its beta v8:
https://typescript-eslint.io/blog/announcing-typescript-eslint-v8-beta
* Enables typescript-eslint's [shared `stylistic`
config](https://typescript-eslint.io/users/configs#stylistic) for
internal code (not `eslint-config`)

Any changes (will be) commented inline. This also doesn't tackle three
good followups:

* Rules with many existing reports I kept disabled under a `TODO:`
comment in `.eslintrc.js`
* A reasonable next step for the project would be to look through those
and decide which should be fixed up.
* This doesn't enable [typed
linting](https://typescript-eslint.io/getting-started/typed-linting)
internally
  * Would definitely recommend next!
* Onboarding to ESLint's flat config
  * Blocked on #10897 

**There should be no user-facing functional changes**. It should just be
cleanups.

⚠️ This isn't ready for merge, as it uses `rc-v8` versions of
`typescript-eslint`. Just posting as a reference prior to v8 going
stable.
* Once v8 is stable, I can update this to use the released version.
* Alternately, if you'd like these changes sooner, I can make a version
of this that doesn't update to `rc-v8` - it'll just have slightly fewer
changes...

This PR came out of a casual conversation with @Tobbe. I'm happy to file
an issue / make a more formal internal tooling request if you'd prefer.
❤️

---------

Co-authored-by: Tobbe Lundberg <[email protected]>
Co-authored-by: Josh GM Walker <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants