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
36 of 58 tasks
nzakas opened this issue Jul 10, 2020 · 17 comments
Open
36 of 58 tasks

Implement Flat Config #13481

nzakas opened this issue Jul 10, 2020 · 17 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

  • Work with eslint-config-airbnb to switch to new format and ensure it works correctly
  • Work with eslint-config-standard to switch to new format and ensure it works correctly
  • Work with eslint-plugin-node to switch configs to new format and ensure it works correctly
  • Work with eslint-plugin-vue to switch configs to new format and ensure it works correctly
  • Work with eslint-plugin-react to switch configs to new format and ensure it works correctly
  • Switch ESLint config to load external configs/plugins without FlatCompat
  • Release ESLint with extended compatibility

Phase 4: General availability

  • 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 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)
  • Release ESLint with GA flat config

Phase 5: Remove eslintrc

  • Remove old CLI flags
  • Remove context.parserPath, context.parserOptions, context.globals in Linter
  • Throw error when eslint-env config comment is used
  • Remove eslintrc support
  • Remove eslintrc documentation
  • Delete ESLint class and rename FlatESLint to ESLint
  • Delete RuleTester class and rename FlatRuleTester to RuleTester
  • 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.

nzakas added a commit that referenced this issue Jul 19, 2022
nzakas added a commit that referenced this issue Jul 21, 2022
btmills added a commit that referenced this issue Aug 1, 2022
* New: FlatESLint class (refs #13481)

* More stuff working in isPathIgnored

* Fix more isPathIgnored() tests

* isPathIgnored is working

* loadFormatter works

* Most methods working

* Linter mostly working with FlatConfigArray

* Fix FlatConfigArray

* Initial Linter + FlatConfigArray tests passing

* FlatESLint lintText almost working

* More stuff working

* Make lintText() tests work

* Start work on lintFiles()

* More tests working

* Refactor

* Refactor findFiles()

* Fix error messages when no files found

* Fix some ignore file errors

* More tests working

* More tests passing

* Fix multiple processor tests

* Finish processors tests

* Fix more tests

* Fix more tests

* Fix some processor autofixing tests

* Tests for default ignore patterns passing

* More ignore tests fixed

* isPathIgnored() tests passing

* More tests passing

* Fix more tests

* More tests passing

* Fix globbing tests

* Fix more tests

* Fix ignores tests

* Enable more tests

* Constructor tests passing

* lintText tests passing

* more tests passing

* More tests passing

* Make fixtypes tests pass

* Add fatalErrorCount to ignore results

* Fix outputFixes tests

* Add FlatESLint to use-at-your-own-risk

* Disable cache option

* Fix lint errors

* Fix Node.js 12 compatibility

* Fix more tests

* fs/promises -> fs.promises

* Catch when no matching config found

* Rebase and fix lint errors

* Expose FlatRuleTester

* eslint-plugin-node -> eslint-plugin-n

* Fix unit test errors

* Make test pass in Node.js 12

* docs: Document flat config files

* Fix lint errors

* Fix default ignores

Co-authored-by: Brandon Mills <mills.brandont@gmail.com>
nzakas added a commit that referenced this issue Aug 10, 2022
btmills pushed a commit that referenced this issue Aug 14, 2022
nzakas added a commit that referenced this issue Aug 18, 2022
nzakas added a commit that referenced this issue Aug 19, 2022
nzakas added a commit that referenced this issue Aug 22, 2022
nzakas added a commit that referenced this issue Aug 23, 2022
nzakas added a commit that referenced this issue Aug 23, 2022
mdjermanovic pushed a commit that referenced this issue Aug 26, 2022
* feat: Enable eslint.config.js lookup from CLI

Refs #13481

* Switch to eslint.config.js

* Fix lint errors

* Restore .eslintrc.js

* Add warning to .eslintrc.js file

* Add suppressed messages

* Add suppressedMessages checks in tests

* Remove v8-compile-cache

* Fix CLI test

* Update comments in config files

* Remove --ext option

* Fix options tests

* Try to fix Windows errors

* Try to fix Windows tests again

* Try again to fix Windows errors

* Fix windows tests again
nzakas added a commit that referenced this issue Sep 5, 2022
@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

kirill-konshin commented Oct 31, 2022

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

Shinigami92 commented Nov 1, 2022

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

@mahnunchik
Copy link

mahnunchik commented Nov 17, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Triage
Pull Request Opened
Development

No branches or pull requests

7 participants