-
Notifications
You must be signed in to change notification settings - Fork 336
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
any plan for support eslint new config file eslint.config.js
?
#1518
Comments
eslint.config.js
eslint.config.js
?
It should be support in the sense that the config file is read correctly. The only thing that is missing is the watching of that new config file. |
Actually, you are right. To use the new config files new API classes are to be used :-(. This is more effort. |
@dbaeumer do we have any estimates to release it? Asking you because it's not a new feature, it's a kind of compatibility with existing eslint (experimental, yep) functionality. |
Somewhen in the next weeks. |
Hello, may I kindly ask for the release of this? We are very eagerly waiting for this. 🥺 If anythig blocks the release, I may be able to help. |
Nothing is blocking it except time :-) |
If you want you can help me sanity check: Download the zip and rename it to |
Thank you! I tested it with our project and found a problem; it doesn't check |
OK. Great. Let me know the outcome! |
@dbaeumer Hi, so it turned that the current approach for detecting custom parsers based on The reason is that in // old config format
parser: "@typescript-eslint/parser"
// new config format
import typescriptEslintParser from "@typescript-eslint/parser";
parser: typescriptEslintParser So it is now hard for the extension to know what exact parser is used for a file.
What do you think? 🥲 |
@uhyo this doesn't sound good.
we have been there and the feedback was bad since users expected that the extension works out of the box.
Always try to lint a file type even if no parser exists results in bad experiences as well. I tried this before introducing the detection but may think have changed. Have you looked whether there is API on the ESLint instance to get some sort of config that list these parsers? If not, we could talk to the ESLint people to provide such an API since we have this information in the configuration object. Can you setup an example GitHub repository with a custom parser? Then I can have a look as well. |
Here's an example setup with new config format and custom parser: https://github.com/uhyo/vscode-eslint/tree/flat-config-ts/playgrounds/flatConfig
There does exist one, but we can no longer retrieve the name of parser, but only the parser object. So what we could do is: // Current approach (rough sketch)
eslintConfig.parser === "@typescript-eslint/parser"
// New approach (rough sketch)
eslintConfig.parser === require('@typescript-eslint/parser') With the current ESLint API, the above seems the only possible way. I'm not sure whether this is the right way to go... |
After a lot of documentation reading, I found an easy fix for this. The key is this section: https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#specifying-files-and-ignores Basically the new flat config will not validate files (except If no configuration section is in the flat config then This was different with the old configuration mechanism where the See branch dbaeumer/fresh-wildebeest-lavender |
Here is a zip that can be used for another sanity check |
@uhyo let me know how it goes |
@dbaeumer Genius, this works perfectly! In addition to the example setup, I tested with our actual project and there is no problem. Thank you for your work. |
One minor tweak I did as well is to rename the setting to experimental.useFlatConfig` |
Just wondering if the plan is for this feature to ship with 2.3.0? |
Yes, that is the plan. |
When is 2.3.0 planned for release? |
@2.3.0 will be a pre-release which I will release this week. |
@dbaeumer Hello, thank you for the 2.3.0 release -- but I noticed that the config name has been reverted in the released version. 😢 |
Let me check. |
@dbaeumer I restarted VSCode a couple of times and now the config name seems fine to me. Sorry to have botherd you. 🥺 |
No problem. |
Hi! Thanks for your great work with this plugin. |
This is actually caused by a problem in ESLint itself. I opened eslint/eslint#16660 |
Great, thank you! |
Hey @dbaeumer, would you consider maybe adding another option, ie. Though I can understand that it might be worthwhile waiting for a resolution there before adding the filename option, just not sure what that might look like. It may simply remain as above, and in that case the option would make sense. |
The ESLint extension has akready support to pass options to the linter. The options available are the ESLint options passed to the ESLint instance created (https://eslint.org/docs/latest/developer-guide/nodejs-api#-new-eslintoptions) and can be set using the |
Thanks @dbaeumer! For anyone else with a similar setup (ESM config in a CJS project), this will get things working: VSCode:
and for the cli: |
I am getting an error: "Could not find config file", with the "Experimental: Use Flat Config" option enabled if a project has a
Isn't the old ESLint: 8.34.0 |
Flat configs are currently implemented using a different class in ESLint and that needs to be decided upfront. Don't know what the further plans in ESLint are. I guess that separate class will go away. |
Thank you. I think we can workaround this so far, by enabling the flat config on per workspace basis rather than globally. |
@dbaeumer and @dburles You seem to know a lot about Eslint and VSC, and I wonder if you know the answer to https://stackoverflow.com/questions/76184736/vscode-no-longer-shows-eslint-errors-after-i-switched-to-eslint-flat-config-alt I appreciate your help! |
@sharh does validation work for you in the terminal? |
@sharh I think it's about https://github.com/microsoft/vscode-eslint/pull/. |
new eslint 8.23.0 release. and cli can use new config file.
eslint/eslint#16235
Is there any plan for support eslint new config file
eslint.config.js
? 👀The text was updated successfully, but these errors were encountered: