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
9 of 37 tasks
nzakas opened this issue Jul 10, 2020 · 8 comments
Open
9 of 37 tasks

Implement Flat Config #13481

nzakas opened this issue Jul 10, 2020 · 8 comments

Comments

@nzakas
Copy link
Member

@nzakas 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 simple config with eslintrc compatibility

  • Create the FlatCompat class in eslint/eslintrc repository
  • Create FlatConfigArray to represent simple configs
  • Update ESLint class to search for eslint.config.js files and fallback to eslintrc system
  • Rename useESLintRC option to ESLint as useConfigFile (still keep useESLintRC for backwards compatibility)
  • Update Linter class to understand new config format and provide context.parser in addition to context.parserPath.
  • Update Linter class to ignore eslint-env comments
  • Ensure invalid CLI flags cause errors when using flat config (for example, --resolve-plugins-relative-to)
  • Switch eslint/eslint repo to use flat config
  • Create --no-config-file as equivalent to no-eslintrc
  • Document flat config
  • Release ESLint 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 ESLintRCCompat
  • 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 in Linter
  • Throw error when eslint-env config comment is used
  • Remove eslintrc support
  • Remove eslintrc documentation
  • Release ESLint without eslintrc 🎉
@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 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 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 added a commit that referenced this issue Aug 24, 2020
kaicataldo pushed a commit that referenced this issue Aug 26, 2020
@nzakas
Copy link
Member Author

@nzakas 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 Sep 22, 2020
mdjermanovic pushed a commit that referenced this issue Oct 9, 2020
* Chore: Refactor CLIEngine tests (refs #13481)

* A bit of cleanup

* Address review comments

* Fix incomplete fixture cleanup

* Only remove config file if present
@valtlai
Copy link

@valtlai valtlai commented Mar 1, 2021

Could eslint.config.cjs be supported too? This way "type": "module" can be used in package.json even though ESLint doesn’t support loading an ECMAScript module as a config file.

@nzakas
Copy link
Member Author

@nzakas nzakas commented Mar 1, 2021

@valtlai please open a separate issue for that request. This issue is just for tracking implementation of the RFC. Thanks.

@valtlai
Copy link

@valtlai valtlai commented Mar 3, 2021

@valtlai please open a separate issue for that request. This issue is just for tracking implementation of the RFC. Thanks.

Done, that’s issue #14170.

mdjermanovic pushed a commit that referenced this issue Jun 26, 2021
* Update: Implement FlatConfigArray (refs #13481)

* Upgrade config-array package

* Add schemas for linterOptions, processor, plugins

* Continue implementing config schemas

* RulesSchema start

* Add initial finalization step

* Default config

* Strict mode

* Start rule validation

* Finish FlatConfigArray implementation

* Remove too-new syntax

* Fix default config

* fix test

* Update tests/lib/config/flat-config-array.js

Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>

* Update tests/lib/config/flat-config-array.js

Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>

* Update tests/lib/config/flat-config-array.js

Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>

* Update tests/lib/config/flat-config-array.js

Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>

* Update tests

* fix test

* Allow old-style plugin names

* Fix reportUnusedDisableDirectives and add JSDoc

* Add more tests

* address review comments

* Ignore only .git directory

* Allow null for global settings

* writeable -> writable

* Remove incorrect comment

* Validate severity-only rule options

* Add key to global error message

* deeply merge parserOptions and settings

* Rename defaultResultConfig

* Normalize and fix rule validations

* Fix rule options merging

* Fix various errors

* Rebase onto master

Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Public Roadmap
  
In Progress
Triage
Pull Request Opened
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants