question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule proposal: `prefer-node-protocol`

See original GitHub issue

Node.js has added node: support for builtin modules https://nodejs.org/api/esm.html#esm_node_imports, I think add it is more clear that module is builtin.

Fail

import fs from 'fs';
export {promises as default} from 'fs'
async function foo() {
	const fs = await import('fs');
	// ...
}

Pass

import fs from 'node:fs';
export {promises as default} from 'node:fs'
async function foo() {
	const fs = await import('node:fs');
	// ...
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
DaSchTourcommented, May 12, 2021

This rule just broke my build. I think this should not be fixed by default with the recommended configuration. This is a quite new feature, that is not widely know and that may break the build if the environment is not prepared to handle node protocol imports.

1reaction
fiskercommented, Apr 23, 2021

Don’t worry, I can work on it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint-plugin-unicorn/prefer-node-protocol.md at main - GitHub
Prefer using the node: protocol when importing Node.js builtin modules. This rule is enabled in the ✓ recommended config. This rule is automatically ......
Read more >
Assigning Pods to Nodes - Kubernetes
You can indicate that a rule is soft or preferred, so that the scheduler still schedules the Pod even if it can't find...
Read more >
Coinbase petition for SEC rulemaking
Commission rules that govern the offer, sale, trading, custody, and clearing ... Coinbase, like many other exchanges, has intentionally and.
Read more >
Paxos - Martin Fowler
In the first phase (called prepare phase), the node proposing a value (called a proposer) contacts all the nodes in the cluster (called ......
Read more >
R1403 Procedure 5 Plans - AQMD
Procedure 5 Plans are required to clean-up any disturbed Asbestos Containing Materials, ... To obtain Procedure 5 Plan approval, use the Rule 1403...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found