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.

Unambiguous ES module rule

See original GitHub issue

Currently, Script and Module goals have a grammatical ambiguity where some code can run in both goals, having the exact same source text, but produce different results. Unlike "use strict", the signal to have a specific behavior is not in the code, thus the code has a multitude of possible effects which are not controlled by the programmer.

Because of this I think a new rule for unambiguous ES modules would be nice. It could even be enabled by default when "parserOptions": { "sourceType": "module" }. The rule would enforce that an ES module should have at least one import or export declaration.

\cc @mikesherov @ilyavolodin

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:19 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
jdaltoncommented, Aug 2, 2016

Thanks @nzakas!

For those interested the unambiguous rule has been added to v2 of eslint-plugin-import. As previously mentioned it has benefits regardless of Node/TC39 roadmaps!

0reactions
nzakascommented, Aug 2, 2016

Okay, this reinforces my belief that it’s too soon to consider this for the core. It’s now past our 21-day period to accept issues, so I’m closing. If the unambiguous module syntax reaches standardization and/or implementation, please open another issue and we can consider it again. In the meantime, a custom rule would be your best approach.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unambiguous Webpack config with Typescript - Medium
Constrain the Module interface to just the Webpack 2 features. Constrain the rule interface to NewUseRule . Write the rule to pipe .css...
Read more >
can't resolve module without '.js' file extension - Stack Overflow
I'm using webpack programmatically, with typescript, ESM, and jest. In a jest test I'm getting errors for not including a . js file...
Read more >
eslint-plugin-import - npm
This plugin intends to support linting of ES2015+ (ES6+) ... Rules. Static analysis. Ensure imports point to a file/module that can be ...
Read more >
Options - Babel.js
would allow plugins and presets to decide that, since ES modules are supported, ... unambiguous can be quite useful in contexts where the...
Read more >
ES Modules in Node Today! - Microsoft Edge Blog
(i.e. @std/esm can enforce Node's ESM rules for environment variables, ... Enabling unambiguous module support (i.e. files with at least an ...
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