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

💅 lint/style/useExportType removes comments in multiline export statements #2685

Closed
1 task done
csoto09 opened this issue May 2, 2024 · 0 comments · Fixed by #2688
Closed
1 task done

💅 lint/style/useExportType removes comments in multiline export statements #2685

csoto09 opened this issue May 2, 2024 · 0 comments · Fixed by #2688
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

@csoto09
Copy link

csoto09 commented May 2, 2024

Environment information

CLI:
  Version:                      1.7.2
  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.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "yarn/3.6.3"

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/noNoninteractiveElementToInteractiveRole = "warn"
                                a11y/noNoninteractiveTabindex = "warn"
                                a11y/noPositiveTabindex = "warn"
                                a11y/noSvgWithoutTitle = "warn"
                                a11y/useAltText = "warn"
                                a11y/useAriaPropsForRole = "warn"
                                a11y/useButtonType = "warn"
                                a11y/useKeyWithClickEvents = "warn"
                                a11y/useKeyWithMouseEvents = "warn"
                                a11y/useValidAnchor = "warn"
                                complexity/noBannedTypes = "warn"
                                complexity/noForEach = "warn"
                                complexity/noMultipleSpacesInRegularExpressionLiterals = "warn"
                                complexity/noStaticOnlyClass = "warn"
                                complexity/noThisInStatic = "warn"
                                complexity/noUselessEmptyExport = "warn"
                                complexity/noUselessFragments = "warn"
                                complexity/noUselessSwitchCase = "warn"
                                complexity/noUselessTypeConstraint = "warn"
                                complexity/useArrowFunction = "warn"
                                complexity/useFlatMap = "warn"
                                complexity/useLiteralKeys = "warn"
                                complexity/useOptionalChain = "warn"
                                complexity/useRegexLiterals = "warn"
                                correctness/noChildrenProp = "warn"
                                correctness/noConstructorReturn = "warn"
                                correctness/noEmptyPattern = "warn"
                                correctness/noPrecisionLoss = "warn"
                                correctness/noSelfAssign = "warn"
                                correctness/noUnnecessaryContinue = "warn"
                                correctness/noUnreachableSuper = "warn"
                                correctness/noUnsafeOptionalChaining = "warn"
                                correctness/useExhaustiveDependencies = "warn"
                                correctness/useJsxKeyInIterable = "warn"
                                performance/noAccumulatingSpread = "warn"
                                performance/noDelete = "warn"
                                security/noDangerouslySetInnerHtml = "warn"
                                style/noArguments = "warn"
                                style/noInferrableTypes = "warn"
                                style/noNonNullAssertion = "warn"
                                style/noParameterAssign = "warn"
                                style/noUnusedTemplateLiteral = "warn"
                                style/noUselessElse = "warn"
                                style/noVar = "warn"
                                style/useDefaultParameterLast = "warn"
                                style/useEnumInitializers = "warn"
                                style/useExponentiationOperator = "warn"
                                style/useImportType = "off"
                                style/useNodejsImportProtocol = "warn"
                                style/useSelfClosingElements = "warn"
                                style/useSingleVarDeclarator = "warn"
                                style/useTemplate = "warn"
                                suspicious/noApproximativeNumericConstant = "warn"
                                suspicious/noArrayIndexKey = "warn"
                                suspicious/noAssignInExpressions = "warn"
                                suspicious/noConfusingVoidType = "warn"
                                suspicious/noControlCharactersInRegex = "warn"
                                suspicious/noDoubleEquals = "warn"
                                suspicious/noDuplicateTestHooks = "warn"
                                suspicious/noEmptyInterface = "off"
                                suspicious/noExplicitAny = "warn"
                                suspicious/noExportsInTest = "warn"
                                suspicious/noGlobalAssign = "warn"
                                suspicious/noGlobalIsFinite = "warn"
                                suspicious/noGlobalIsNan = "warn"
                                suspicious/noImplicitAnyLet = "warn"
                                suspicious/noMisleadingCharacterClass = "warn"
                                suspicious/noRedeclare = "warn"
                                suspicious/noRedundantUseStrict = "off"
                                suspicious/noShadowRestrictedNames = "warn"
                                suspicious/noSparseArray = "warn"
                                suspicious/noThenProperty = "warn"

Workspace:
  Open Documents:               0

Rule name

useExportType

Playground link

https://biomejs.dev/playground/?code=aQBuAHQAZQByAGYAYQBjAGUAIABGAG8AbwAgAHsAfQAKAGkAbgB0AGUAcgBmAGEAYwBlACAAQgBhAHIAIAB7AH0ACgAKAGUAeABwAG8AcgB0ACAAewAKACAAIAAvACoAKgAgAEAAZABlAHAAcgBlAGMAYQB0AGUAZAAgAGkAbQBwAG8AcgB0ACAAewB0AHkAcABlACAARgBvAG8AfQAgAGYAcgBvAG0AIAAnAHAAawBnACcAIABpAG4AcwB0AGUAYQBkACAAKgAvAAoAIAAgAHQAeQBwAGUAIABGAG8AbwAsAAoAIAAgAC8AKgAqACAAQABkAGUAcAByAGUAYwBhAHQAZQBkACAAaQBtAHAAbwByAHQAIAB7AHQAeQBwAGUAIABCAGEAcgB9ACAAZgByAG8AbQAgACcAcABrAGcAJwAgAGkAbgBzAHQAZQBhAGQAIAAqAC8ACgAgACAAdAB5AHAAZQAgAEIAYQByACwACgB9AA%3D%3D

Expected result

It should preserve comments included within an export statement.

Input:

interface Foo {}
interface Bar {}

export {
  /** @deprecated import {type Foo} from 'pkg' instead */
  type Foo,
  /** @deprecated import {type Bar} from 'pkg' instead */
  type Bar,
}

Expected result:

interface Foo {}
interface Bar {}

export type {
  /** @deprecated import {type Foo} from 'pkg' instead */
 Foo,
  /** @deprecated import {type Bar} from 'pkg' instead */
 Bar,
}

Actual result:

interface Foo {}
interface Bar {}

export type {Foo,Bar,
}

NOTE: this issue does not occur if there are no type annotations within the export statement. The following example is handled correctly:
Input:

interface Foo {}
interface Bar {}

export {
  /** @deprecated import {type Foo} from 'pkg' instead */
  Foo,
  /** @deprecated import {type Bar} from 'pkg' instead */
  Bar,
}

Result:

interface Foo {}
interface Bar {}

export type {
  /** @deprecated import {type Foo} from 'pkg' instead */
  Foo,
  /** @deprecated import {type Bar} from 'pkg' instead */
  Bar,
}

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 May 2, 2024
@Conaclos Conaclos self-assigned this May 2, 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.

2 participants