Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable eslint for one particular rule #6611

Merged
merged 1 commit into from Jun 24, 2022
Merged

enable eslint for one particular rule #6611

merged 1 commit into from Jun 24, 2022

Conversation

glasser
Copy link
Member

@glasser glasser commented Jun 24, 2022

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 a
package... 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.

@netlify
Copy link

netlify bot commented Jun 24, 2022

Deploy Preview for apollo-server-docs ready!

Name Link
🔨 Latest commit 1de8fad
🔍 Latest deploy log https://app.netlify.com/sites/apollo-server-docs/deploys/62b621fb61824c000a7f8b8a
😎 Deploy Preview https://deploy-preview-6611--apollo-server-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 24, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 1de8fad:

Sandbox Source
Apollo Server Typescript Configuration
Apollo Server Configuration

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 a
package... 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!
@glasser glasser merged commit 55ab60a into version-4 Jun 24, 2022
@glasser glasser deleted the glasser/eslint branch June 24, 2022 20:49
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants