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

Change Request: document flat configs in plugins #17242

Closed
1 task
paulius-valiunas opened this issue Jun 6, 2023 · 2 comments · Fixed by #17640
Closed
1 task

Change Request: document flat configs in plugins #17242

paulius-valiunas opened this issue Jun 6, 2023 · 2 comments · Fixed by #17640
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation enhancement This change enhances an existing feature of ESLint

Comments

@paulius-valiunas
Copy link

ESLint version

8.42.0

What problem do you want to solve?

Current documentation page on writing plugins uses legacy configs

What do you think is the correct solution?

It should provide a useful example of how a flat config can be included in a plugin without circular imports.

Participation

  • I am willing to submit a pull request for this change.

Additional comments

No response

@paulius-valiunas paulius-valiunas added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint labels Jun 6, 2023
@Rec0iL99
Copy link
Member

Rec0iL99 commented Jun 6, 2023

Hi @paulius-valiunas, this is indeed included in our phase 4 of implementing flat config.

You can track the implementation here #13481,

@Rec0iL99 Rec0iL99 closed this as completed Jun 6, 2023
@Rec0iL99 Rec0iL99 reopened this Jun 6, 2023
@nzakas nzakas added the accepted There is consensus among the team that this change meets the criteria for inclusion label Jun 26, 2023
@nzakas nzakas added documentation Relates to ESLint's documentation and removed core Relates to ESLint's core APIs and features labels Jul 24, 2023
@bradzacher
Copy link
Contributor

Copying from #17391

Currently there is no information in the docs about how a plugin might migrate to support flat configs.

For example - one would need to migrate shared configs to the new format - but what does that look like? I know that the plugins key needs to change its form - but the existing docs still use the old form.

How should a plugin go about supporting both flat and classic configs? What's the best-practice for doing this?
For example eslint-plugin-react exports configs from the package root in the classic form, and provides imports for each config in the flat form (require('eslint-plugin-react/configs/recommended')). Is this the "best practice" way of doing it? Is there another way?

What about things like languageOptions - how can you support both languageOptions and parserOptions?

Based on my understanding - the configs will be validated for excess props - so plugins will need to duplicate the configs if they want to do things like extend other configs or provide parserOptions/languageOptions/parser.

Is there tooling to do this automatically so that plugins don't have to all implement the same copy pasted logic of "extend the classic config and rename somethings"?

I guess what I'm saying is that the user story for flat configs is well documented and planned out - but it feels like the developer story is lacking right now which makes it hard for plugins to build support.

We on @typescript-eslint have users asking for it and they're not sure how to use our plugin with the new config file. Currently our response is "use the compat tooling because we don't support it".
Without clear guidance and best practices around how we are supposed to support both worlds in a fully backwards compatible way - we don't want to take the step lest we do it wrong and have to release a new major version to undo/fixup a change.

I'm sure a lot of other plugins and community configs are in exactly the same boat.
Whether we like it or not - legacy config files are going to live on for a long time - even when ESLint drops official support for them, so the ecosystem needs solid plans and tools to continue supporting them into the future.

@nzakas nzakas self-assigned this Oct 10, 2023
nzakas added a commit that referenced this issue Oct 10, 2023
nzakas added a commit that referenced this issue Oct 16, 2023
* docs: Plugin flat config migration guide

Fixes #17242

* Switch exports to default

* Update docs/src/extend/plugin-migration-flat-config.md

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Meta information

* CommonJS syntax

* Backwards compatibility

* Update docs/src/extend/plugin-migration-flat-config.md

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

---------

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Apr 14, 2024
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Apr 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation enhancement This change enhances an existing feature of ESLint
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants