eslint: Unambiguous ES module rule
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.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 19 (11 by maintainers)
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!