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

Add file extensions #1781

Closed
wants to merge 17 commits into from
Closed

Add file extensions #1781

wants to merge 17 commits into from

Conversation

frehner
Copy link
Contributor

@frehner frehner commented Jun 30, 2022

Description

This is a WIP PR.

As part of #1155 , we need to move to having the full file extension in our imports.

I paused here to see what everyone's feelings were about this now that you can see the effects of it. If we feel like this is still correct, then I'll move forward and do the rest of the repo.

Additional context

Despite what this may look like, this PR doesn't change our current stance on using index.ts files everywhere. However, you may notice that with this PR, it removes some of the benefits of using index.ts files, which may be another reason to remove that pattern (in the core hydrogen package, at least).


Before submitting the PR, please make sure you do the following:

  • Read the Contributing Guidelines
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123)
  • Update docs in this repository according to your change
  • Run yarn changeset add if this PR cause a version bump based on Keep a Changelog and adheres to Semantic Versioning

@frehner frehner requested a review from a team June 30, 2022 16:40
Copy link
Contributor

@juanpprieto juanpprieto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love these type of PRs — repetitive 🎡 😄

Comment on lines +8 to +9
} from './utilities/log/index.js';
import {getErrorMarkup} from './utilities/error.js';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a little weird to be importing .js from a .tsx 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see your comment here: Shopify/hydrogen#1155 (comment)

Still a bit odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed it's very odd. But the TS people are very adamant about it, so the industry has to live with their decision.

@github-actions github-actions bot had a problem deploying to preview July 1, 2022 16:18 Failure
@github-actions github-actions bot had a problem deploying to preview July 1, 2022 21:13 Failure
@github-actions github-actions bot had a problem deploying to preview July 1, 2022 21:35 Failure
@github-actions github-actions bot had a problem deploying to preview July 1, 2022 21:52 Failure
@github-actions github-actions bot had a problem deploying to preview July 2, 2022 04:23 Failure
Builds are now passing, so that's an improvement.
@frehner frehner marked this pull request as ready for review July 12, 2022 18:06
@github-actions
Copy link
Contributor

We detected some changes in packages/*/package.json or packages/*/src, and there are no updates in the .changeset.
If the changes are user-facing and should cause a version bump, run "yarn changeset add" to track your changes and include them in the next release CHANGELOG.
If you are making simple updates to examples or documentation, you do not need to add a changeset.

@github-actions github-actions bot had a problem deploying to preview July 13, 2022 19:28 Failure
// eslint-disable-next-line node/no-extraneous-import
import * as React from 'react';

globalThis.React = React;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems convenient

rules: {
// ensure that file extensions are used from now on
'import/extensions': ['error', 'ignorePackages'],
// next two are turned off because of the conflict between TS requiring .js extensions and those .js files not actually existing in the filesystem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also mean that erroneous imports that don't exist will not warn in the IDE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sadly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😭 TypeScript! 🤬

@frehner
Copy link
Contributor Author

frehner commented Jul 14, 2022

I unintentionally increased the scope of this PR in the middle of it, and I believe that's now causing issues with the e2e tests that have been difficult to resolve. I think I'm going to close this PR and start over again, this time with not only a better understanding of what changes need to happen, but also understanding which changes don't need to happen.

@frehner frehner mentioned this pull request Jul 15, 2022
4 tasks
@frehner
Copy link
Contributor Author

frehner commented Jul 15, 2022

Superseded by #1857

@frehner frehner closed this Jul 15, 2022
@frehner frehner deleted the file-extensions branch July 15, 2022 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants