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

Unable to use plugin:es/restrict-to-es2019 #172

Closed
seahindeniz opened this issue Nov 2, 2024 · 3 comments · Fixed by #173
Closed

Unable to use plugin:es/restrict-to-es2019 #172

seahindeniz opened this issue Nov 2, 2024 · 3 comments · Fixed by #173
Labels
accepted documentation Improvements or additions to documentation

Comments

@seahindeniz
Copy link

Hi, I'm trying to use https://eslint-plugin-es.mysticatea.dev/ in a project and I'm not sure how to implement it. The problem is, library suggests to use es/restrict-to-es2019 as plugin

const compat = new FlatCompat({
  baseDirectory: dirname(fileURLToPath(import.meta.url)),
});

compat.plugins('import', '@stylistic', '@cspell', 'es/restrict-to-es2019')

and when I do, ESLint throws the following error

eslint . --quiet


Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-es/restrict-to-es2019".

(The package "eslint-plugin-es/restrict-to-es2019" was not found when loaded as a Node module from the directory "C:\Users\Sahin\projects\project1\config\eslint".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:        

    npm install eslint-plugin-es/restrict-to-es2019@latest --save-dev

The plugin "eslint-plugin-es/restrict-to-es2019" was referenced from the config file in "".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.
@seahindeniz
Copy link
Author

🤦🏻 I think found a solution:

compat.plugins('import', '@stylistic', '@cspell', 'es')
compat.config({
  extends: ['plugin:es/restrict-to-es2019']
})

This wasn't documented anywhere, so it is kind of confusing, actually. I wish the plugin parser could work respectively to / delimited plugins

@voxpelli
Copy link
Contributor

voxpelli commented Nov 2, 2024

Use the maintained fork of the plugin instead: https://github.com/eslint-community/eslint-plugin-es-x

@mdjermanovic
Copy link
Member

mdjermanovic commented Nov 2, 2024

🤦🏻 I think found a solution:

compat.plugins('import', '@Stylistic', '@cspell', 'es')
compat.config({
extends: ['plugin:es/restrict-to-es2019']
})
This wasn't documented anywhere, so it is kind of confusing, actually. I wish the plugin parser could work respectively to / delimited plugins

That's correct. 'plugin:es/restrict-to-es2019' is a config specifier. As stated in the plugin's docs, it should be used in extends in eslintrc config files, thus with compat.extends() (or compat.config({ extends: [...] })) in eslint.config.js files.

I prepared a PR to update the docs with an example: #173

@mdjermanovic mdjermanovic added documentation Improvements or additions to documentation accepted labels Nov 2, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Nov 2, 2024
@mdjermanovic mdjermanovic moved this from Needs Triage to Implementing in Triage Nov 2, 2024
@github-project-automation github-project-automation bot moved this from Implementing to Complete in Triage Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted documentation Improvements or additions to documentation
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants