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

Implement Flat Config #13481

Open
54 of 69 tasks
nzakas opened this issue Jul 10, 2020 · 27 comments
Open
54 of 69 tasks

Implement Flat Config #13481

nzakas opened this issue Jul 10, 2020 · 27 comments
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion breaking This change is backwards-incompatible core Relates to ESLint's core APIs and features feature This change adds a new feature to ESLint

Comments

@nzakas
Copy link
Member

nzakas commented Jul 10, 2020

This issue describes the implementation plan for eslint/rfcs#9, which will take place in several phases:

Phase 1: Extract current config system

  • Create new GitHub repository (eslint/eslintrc)
  • Copyeslintrc source files and tests into new GitHub repository
  • Create Jenkins release job for @eslint/eslintrc
  • Publish @eslint/eslintrc to npm
  • Update ESLint to use @eslint/eslintrc
  • Remove in-memory filesystem from tests
  • Update CLIEngine to use CascadingConfigArrayFactory from @eslint/eslintrc

Phase 2: Implement flat config with eslintrc compatibility

Phase 3: Compatibility testing

Phase 4: General availability (v9.0.0)

  • Write blog post about flat config format
  • Output warning when people use eslintrc files
  • Switch documentation so eslint.config.js is the default and recommended format (link to legacy eslintrc docs from the same page)
  • Switch Linter to use flat config by default
  • Switch documentation for shareable configs to flat config format (links to legacy docs included)
  • Switch documentation for plugins to flat config format (links to legacy docs included)
  • Omiting any file/dir positional parameter to CLI does not give an error #14308
  • Rename ESLint class to LegacyESLint and rename FlatESLint to ESLint
  • Delete RuleTester class and rename FlatRuleTester to RuleTester
  • Update api.js to export new values for ESLint and RuleTester
  • Switch shouldUseFlatConfig() to return true except if ESLINT_USE_FLAT_CONFIG is false.
  • Release ESLint with GA flat config

Phase 5: Remove eslintrc (v10.0.0)

  • Remove old CLI flags
  • Remove context.parserPath, context.parserOptions, context.globals in Linter
  • Remove configType constructor option for Linter; throw error if found.
  • Report an error when eslint-env config comment is used
  • Remove eslintrc support
  • Remove eslintrc documentation
  • Delete FlatESLint class
  • Delete LegacyESLint class
  • Switch shouldUseFlatConfig() to always return true
  • Release ESLint without eslintrc 🎉
