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

Eslint init create-config creates a config that does not work with VSCode extension #107

Closed
grentank opened this issue Apr 23, 2024 · 1 comment

Comments

@grentank
Copy link

grentank commented Apr 23, 2024

Steps to reproduce:

  1. Open an empty project
  2. Create package.json file with npm init -y
  3. Configure eslint: npm init @eslint/config@latest
  4. Select:
  • style
  • commonjs
  • none
  • javascript
  • node
  • airbnb
  • Yes
  • npm

This package creates a config eslint.config.mjs. Here are some problems:

  1. Eslint server (VSCode extension) returns an error:
No ESLint configuration (e.g .eslintrc) found for file: /home/grentank/elbrus/temp/temp/eslint.config.mjs
File will not be validated. Consider running 'eslint --init' in the workspace folder temp
Alternatively you can disable ESLint by executing the 'Disable ESLint' command.

The extension does not lint, nor higlight, nor fix .js files
2. The option "eslint.experimental.useFlatConfig": true, in settings.json does help, but is it still experimental?
3. It is impossible to load new configs/plugins in this file. For example, prettier:

  • npm i -D eslint-config-prettier
  • add to compat.extends("airbnb-base", 'prettier'), and the new config does not work. Eslint still higlights formatting rules even after restarting eslint server
  • I dont know how to add plugins or configs in this file. There are no guides on how to apply custom rules to this config. There is no information on how to apply configs or plugins

Please, provide some info on how to use this new eslint config.

@nzakas
Copy link
Member

nzakas commented Apr 23, 2024

For the time being, you'll need to still set `eslint.experimental.useFlatConfig": true' to enable the config file in VS Code. There is a prerelease version that will auto-detect flat config:
microsoft/vscode-eslint#1644

We have a lot of documentation about how to use the new config system, start here:
https://eslint.org/docs/latest/use/configure/migration-guide

There's also this:
https://eslint.org/docs/latest/use/configure/

Note: We do not maintain the VS Code ESLint plugin. For further help, you'll need to work with them:
https://github.com/microsoft/vscode-eslint/

@nzakas nzakas closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants