mysticatea / eslint-plugin-node

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

Support fs/promises (docs and feature support) #260

Open thernstig opened 3 years ago

thernstig commented 3 years ago

Since Node.js 15 the recommended way to use the fs API is via promises, see https://nodejs.org/api/fs.html#fs_promises_api.

// Using ESM Module syntax:
import * as fs from 'fs/promises';

// Using CommonJS syntax:
const fs = require('fs/promises');

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"). Note that I have not even tested if it is supported or not, but if it isn't then that should be the main focus of this issue. Otherwise it is just a docs issue.