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

Report for features that are not available for the provided engines range #43

Closed
kiranparajuli589 opened this issue Aug 9, 2022 · 7 comments · Fixed by #189
Closed

Comments

@kiranparajuli589
Copy link

Description

I have a node-check repository here at repo-link. The project is using NodeJS >=8.0.0 <=14.20.0 properly configured at the engines inside the package.json file.

What I want to achieve

Now, sometimes we may accidentally add NodeJS code that is not supported in the specified range but available with the latest versions, like while using replaceAll with strings. It is only introduced in v15, so if the range does not include 15.x.x, the code will break.

Can eslint-plugin-node help me in this case? Can we configure this package to report for such issues?

Demonstration of the Problem

Here is a Github workflow demonstrating the case: https://github.com/kiranparajuli589/node-check/runs/7738971827?check_suite_focus=true

Here I've used plugin:n/recommend in the extends section, but the linter does not report anything :(

@aladdin-add
Copy link

aladdin-add commented Aug 9, 2022

yes, we had a rule no-unsupported-features/es-builtins for such purpose. But it has not been updated to check the new added es features.

related: #34

@kiranparajuli589
Copy link
Author

kiranparajuli589 commented Aug 9, 2022

Is there any workaround for this? Or, any other way?

@aladdin-add
Copy link

under the ground, it used eslint-plugin-es to do so. but it's no longer actively maintained. A workaround is to use its maintained fork: https://www.npmjs.com/package/eslint-plugin-es-x

@aladdin-add
Copy link

https://github.com/ota-meshi/eslint-plugin-es-x/blob/master/docs/rules/no-string-prototype-replaceall.md

@kiranparajuli589
Copy link
Author

Thank you for the refs. IMHO, this only targets for replaceAll, or we've to specify specific rules to avoid specific unsupported usages. Is this the only way? Or, can we just make it grab/report all unsupported code usages?

@scagood

This comment was marked as outdated.

@scagood
Copy link

scagood commented Feb 9, 2024

We need to go through and update lib/rules/no-unsupported-features/es-syntax.js

@scagood scagood linked a pull request Feb 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants