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

chore(eslint): consistent type imports #6104

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

siddsriv
Copy link
Contributor

@siddsriv siddsriv commented May 16, 2024

Description

introduces a new eslint rule to enforce consistent type imports using the import type syntax.

running eslint with the --fix flag will enforce this rule and modify your file according to the consistent type imports eslint rule.

Testing

as an example:

import { S3Client, PutObjectCommand, PutObjectCommandInput } from "@aws-sdk/client-s3";

upon running eslint on this file, it would throw:

1:1  error  Import "PutObjectCommandInput" is only used as types  

this should be written as so (can be done by running eslint with the --fix flag):

import type { PutObjectCommandInput } from "@aws-sdk/client-s3";
import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";

For this repo,

% npx eslint lib      
.
.
.
✖ 8 problems (0 errors, 8 warnings)

and,

% npx eslint packages
.
.
.
✖ 188 problems (0 errors, 188 warnings)

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

@siddsriv siddsriv requested a review from a team as a code owner May 16, 2024 15:44
@siddsriv siddsriv requested a review from a team as a code owner May 16, 2024 17:20
@siddsriv siddsriv marked this pull request as draft September 11, 2024 20:46
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.

1 participant