Open siddsriv opened 1 month ago
introduces a new eslint rule to enforce consistent type imports using the import type syntax.
import type
running eslint with the --fix flag will enforce this rule and modify your file according to the consistent type imports eslint rule.
eslint
--fix
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.
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:
upon running
eslint
on this file, it would throw:this should be written as so (can be done by running
eslint
with the--fix
flag):For this repo,
and,
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.