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

📝 [email protected] breaks TypeScript adding comma to dynamic import #4426

Open
1 task done
chekrd opened this issue Oct 29, 2024 · 1 comment
Open
1 task done
Labels
A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@chekrd
Copy link

chekrd commented Oct 29, 2024

Environment information

CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v23.1.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.9.0"

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

Formatter:
  Format with errors:           false
  Indent style:                 Space
  Indent width:                 2
  Line ending:                  Lf
  Line width:                   100
  Attribute position:           Auto
  Bracket spacing:              BracketSpacing(true)
  Ignore:                       []
  Include:                      []

JavaScript Formatter:
  Enabled:                      false
  JSX quote style:              Double
  Quote properties:             AsNeeded
  Trailing commas:              All
  Semicolons:                   Always
  Arrow parentheses:            Always
  Bracket spacing:              unset
  Bracket same line:            false
  Quote style:                  Single
  Indent style:                 Space
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   100
  Attribute position:           unset

JSON Formatter:
  Enabled:                      false
  Indent style:                 Space
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Trailing Commas:              unset

CSS Formatter:
  Enabled:                      true
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Quote style:                  Double

GraphQL Formatter:
  Enabled:                      false
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Bracket spacing:              unset
  Quote style:                  unset

Workspace:
  Open Documents:               0

Configuration

