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
Adding support for eslint.config.mjs
and eslint.config.cjs
files.
#1707
Comments
How does that work when using ESLint on the command line? |
@dbaeumer with edit: also there is a workaround which is briefly mentioned here #1518 (comment) |
Since this is a command line option you need to use I will close the issue since this is the expected behavior. |
@dbaeumer |
The extension detects by default anything that the |
I'm encountering a related issue. Steps to reproduce: Start a new blank project with the following {
"scripts": {
"lint": "eslint ."
},
"devDependencies": {
"eslint": "^8.51.0"
},
"type": "module"
}
export default [
{
rules: {
semi: "error",
}
}
]; and const foo = 42 VS Code gives no red underlines inside of
Switching module.exports = {
env: {
es6: true
},
rules: {
semi: 'error'
}
}; and VS Code will highlight code errors automatically as expected. So, ESLint seems to understand the new config file format, but VS Code isn't picking it up. |
@jamielaw-jellyfish If i am not mistaken this feature is experimental still (or perhaps recently moved to stable?). Maybe the following will help fix it.
{
"eslint.experimental.useFlatConfig": true
} |
@yittoo It did not work in this case, at least not for me. However, just knowing that in time it will be available is good enough. For the time being, I will keep using the old config format, but keep an eye out for when support for the new format becomes publicly available. :-) |
@jamielaw-jellyfish can you please provide me with a Github repository I can clone that demos this. This ensures we are looking at the same problem since things like this depend on many variables. |
I realise the error I made in the repo: |
So, I have been able to get it working, I think. Here was my process:
So, I think the solution was to add the file, but also to restart ESLint and/or VS Code. Sorry for taking you down this rabbit hole. |
No problem. Happy to hear you could solve it. |
I am not sure if it is something that you do want to do until FlatConfig is final. But for cases where we want to use
eslint.config.mjs
we are adding a workspace overwrite as follows. I think this could be extended in the extension source code.I can help with the code adjustment if this feature is desired. Cheers.
The text was updated successfully, but these errors were encountered: