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

no-unsupported-features/node-builtins does not check for fs/promises #243

Closed
jordanbtucker opened this issue Sep 7, 2020 · 4 comments
Closed

Comments

@jordanbtucker
Copy link

The original way to import the fs Promises API was via one of these options:

const fsp = require('fs').promises
const {readdir} = require('fs').promises
const {promises: fsp} = require('fs')
const {promises: {readdir}} = require('fs')
import {promises as fsp} from 'fs'
// No way to import `readdir` directly via ES modules.

In Node.js v14, they added the ability to import the fs Promises API via fs/promises so you can do things like:

const fsp = require('fs/promises')
const {readdir} = require('fs/promises')
import fsp from 'fs/promises'
import {readdir} from 'fs/promises'

eslint-plugin-node doesn't seem to check to make sure that fs/promises is available in the supported versions of Node.js listed in package.json.

@thernstig
Copy link

'fs/promises' is also actually the first method list since Node.js 15 and forward, so it should get larger adoption as time goes, see https://nodejs.org/api/fs.html#fs_promises_api

https://github.com/mysticatea/eslint-plugin-node#readme should then probably get an update for node/prefer-promises/fs to also say `enforce require("fs/promises"). Or is that also not supported and should be a separate issue?

@jordanbtucker
Copy link
Author

@thernstig, that is a good idea, and it should probably be a separate issue. 👍

@thernstig
Copy link

@thernstig, that is a good idea, and it should probably be a separate issue. 👍

Done: #260

@sosukesuzuki
Copy link
Collaborator

Maybe this is fixed in #261

brettz9 pushed a commit to brettz9/eslint-plugin-node that referenced this issue Jul 24, 2024
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

No branches or pull requests

3 participants