Skip to content

Bug: [consistent-type-imports] sometimes does not report mixes of modules and types in one import as errors. #11096

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

Closed
4 tasks done
kylemh opened this issue Apr 23, 2025 · 1 comment
Labels
bug Something isn't working locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin working as intended Issues that are closed as they are working as intended

Comments

@kylemh
Copy link

kylemh commented Apr 23, 2025

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=5.8.2&fileType=.tsx&code=JYWwDg9gTgLgBAbzgVwM4FMCSATANHGATzHTgGEJwIA7damABSgjFXyJLgCV0BDAYxgA5CNlIBfOADNmIOAHIofQfIDcAKE0dSAFXSp4AXnKVItekxaoAPPLDyAfBu1w9BgExxjPAcNHoNfhpUCAAbdAA6UIgAcwAKJDQsbDhxAEo4XlQUagBraggAd2pM7Ld4LJz8opLK8s9K3mpCDXUgA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6MgeyeUuX0Ra0ipWpQC2xDtHyoMkRNGhTI4MAF8QaoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

import { useId, type ComponentProps, type ReactNode } from 'react';

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/consistent-type-imports": "error"
  },
};

tsconfig

{
  "compilerOptions": {
    "strictNullChecks": true
  }
}

Expected Result

// expected repro to error and auto-fix to
import { useId } from 'react';
import type { ComponentProps, ReactNode } from 'react';

Actual Result

No error. "False-positive", I think it's called?

Additional Info

No response

@kylemh kylemh added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Apr 23, 2025
@bradzacher
Copy link
Member

The rule does not enforce using top level vs inline specifiers. The option merely controls how the fixer behaves. If you want to enforce usage of specific specifiers then check the related rules.

https://typescript-eslint.io/rules/consistent-type-imports/#related-to

@bradzacher bradzacher closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2025
@bradzacher bradzacher added working as intended Issues that are closed as they are working as intended and removed triage Waiting for team members to take a look labels Apr 23, 2025
@github-actions github-actions bot added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label May 1, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin working as intended Issues that are closed as they are working as intended
Projects
None yet
Development

No branches or pull requests

2 participants