Skip to content

nodeProtocols

Prefer the node: protocol prefix for Node.js built-in modules for clarity and consistency.

✅ This rule is included in the node logical presets.

The node: protocol makes it explicit that the module is a Node.js built-in, preventing confusion with npm packages that might have the same name. The protocol is supported in Node.js 16+ and is the recommended way to import built-ins.

AEimpo53 fAEfr5<3 sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4D1<1"sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco"><";d>AEimpo53 patAEfr5<3 sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4Dpa1<1"sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco"><";d>AEimpo53 { readFile <} sp ansty="le--0:#C792EA;--1:#8844">AEfr5<3 sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4D1<1"sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco"><";d>AEimpo53 fsPromiseAEfr5<3 sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4Dfs/promis1<1"sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco"><";d>AEconsB0crypAE <= sp ansty="le--0:#82AAFF;--1:#3B61">B0requi5<3(sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4Dcryp1<1"sp ansty="le--0:#D6DEEB;--1:#403F">53<);d ivclassNa="meco"><);d>
44AEim3F53< fs spans="tyle--0:#C792EA;--1:#88">44AE31<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dnod1<111" spans="tyle--0:#D6DEEB;--1:#40">3<;di vdivclass="Nameexpressive-">44AEim3F53 p44AE31<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dnode:1<111" spans="tyle--0:#D6DEEB;--1:#40">3<;di vdivclass="Nameexpressive-">44AEim3F53 { readFil44AE31<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dnod1<111" spans="tyle--0:#D6DEEB;--1:#40">3<;di vdivclass="Nameexpressive-">44AEim3F53 fsPromi44AE31<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dnode:fs/prom1<111" spans="tyle--0:#D6DEEB;--1:#40">3<;di vdivclass="Nameexpressive-">44AEco61B0cr44A61B0req31<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dnode:cr1<111" spans="tyle--0:#D6DEEB;--1:#40">3F<53) ;divclass="Name">

This rule is not configurable.

If you need to support Node.js versions older than 16, you should not use this rule, as the node: protocol was introduced in Node.js 16.0.0.

If you strongly prefer more succinct imports and aren’t worried about confusing userland modules with built-in Node.js modules, this rule might not be for you.