{
  "$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
  "organizeImports": {
    "enabled": true
  },
  "formatter": {
    "indentStyle": "space",
    "lineWidth": 100
  },
  "javascript": {
    "formatter": {
      "quoteStyle": "single",
      "indentStyle": "space",
      "lineWidth": 100
    }
  },
  "json": {
    "formatter": {
      "indentStyle": "space"
    }
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": false,
      "a11y": {
        "noAccessKey": "error",
        "noAriaHiddenOnFocusable": "error",
        "noAriaUnsupportedElements": "error",
        "noBlankTarget": "error",
        "noDistractingElements": "error",
        "noHeaderScope": "error",
        "noInteractiveElementToNoninteractiveRole": "error",
        "noPositiveTabindex": "error",
        "noRedundantAlt": "error",
        "noRedundantRoles": "error",
        "useAltText": "error",
        "useAnchorContent": "error",
        "useAriaActivedescendantWithTabindex": "error",
        "useButtonType": "error",
        "useHeadingContent": "error",
        "useHtmlLang": "error",
        "useIframeTitle": "error",
        "useKeyWithMouseEvents": "error",
        "useMediaCaption": "error",
        "useValidAriaProps": "error",
        "useValidAriaRole": "error",
        "useValidAriaValues": "error",
        "useValidLang": "error"
      },
      "complexity": {
        "noBannedTypes": "error",
        "noEmptyTypeParameters": "error",
        "noExtraBooleanCast": "error",
        "noMultipleSpacesInRegularExpressionLiterals": "error",
        "noStaticOnlyClass": "error",
        "noThisInStatic": "error",
        "noUselessCatch": "error",
        "noUselessConstructor": "error",
        "noUselessEmptyExport": "error",
        "noUselessFragments": "error",
        "noUselessLabel": "error",
        "noUselessLoneBlockStatements": "error",
        "noUselessRename": "error",
        "noUselessSwitchCase": "error",
        "noUselessTernary": "error",
        "noUselessThisAlias": "error",
        "noUselessTypeConstraint": "error",
        "noVoid": "error",
        "noWith": "error",
        "useFlatMap": "error",
        "useLiteralKeys": "error",
        "useOptionalChain": "error",
        "useRegexLiterals": "error",
        "useSimpleNumberKeys": "error"
      },
      "correctness": {
        "noChildrenProp": "error",
        "noConstAssign": "error",
        "noConstantCondition": "error",
        "noConstantMathMinMaxClamp": "error",
        "noConstructorReturn": "error",
        "noEmptyCharacterClassInRegex": "error",
        "noEmptyPattern": "error",
        "noFlatMapIdentity": "error",
        "noGlobalObjectCalls": "error",
        "noInnerDeclarations": "error",
        "noInvalidConstructorSuper": "error",
        "noInvalidNewBuiltin": "error",
        "noNewSymbol": "error",
        "noNonoctalDecimalEscape": "error",
        "noPrecisionLoss": "error",
        "noRenderReturnValue": "error",
        "noSelfAssign": "error",
        "noSetterReturn": "error",
        "noStringCaseMismatch": "error",
        "noSwitchDeclarations": "error",
        "noUnnecessaryContinue": "error",
        "noUnreachable": "error",
        "noUnreachableSuper": "error",
        "noUnsafeFinally": "error",
        "noUnsafeOptionalChaining": "error",
        "noUnusedImports": "error",
        "noUnusedLabels": "error",
        "noUnusedPrivateClassMembers": "error",
        "noUnusedVariables": "error",
        "noVoidElementsWithChildren": "error",
        "noVoidTypeReturn": "error",
        "useArrayLiterals": "error",
        "useExhaustiveDependencies": {
          "level": "error",
          "options": {
            "hooks": [
              {
                "name": "useDispatch",
                "stableResult": true
              }
            ]
          }
        },
        "useHookAtTopLevel": "error",
        "useIsNan": "error",
        "useJsxKeyInIterable": "error",
        "useValidForDirection": "error",
        "useYield": "error"
      },
      "performance": {
        "noDelete": "error",
        "noReExportAll": "error"
      },
      "security": {
        "noDangerouslySetInnerHtmlWithChildren": "error",
        "noGlobalEval": "error"
      },
      "style": {
        "noArguments": "error",
        "noCommaOperator": "error",
        "noDefaultExport": "error",
        "noNamespace": "error",
        "noNamespaceImport": "error",
        "noNegationElse": "error",
        "noNonNullAssertion": "error",
        "noParameterAssign": "error",
        "noRestrictedGlobals": "error",
        "noShoutyConstants": "error",
        "noUnusedTemplateLiteral": "error",
        "noUselessElse": "error",
        "noVar": "error",
        "useAsConstAssertion": "error",
        "useCollapsedElseIf": "error",
        "useConst": "error",
        "useEnumInitializers": "error",
        "useExponentiationOperator": "error",
        "useFragmentSyntax": "error",
        "useLiteralEnumMembers": "error",
        "useNodeAssertStrict": "error",
        "useNodejsImportProtocol": "error",
        "useNumberNamespace": "error",
        "useNumericLiterals": "error",
        "useSelfClosingElements": "error",
        "useShorthandAssign": "error",
        "useShorthandFunctionType": "error",
        "useSingleCaseStatement": "error",
        "useSingleVarDeclarator": "error",
        "useTemplate": "error",
        "useWhile": "error"
      },
      "suspicious": {
        "noApproximativeNumericConstant": "error",
        "noAssignInExpressions": "error",
        "noAsyncPromiseExecutor": "error",
        "noCatchAssign": "error",
        "noClassAssign": "error",
        "noCommentText": "error",
        "noCompareNegZero": "error",
        "noConfusingLabels": "error",
        "noConsoleLog": "error",
        "noConstEnum": "error",
        "noControlCharactersInRegex": "error",
        "noDebugger": "error",
        "noDoubleEquals": "error",
        "noDuplicateCase": "error",
        "noDuplicateClassMembers": "error",
        "noDuplicateJsxProps": "error",
        "noDuplicateObjectKeys": "error",
        "noDuplicateParameters": "error",
        "noEmptyBlockStatements": "error",
        "noEmptyInterface": "error",
        "noExtraNonNullAssertion": "error",
        "noFallthroughSwitchClause": "error",
        "noFunctionAssign": "error",
        "noGlobalAssign": "error",
        "noGlobalIsFinite": "error",
        "noGlobalIsNan": "error",
        "noImplicitAnyLet": "error",
        "noImportAssign": "error",
        "noLabelVar": "error",
        "noMisleadingCharacterClass": "error",
        "noMisleadingInstantiator": "error",
        "noMisrefactoredShorthandAssign": "error",
        "noPrototypeBuiltins": "error",
        "noRedeclare": "error",
        "noRedundantUseStrict": "error",
        "noSelfCompare": "error",
        "noShadowRestrictedNames": "error",
        "noSparseArray": "error",
        "noSuspiciousSemicolonInJsx": "error",
        "noThenProperty": "error",
        "noUnsafeDeclarationMerging": "error",
        "noUnsafeNegation": "error",
        "useAwait": "error",
        "useDefaultSwitchClauseLast": "error",
        "useGetterReturn": "error",
        "useIsArray": "error",
        "useNamespaceKeyword": "error",
        "useValidTypeof": "error"
      }
    }
  },
  "overrides": [
    {
      "include": ["**/richText/**/plugins/**/*Plugin.tsx"],
      "linter": {
        "rules": {
          "correctness": {
            "useHookAtTopLevel": "off"
          }
        }
      }
    },
    {
      "include": ["**/*.config.*", "node-scripts/**/*.*"],
      "linter": {
        "rules": {
          "suspicious": {
            "noConsoleLog": "off"
          }
        }
      }
    },
    {
      "include": [
        "**/*.config.*",
        "**/*.d.ts",
        "**/*.stories.tsx",
        "packages/component-library/components/Icons/components/*.tsx"
      ],
      "linter": {
        "rules": {
          "style": {
            "noDefaultExport": "off"
          }
        }
      }
    },
    {
      "include": ["**/*.test.*", "**/*.specs.js", "**/*.uitest.tsx"],
      "linter": {
        "rules": {
          "complexity": {
            "noExcessiveNestedTestSuites": "error"
          },
          "suspicious": {
            "noDuplicateTestHooks": "error",
            "noExportsInTest": "error",
            "noFocusedTests": "error",
            "noSkippedTests": "error"
          }
        }
      }
    },
    {
      "include": ["client/**", "test/**"],
      "linter": {
        "rules": {
          "performance": {
            "noBarrelFile": "error"
          }
        }
      }
    },
    {
      "include": ["client/**", "packages/**", "libs/**", "views/**"],
      "ignore": [
        "packages/component-library/components/Icons/renameIconIndexToIcons.mjs",
        "packages/component-library/components/Icons/icon-index-template.mjs"
      ],
      "linter": {
        "rules": {
          "correctness": {
            "noNodejsModules": "error"
          }
        }
      }
    }
  ],
  "files": {
    "ignore": [
      "**/*-lock.json",
      "**/.DS_Store",
      ".idea/**",
      ".vscode/**",
      "node_modules/**",
      "package.json",
      "public/**",
      "reports/**",
      "snapshots/**",
      "static-js/**",
      "storybook/build/**",
      "test-results/**"
    ]
  }
}

Playground link

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

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@chekrd chekrd added the S-Needs triage Status: this issue needs to be triaged label Oct 29, 2024
@chekrd
Copy link
Author

chekrd commented Oct 29, 2024

Since version 1.9.4, Biome adds a comma to the dynamic import when typeof is used, which TypeScript doesn’t understand and causes it to fail.

Biome 1.9.3 correctly fails the same way as TS does when a comma is manually added:
image

@chekrd chekrd changed the title 📝 [email protected] incompatibility with TypeScript 📝 [email protected] breaks TypeScript Oct 29, 2024
@chekrd chekrd changed the title 📝 [email protected] breaks TypeScript 📝 [email protected] breaks TypeScript adding comma to type import() Oct 29, 2024
@chekrd chekrd changed the title 📝 [email protected] breaks TypeScript adding comma to type import() 📝 [email protected] breaks TypeScript adding comma to dynamic import Oct 29, 2024
@dyc3 dyc3 added A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Oct 31, 2024
@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

No branches or pull requests

2 participants