useNodejsImportProtocol (since v1.5.0)
Diagnostic Category: lint/style/useNodejsImportProtocol
Sources:
- Same as: 
unicorn/prefer-node-protocol 
Enforces using the node: protocol for Node.js builtin modules.
The rule marks traditional imports like import fs from "fs"; as invalid,
suggesting the format import fs from "node:fs"; instead.
Examples
Section titled ExamplesInvalid
Section titled Invalidimport fs from 'fs';code-block.js:1:16 lint/style/useNodejsImportProtocol  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ A Node.js builtin module should be imported with the node: protocol.
  
  > 1 │ import fs from 'fs';
      │                ^^^^
    2 │ 
  
  ℹ Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
  
  ℹ Unsafe fix: Add the node: protocol.
  
    1   │ - import·fs·from·'fs';
      1 │ + import·fs·from·'node:fs';
    2 2 │   
  
import os from 'os';code-block.js:1:16 lint/style/useNodejsImportProtocol  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ A Node.js builtin module should be imported with the node: protocol.
  
  > 1 │ import os from 'os';
      │                ^^^^
    2 │ 
  
  ℹ Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
  
  ℹ Unsafe fix: Add the node: protocol.
  
    1   │ - import·os·from·'os';
      1 │ + import·os·from·'node:os';
    2 2 │   
  
import path from 'path';code-block.js:1:18 lint/style/useNodejsImportProtocol  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ A Node.js builtin module should be imported with the node: protocol.
  
  > 1 │ import path from 'path';
      │                  ^^^^^^
    2 │ 
  
  ℹ Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
  
  ℹ Unsafe fix: Add the node: protocol.
  
    1   │ - import·path·from·'path';
      1 │ + import·path·from·'node:path';
    2 2 │   
  
Valid
Section titled Validimport fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';