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

New: Implement DotCompat class #20

Merged
merged 25 commits into from Feb 25, 2021
Merged

New: Implement DotCompat class #20

merged 25 commits into from Feb 25, 2021

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented Nov 24, 2020

This implements a new DotCompat class that translates between the ESLintRC-style configs and the new-style (which I'm now calling the "dot config" style). There are four main methods:

  • config() - translates an entire config
  • env() - translates only environments
  • extends() - translates only extends field
  • plugins() - loads plugins

I think I got all of the cases, but do let me know if it seems like I missed anything.

@nzakas nzakas added enhancement New feature or request accepted labels Nov 24, 2020
README.md Outdated Show resolved Hide resolved
lib/dot-compat.js Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
lib/dot-compat.js Outdated Show resolved Hide resolved
lib/dot-compat.js Outdated Show resolved Hide resolved
lib/dot-compat.js Outdated Show resolved Hide resolved
lib/dot-compat.js Outdated Show resolved Hide resolved
lib/dot-compat.js Outdated Show resolved Hide resolved
@nzakas
Copy link
Member Author

nzakas commented Dec 29, 2020

Just pushed a new version where the contents of files and ignores can be either strings or functions that accept an absolute path as their first argument. This makes the solution less pure than I had hoped it would be, but ultimately, this will give us complete backwards compatibility with ESLintRC.

Still one open comment I need to investigate regarding the languageOptions block.

lib/flat-compat.js Show resolved Hide resolved
lib/flat-compat.js Outdated Show resolved Hide resolved
lib/flat-compat.js Outdated Show resolved Hide resolved
lib/flat-compat.js Show resolved Hide resolved
lib/flat-compat.js Outdated Show resolved Hide resolved
lib/flat-compat.js Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
lib/flat-compat.js Outdated Show resolved Hide resolved
Copy link
Member

@btmills btmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old config system is complex, so there are probably edge cases that this doesn't handle yet. I'm satisfied that this is good enough to address the vast majority of use cases. We can let actual usage reveal what other cases, if any, this needs to handle.

@nzakas nzakas merged commit d9a527b into main Feb 25, 2021
@nzakas nzakas deleted the compat branch February 25, 2021 19:22
@dimitropoulos
Copy link

hey @nzakas is there anywhere (including source code) you could point me to that could tell me a little more about how this new "dot config" format works? I looked around for a bit but couldn't find much - my apologies if I missed something.

@nzakas
Copy link
Member Author

nzakas commented Mar 1, 2021

eslint/eslint#13481

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants