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 rules to enforce type import/export style #709

Closed

Conversation

josefaidt
Copy link
Contributor

@josefaidt josefaidt commented Nov 19, 2023

Issue #, if available:

Description of changes:

Enforces consistent type imports and exports. This can help prevent errors such as https://typescript.tv/errors/#ts2742 when consuming the libraries with pnpm or npm's "linked" install strategy.

Enabling this emits 504 errors from ESLint

✖ 504 problems (504 errors, 0 warnings)
  504 errors and 0 warnings potentially fixable with the `--fix` option.

Questions:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

changeset-bot bot commented Nov 19, 2023

⚠️ No Changeset found

Latest commit: 98cb987

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@josefaidt josefaidt marked this pull request as ready for review November 22, 2023 01:13
Copy link
Contributor

@edwardfoyle edwardfoyle left a comment

Choose a reason for hiding this comment

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

This can help prevent errors such as https://typescript.tv/errors/#ts2742

"Can help prevent" or "does prevent"? Do we have a consistent repro where doing this solves the issue?

@josefaidt
Copy link
Contributor Author

josefaidt commented Dec 4, 2023

@edwardfoyle I was looking up the original errors I was getting and came across this thread where explicitly using type on imports and exports was the resolution microsoft/TypeScript#47663 (comment)

not sure if this has something to do with it:

Import declarations written with import type, export declarations written with export type { ... }, and import or export specifiers prefixed with the type keyword are all guaranteed to be elided from the output JavaScript.
https://www.typescriptlang.org/docs/handbook/modules/reference.html#type-only-imports-and-exports

I can try resolving these conflicts and linking this to my existing project to see if it gets rid of the type errors

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.

2 participants