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

node: prefix not working with some rules #81

Closed
thernstig opened this issue Jan 23, 2023 · 5 comments · Fixed by #109
Closed

node: prefix not working with some rules #81

thernstig opened this issue Jan 23, 2023 · 5 comments · Fixed by #109

Comments

@thernstig
Copy link

thernstig commented Jan 23, 2023

I tested this using "n/prefer-promises/fs": "error" and it gave no error:

import { readFile } from 'node:fs';

readFile('/etc/passwd', (err, data) => {
  if (err) throw err;
  console.log(data);
});

The rules prefer-promises does not seem to be able to handle using the node: prefix. Maybe this is true for several more rules?

@dimaMachina
Copy link

just saw it also, any updates on it? I guess fixing it should be easy

@piranna
Copy link

piranna commented Mar 10, 2023

I think #87 could fix this too.

@thernstig
Copy link
Author

@piranna great! But it seems the referenced PR does not add any unit tests for that it works, which is probably important to not break it in the future.

@piranna
Copy link

piranna commented Mar 10, 2023

@piranna great! But it seems the referenced PR does not add any unit tests for that it works, which is probably important to not break it in the future.

Fair enough, but it just import some third party module, like dependencies...

@kevinoid
Copy link

kevinoid commented May 8, 2023

n/no-deprecated-api also appears to be affected. For example, with

const url1 = require('url');
const url2 = require('node:url');
url1.parse('http://example.com');
url2.parse('http://example.com');

An n/no-deprecated-api error occurs on line 3, but not line 4.

kevinoid added a commit to kevinoid/swagger-spec-validator that referenced this issue May 8, 2023
After adding `node:`, this causes `Unused eslint-disable directive`
errors due to
eslint-community/eslint-plugin-n#81
Remove the inline disable until n/no-deprecated-api works with node:
protocol imports.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants