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

💅 useImportType splits React import into two, doesn't respect jsxRuntime:reactClassic setting #2473

Closed
1 task done
ipanasenko opened this issue Apr 15, 2024 · 0 comments · Fixed by #2483
Closed
1 task done
Assignees
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@ipanasenko
Copy link
Contributor

Environment information

CLI:
  Version:                      1.7.0
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v18.19.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.2.4"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Linter:
  Recommended:                  true
  All:                          false
  Rules:                        a11y/noSvgWithoutTitle = "off"
                                a11y/useKeyWithClickEvents = "off"
                                a11y/useKeyWithMouseEvents = "off"
                                a11y/useValidAnchor = "off"
                                complexity/noExcessiveNestedTestSuites = "error"
                                complexity/noUselessLoneBlockStatements = "error"
                                complexity/noUselessTernary = "error"
                                correctness/noInvalidUseBeforeDeclaration = "off"
                                correctness/noNewSymbol = "error"
                                correctness/noUnusedImports = "error"
                                correctness/noUnusedPrivateClassMembers = "error"
                                correctness/noUnusedVariables = "error"
                                correctness/useExhaustiveDependencies = "off"
                                correctness/useHookAtTopLevel = "error"
                                nursery/noConstantMathMinMaxClamp = "error"
                                nursery/noEvolvingAny = "error"
                                nursery/noFlatMapIdentity = "error"
                                nursery/noMisplacedAssertion = "error"
                                nursery/noUndeclaredDependencies = "off"
                                performance/noDelete = "off"
                                style/noNegationElse = "error"
                                style/noNonNullAssertion = "off"
                                style/noRestrictedGlobals = "error"
                                style/noShoutyConstants = "error"
                                style/noUnusedTemplateLiteral = "off"
                                style/useBlockStatements = "error"
                                style/useCollapsedElseIf = "error"
                                style/useForOf = "error"
                                style/useImportType = "error"
                                style/useNodejsImportProtocol = "error"
                                style/useNumberNamespace = "error"
                                style/useShorthandAssign = "error"
                                style/useShorthandFunctionType = "error"
                                style/useSingleCaseStatement = "error"
                                suspicious/noConsoleLog = "error"
                                suspicious/noRedeclare = "off"
                                suspicious/noSkippedTests = "off"

Workspace:
  Open Documents:               0

Rule name

useImportType

Playground link

https://biomejs.dev/playground/?lintRules=all&code=aQBtAHAAbwByAHQAIABSAGUAYQBjAHQALAAgAHsAIABGAEMAIAB9ACAAZgByAG8AbQAgACcAcgBlAGEAYwB0ACcACgAKAGMAbwBuAHMAdAAgAF8AQwBvAG0AcAA6ACAARgBDACAAPQAgACgAKQAgAD0APgAgADwAZABpAHYAPgBIAGUAbABsAG8APAAvAGQAaQB2AD4AOwA%3D

Expected result

Playground link does not reproduce the issue, because there's no way to set jsxRuntime option.

Given jsxRuntime=reactClassic and following code:

import React, { FC } from 'react';

Biome transforms in into this:

import type React from 'react';
import type { FC } from 'react';

This transformation is incorrect, should be:

import React, { type FC } from 'react';

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Conaclos Conaclos added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Apr 15, 2024
@arendjr arendjr self-assigned this Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants