enable eslint for one particular rule #6611
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So, Node requires generated ESM JS files need to have imports that end
with
.js
(unless they are importing the root or declared export from apackage... but for relative paths, this is a must). But we haven't quite
figured out a way to get tsc to force us to do this... so if we mess it
up, we only find out at runtime when trying to run a built ESM package.
This doesn't even necessarily show up in our tests (Jest does its own
thing a lot), and the new smoke-test doesn't cover all of our codebase.
So we set up eslint with a particular rule that looks for this. As it
happens, this rule doesn't check
import type
(import-js/eslint-plugin-import#2270) but
fortunately
import type
doesn't matter to Node.We don't generally enable eslint: there are plenty of rules that we
don't pass currently. We can consider adding some rules later as they
are found to be valuable. For now we just run this one rule!
Fixes #6586.