@nzakas nzakas added core Relates to ESLint's core APIs and features accepted There is consensus among the team that this change meets the criteria for inclusion breaking This change is backwards-incompatible feature This change adds a new feature to ESLint labels Jul 10, 2020
@nzakas nzakas self-assigned this Jul 10, 2020
@nzakas nzakas added this to Assigned in Public Roadmap Aug 8, 2020
@nzakas nzakas changed the title Simple Config Development Plan Implement Simple Config Aug 8, 2020
@nzakas nzakas moved this from Assigned to In Progress in Public Roadmap Aug 20, 2020
nzakas added a commit that referenced this issue Aug 21, 2020
* Chore: Mark config-related files (refs #13481)

* Fix lint errors

* Fix more linting errors
@nzakas
Copy link
Member Author

nzakas commented Aug 24, 2020

Update: Most of the CLIEngine tests are so tightly coupled to the existing file structure (overriding and stubbing require imports and then trying to use an in-memory file system) that there's just no way I can get all of the tests to pass. I suspect that the tests aren't actually testing what we think they are due to this complexity. It seems my only path forward is to leave the eslintrc functionality in place in the eslint repo and then make a copy in the eslintrc repo. We will just have to focus on removing the eslintrc functionality when we remove CLIEngine.

@nzakas
Copy link
Member Author

nzakas commented Aug 27, 2020

I'm going to make one more pass but using a physical file system instead of an in-memory filesystem to see if I can disentangle the tests. If that doesn't work, I'll do a more minimal extraction and move on.

@bradzacher
Copy link
Contributor

bradzacher commented Oct 31, 2022

I think it would be a good idea to include @typescript-eslint in the Phase 3 list.

IMO onboarding the project as early as possible is a hard requirement for the workstream. Without ts-eslint's onboarding the majority of ESLint users won't able to transition to flat configs without needing to use the compatibility tooling.

For reference - by weekly download volume @typescript-eslint/eslint-plugin users make up over 65% of ESLint users and @typescript-eslint/parser users make up over 70% of ESLint's users.
(plugin = 19.2m / parser = 21m / eslint = 28.8m)

It would be a real shame if most users' first experience with new config system involves reaching for the compatibility APIs. Making sure that doesn't happen should be a top priority!

Feel free to chat with us (cc @JoshuaKGoldberg and @JamesHenry)!


Separately but very related to the above - I'd also suggest including eslint-plugin-import for the same reasons given that it is similar in size (17.1m - ~60%).

@kirill-konshin
Copy link

Could not agree more @bradzacher. The success of tools like Next.js, Jest, Prettier and even Create React App proves that many users want simple tools, they need fast onboarding and prefer opinionated presets.

It's great to have a configurable tool, but for majority of users thousands of options are overwhelming. People simply do not have time to dig into nuances, they need a solution.

In my opinion, ESLint should provide some dead easy way to kick off a fresh project with all necessary dependencies. Something like npm install eslint && eslint init recommended. Look at the guide https://eslint.org/docs/latest/user-guide/getting-started and https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new — and imagine what most users think while reading this...

@nzakas
Copy link
Member Author

nzakas commented Nov 1, 2022

@bradzacher will do. The intent is to use phase 3 to test the ecosystem in general.

@kirill-konshin this is off topic for this issue, but you can use npm init @eslint/config. It’s listed right on eslint.org. 😄

@Shinigami92
Copy link
Contributor

Thanks a lot to @sxzz since eslint-define-config v1.8.0 Flat ESLint Config is officially supported by my plugin 🚀

@mahnunchik
Copy link

Any news?

@nzakas
Copy link
Member Author

nzakas commented Nov 23, 2022

@mahnunchik you can look at the checklist in the original comment to see the current progress.

@karlhorky
Copy link
Contributor

  • Work with eslint-plugin-react to switch configs to new format and ensure it works correctly

@nzakas now that the new config format has been added in jsx-eslint/eslint-plugin-react#3429, should this checkbox in Phase 3 be checked?

@ljharb
Copy link
Sponsor Contributor

ljharb commented Jan 11, 2023

eslint-plugin-react v7.32.0 has been released, with flat config support - but only less than 12 hours ago. It's probably wise to wait a bit longer to make sure it actually does work correctly :-)

@CallMeLaNN

This comment was marked as off-topic.

@nzakas
Copy link
Member Author

nzakas commented Feb 10, 2023

This is a tracking issue and not the best place to ask for help. Please open a discussion instead.

@CallMeLaNN
Copy link

This is a tracking issue and not the best place to ask for help. Please open a discussion instead.

My intention was to get a chance to help or send PR for some plugins since I already study the code of the flat configs on both Eslint and some plugins. It could be the way to start contribute to the community on the phase 3.

Anyway, in that case, you may update somewhere about the concern above whenever Eslint team is ready.

@nzakas
Copy link
Member Author

nzakas commented Feb 13, 2023

@CallMeLaNN that's great, we'd appreciate the help...but this is still not the right place for that type of question. Happy to continue in a separate discussion.

@homersimpsons

This comment was marked as off-topic.

@mdjermanovic

This comment was marked as off-topic.

@nzakas
Copy link
Member Author

nzakas commented Mar 14, 2023

Folks - if you have questions about flat config, please open a discussion rather than commenting here. This issue is for tracking purposes only.

@eslint eslint locked as off-topic and limited conversation to collaborators Mar 14, 2023
@mdjermanovic
Copy link
Member

  • Remove context.parserPath, context.parserOptions, context.globals in Linter

Does context.globals exist?

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 breaking This change is backwards-incompatible core Relates to ESLint's core APIs and features feature This change adds a new feature to ESLint
Projects
Public Roadmap
  
In Progress
Status: Implementing
Status: Done
Triage
Pull Request Opened
Development

No branches or pull requests