mysticatea / eslint-plugin-node

Additional ESLint's rules for Node.js
MIT License
958 stars 167 forks source link

Legacy URL is not deprecated anymore - `node/no-deprecated-api` #339

Open jjspace opened 1 year ago

jjspace commented 1 year ago

It seems that url.parse and others as part of the Legacy URL API are no longer deprecated as of node v14.17.0. I don't believe they should trigger node/no-deprecated-api.

This was specifically an issue in our projects given than url.parse(path) is not the same as new URL(path) when the path is relative. See issues for more:

jimmywarting commented 1 year ago

Still do not think that ppl should use url.parse as it's not as well cross env. friendly. new URL() exist in every env. url.parse don't (it requires a polyfill)

jjspace commented 1 year ago

It's fine if developers/teams decide not to use url.parse as a matter of best practice but the fact remains that it is not actually deprecated and thus should not trigger the no-deprecated-api rule. This is important because new URL() is not a direct replacement for url.parse in certain circumstances (see above) and the no-deprecated-api error forced us to change code that didn't technically need changed for a deprecated function.

voxpelli commented 10 months ago

eslint-plugin-n is the maintained version of this module.

We switched to it in eg. eslint-config-standard / standard and it is maintained by me and other members of the official ESLint community organization.

Try that module out and if it isn't fixed there, then open a new issue in that project.