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

feat: auto detect the eslint.config.js file to enable flat config support #2596

Merged
merged 6 commits into from
May 11, 2023
Merged

Conversation

sxyazi
Copy link
Contributor

@sxyazi sxyazi commented May 8, 2023

eslint/eslint@7162d34

ESLint's new config system is complete, this PR offers auto-detecting of the new config file in the project root, then set the experimental.useFlatConfig = true to enable it automatedly.

@sxyazi sxyazi requested a review from glepnir May 10, 2023 08:16
@sxyazi sxyazi requested a review from glepnir May 10, 2023 08:44
@glepnir
Copy link
Member

glepnir commented May 10, 2023

Check out the documentation. This new configuration system defaults to false. It uses file and environment variables to control whether it is enabled. The environment variable ESLINT_USE_FLAT_CONFIG has higher priority. So shouldn't it be up to the user to control whether to enable or not. It should exist in the local configuration file. So I don't think it is necessary to add a check for this file by default right?

@sxyazi
Copy link
Contributor Author

sxyazi commented May 10, 2023

The ESLINT_USE_FLAT_CONFIG environment variable exists only in ESLint, but it is ESLint LSP, i.e. vscode-eslint.

AFAIK, it can only be turned on by setting experimental.useFlatConfig = true, there is no configuration file or environment variable available.

@polyzen
Copy link
Contributor

polyzen commented May 10, 2023

ESLint itself uses eslint.config.js by default now if it's found.

Also for reference:
microsoft/vscode-eslint#1644

@sxyazi sxyazi requested a review from glepnir May 11, 2023 11:31
@sxyazi
Copy link
Contributor Author

sxyazi commented May 11, 2023

@glepnir
Copy link
Member

glepnir commented May 11, 2023

util.path has a santize function it will check is windows or not then convert \\ to /

@sxyazi
Copy link
Contributor Author

sxyazi commented May 11, 2023

The two lines above don't seem to call the sanitize, can you point out where it is? IMO Windows should also support /

@glepnir
Copy link
Member

glepnir commented May 11, 2023

long time no used windows check wiki https://en.wikipedia.org/wiki/Path_(computing) looks like windows also accept the '/' so maybe just path_join is enough

@sxyazi
Copy link
Contributor Author

sxyazi commented May 11, 2023

Yeah, that's what I'm trying to say! I will revert the commit just made then.

@glepnir glepnir merged commit 1c0e6d3 into neovim:master May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants