TCS-10: Enforce import type via consistent-type-imports#67
Open
brettcutt-aligent wants to merge 1 commit into
Open
TCS-10: Enforce import type via consistent-type-imports#67brettcutt-aligent wants to merge 1 commit into
brettcutt-aligent wants to merge 1 commit into
Conversation
Add @typescript-eslint/consistent-type-imports as an error in the base config so type-only imports are written with import type and any mixed runtime/type imports are split (fixStyle: 'separate-type-imports'). Inline import('...').Foo type annotations are disallowed.
The rule is placed in its own config object scoped to **/*.{ts,tsx,js,jsx,mjs,cjs} so it doesn't load for non-JS/TS files (e.g. GraphQL virtual documents extracted by @graphql-eslint/parser), which lack the parser services this rule requires.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of the proposed changes
Enforce
import typefor type-only imports across consuming projects by adding@typescript-eslint/consistent-type-importsto the shared base ESLint config.Type-only imports were previously written as regular imports → now flagged as errors and auto-fixed to
import type { ... }.Mixed runtime/type imports were previously a single statement → now split into separate runtime and
import typestatements (fixStyle: 'separate-type-imports').Inline
import('...').Footype annotations were previously permitted → now disallowed (disallowTypeAnnotations: true).The rule lives in its own config object scoped to
**/*.{ts,tsx,js,jsx,mjs,cjs}so it doesn't load against non-JS/TS files (e.g. GraphQL virtual documents extracted by@graphql-eslint/parser), which lack the TS parser services this rule requires.Screenshots (if applicable)

Symlinked and tested on take-flight repo
Other solutions considered (if any)
Notes to PR author
Notes to reviewers
ℹ️ When you've finished leaving feedback, please add a final comment to the PR tagging the author, letting them know that you have finished leaving feedback