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.

order rule should support "node:" protocol for imports

See original GitHub issue

The order rule should support the node: protocol for builtin node modules.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:29 (19 by maintainers)

github_iconTop GitHub Comments

3reactions
nicolashenrycommented, May 7, 2021

What downsides ? If you talk about node compatibility, it is only important for library developers, not for application developers.

For advantages, there are some explained in this proposal https://github.com/nodejs/node/issues/38343 which is about to use it by default in node documentation examples.

So if you disagree, I suggest you to give your counter arguments to the Node.js team before it is done (for now there are almost only positive reactions).

2reactions
iamnapocommented, May 14, 2021

Hi, I don’t know if it helps, but in my case, with a similar setup (node v16, is-core-module v2.3.0, resolve v1.20.0), import order is fine, but if I have a newline between the two import statements, I get: There should be no empty line within import group import/order. If I replace node:fs with fs, the error goes away. The rule’s config is: "import/order": ["error", { "newlines-between": "always" }]

@ljharb fyi: This is indeed fixed in v2.23.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

order rule should support "node:" protocol for imports #2035
The order rule wants me to import nedb before node:fs because, with the node: protocol, it alphabetically precedes it. However, I want the...
Read more >
New in Node.js: `node:` protocol imports - 2ality
Node.js now supports a node: protocol for built-in modules. The new node: protocol #. Previously: import * as fs from 'fs/promises';. Now:
Read more >
ECMAScript modules | Node.js v19.3.0 Documentation
An import statement can reference an ES module or a CommonJS module. import statements are permitted only in ES modules, but dynamic import()...
Read more >
Getting Started with (and Surviving) Node.js ESM
The above rules just hold within a single package or application. Going across a package boundary (e.g., importing a dependency) can make Node....
Read more >
import - JavaScript - MDN Web Docs - Mozilla
In order to use the import declaration in a source file, the file must be interpreted by the runtime as a module. In...
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