redwoodjs / redwood

The App Framework for Startups
https://redwoodjs.com
MIT License
17.18k stars 984 forks source link

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

Open JoshuaKGoldberg opened 3 months ago

JoshuaKGoldberg commented 3 months ago

What's not working?

👋 Coming over from https://github.com/eslint/eslint/issues/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 https://github.com/eslint/eslint/issues/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?

ahaywood commented 3 months ago

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

JoshuaKGoldberg commented 3 months ago

Awesome, thanks @ahaywood!

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

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.