Biome CLI v2.5.14

2.5.14

Patch Changes

  • #9022 0d49e24 Thanks @dyc3! - Added the nursery rule noReturnInFinally. This rule disallows return statements in Promise.prototype.finally() callbacks, including inside nested blocks and conditional branches. Returns in nested functions are ignored by the rule.
    // Invalid: return in finally callback
    Promise.resolve(1).finally(() => { return 2 })
    
    // Valid: no return in finally callback
    Promise.resolve(1).finally(() => { console.log(2) })
    Returning a value from a Promise.prototype.finally() callback does not replace the original promise's fulfillment value, which can be confusing. Returned promises and thenables are awaited, and their rejection rejects the resulting promise.
  • #11754 71eaa0d Thanks @griff-rees! - Added the nursery rule noSvelteAtDebugTags, which disallows Svelte's {@debug} tag.
    <!-- Invalid: leftover debugging tag -->
    {@debug user}
    The {@debug} tag is a debugging aid and should be removed once you no longer need it, as it should not remain in production code. The rule provides a safe fix that removes the tag.
  • #11725 5eb5f09 Thanks @m1handr! - Added the nursery rule useValidTestTitle, which enforces valid titles for unit test cases and suites.
  • #11735 9bd70c7 Thanks @ematipico! - Fixed #8471: source.fixAll.biome ignored formatter.formatWithErrors. It now applies safe fixes without formatting files that have parse errors when the option is disabled.
  • #11715 f05a3c3 Thanks @ematipico! - Fixed #7771: Grit plugins that use sequential no longer panic when Biome processes files.
  • #11766 c2542c6 Thanks @dyc3! - Fixed validation of readonly and accessor modifiers: combining them in either order now reports that they cannot be used together.
  • #11461 22e9966 Thanks @FoundDream! - Fixed #11423: Multiline template interpolations now preserve the indentation of their closing brace when the source indentation is not a multiple of tabWidth.
     const value = `
          ${
            condition
              ? "yes"
              : "no"
    -}
    +     }
     `;
  • #11766 c2542c6 Thanks @dyc3! - Fixed #11763: TypeScript class members using override accessor, such as override accessor value = 1, now parse correctly. The reversed order, accessor override, now reports that override must precede accessor.
  • #11790 17d0ff0 Thanks @ematipico! - Fixed #10248: noUselessFragments now allows fragments with props in Astro files, such as {text} inside template expressions.
  • #11777 7ee3a6c Thanks @ematipico! - Fixed #7573: added the requireExplicitCase option to useExhaustiveSwitchCases. When set to true, the rule reports missing cases even when the switch has a default clause, so you can keep a runtime fallback while checking that every value in the union has its own case. The option defaults to false.
  • #11751 d37f24b Thanks @ematipico! - Fixed #8347: the fix from useConsistentArrowReturn now parenthesizes returned expressions that begin with object literals before removing the arrow function body braces, preventing invalid output for expressions such as object property access.
  • #11784 46e8912 Thanks @dyc3! - Fixed #11782: noUndeclaredCustomProperties could hang while checking stylesheets imported by JavaScript modules with many shared dependencies.
  • #11731 1534885 Thanks @ematipico! - Fixed #7984: The fix from useSimplifiedLogicExpression now preserves line breaks in multiline conditions with line comments, preventing the right-hand side condition from being commented out.
  • #11735 9bd70c7 Thanks @ematipico! - Fixed #7304: the HTML formatter now preserves authored segment breaks between CJK characters, and next to CJK punctuation, instead of replacing them with spaces.
     
    -  這個段落是那麼長, 在一行寫不行。
    +  這個段落是那麼長,
    +  在一行寫不行。
     
  • #11749 ff992a1 Thanks @ematipico! - Fixed #11747: formatting and checking large parenthesized object expressions no longer exhibit quadratic slowdowns.
  • #11736 1dd1fc4 Thanks @dyc3! - Fixed #8177: code actions no longer modify the wrong part of Vue, Svelte, or Astro files when experimental full HTML support is disabled.
  • #11743 3835945 Thanks @santichausis! - Fixed #10247: biome check --write/biome lint --write now correctly writes fixes for code inside an HTML attribute expression (for example a Svelte onclick={...} handler, or a mustache expression like {count}), instead of silently reporting the diagnostic as fixable and applying nothing. For example, running biome lint --write --unsafe for useBlockStatements (an unsafe fix) on this Svelte component used to leave the file unchanged:
  • #11740 8ea8b4a Thanks @dyc3! - Fixed #11453: useConsistentTestIt now updates imports alongside calls, preserving the original export through an alias. The rule ignores locally declared functions and withholds fixes when the preferred name would conflict with another binding or global reference.
  • #11355 27177ca Thanks @dyc3! - Fixed the HTML formatter incorrectly applying native HTML element formatting to PascalCase component names such as and <Body> in Vue, Svelte, and Astro files.
    -
    -  content
    -
    +content
  • #11355 27177ca Thanks @dyc3! - Fixed the HTML formatter incorrectly applying SVG block formatting to unknown elements whose names matched SVG element names.
    -
    -  content
    -
    +content
  • #11741 fc69047 Thanks @dyc3! - Fixed #8893: useImportExtensions no longer suggests adding .ts to .jsx imports when a colocated .d.ts file provides type declarations.
  • #11642 c87341c Thanks @dyc3! - Added the nursery rule useConsistentFunctionStyle, which requires a consistent style for defining functions. By default, the rule reports the following declaration because it requires a function expression assigned to a variable:
    function greet() {
        return "Hello";
    }
  • #11770 ddfd622 Thanks @dyc3! - Fixed #8980: suppression comments targeting the entire assist category are now respected, including biome-ignore-all assist when running check.
  • #11792 7a4b895 Thanks @dyc3! - Fixed dashed utility base names in the Tailwind parser, including border-bs, font-features, and scrollbar-thumb. Classes such as min-inline-[12rem] now preserve the complete base name and parse the arbitrary value separately.
  • #11739 1fc17e3 Thanks @Netail! - The rule useIncludes now also reports lastIndexOf() comparisons and some() calls with a strict-equality callback.
    arr.lastIndexOf(x) !== -1
    
    arr.some(item => item === x)
  • #11735 9bd70c7 Thanks @ematipico! - Fixed #6888. GritQL plugins can now use contains on import-clause metavariables such as $clause in import $clause from "module" patterns.
  • #11790 17d0ff0 Thanks @ematipico! - Fixed #11786: useAnchorContent now reports anchors without accessible content in HTML, Astro, Vue, and Svelte even when they have an aria-label, aria-labelledby, or title attribute, matching JSX behavior.
  • #11651 a9c4aa0 Thanks @saberoueslati! - Added the new nursery rule noVueUndeclaredDirectives, which reports custom Vue directives that are not declared by a binding, the component's directives option, or the rule's globals option. Closes #11478. Aliased named imports in single-file components are now tracked under their local name, so noUndeclaredVariables recognizes vHighlight in import { highlight as vHighlight } from "./directives".
  • #11715 f05a3c3 Thanks @ematipico! - Fixed #7795. The noJsxLiterals rule now ignores surrounding whitespace when matching literals against allowedStrings.
  • #11780 99c7049 Thanks @ematipico! - Fixed false positives in useExhaustiveSwitchCases when numeric cases use different spellings of the same value. For example, case 0x1 now covers the numeric literal type 1.
  • #11720 c7c4e2b Thanks @ematipico! - Fixed #7880: noUselessStringConcat no longer reports literal concatenations split across multiple lines when a numeric literal ends the chain.
  • #11355 27177ca Thanks @dyc3! - Improved performance of the HTML formatter for documents that contain many HTML-native or SVG-native tags.
  • #11720 c7c4e2b Thanks @ematipico! - Fixed #7949: useReadonlyClassProperties now reports static class properties that are never reassigned.
  • #11751 d37f24b Thanks @ematipico! - Fixed #7644: useImportExtensions now resolves path aliases declared by referenced TypeScript project configurations.
  • #11791 f88793c Thanks @dyc3! - Fixed a false positive in useTailwindShorthandClasses for strings in conditional tests, such as cn(m === "w-2 h-2" ? "bg-red-800" : "bg-red-400").
  • #11720 c7c4e2b Thanks @ematipico! - Fixed #7783: noNoninteractiveElementInteractions no longer reports event handlers on native elements.
  • #11733 7030068 Thanks @dyc3! - Fixed #11730: useExhaustiveSwitchCases reports missing cases when iterating over a class property with for...of.
  • #11717 2107dae Thanks @ternaus! - Fixed #11716: the noUnknownAttribute rule now accepts fullscreen event handlers, the credentialless iframe property, and the SVG maskType property when the React dependency range allows React 19.3 or later. The credentialless and maskType properties are restricted to and elements, respectively.
  • #11737 b7e3559 Thanks @dyc3! - Fixed #11692: noFloatingPromises now detects unhandled promises returned through generic method signatures, including Playwright fixtures.
  • #11780 99c7049 Thanks @ematipico! - Fixed #7747: useExhaustiveSwitchCases now reports missing cases for literal unions derived from const tuples with (typeof values)[number] and objects with keyof typeof object. Other type-aware rules, including noFloatingPromises and noUselessTypeConversion, also recognize supported indexed-access results.
  • #11724 a9a5e9a Thanks @dyc3! - Fixed redundant parentheses around binary and logical unary operands with leading line comments.
     !(
       // leading
    -  (a || b)
    +  a || b
     );
  • #11715 f05a3c3 Thanks @ematipico! - Fixed #7722: noUnusedImports no longer reports type-only imports used in computed names of declared class properties.
  • #11731 1534885 Thanks @ematipico! - Fixed #6390: Biome now offers suppression actions for noDynamicNamespaceImportAccess in editors.
  • #11751 d37f24b Thanks @ematipico! - Fixed #7533: noDescendingSpecificity no longer compares selector specificity across separate cascade layer blocks.
  • #11735 9bd70c7 Thanks @ematipico! - Fixed #6206: useUniqueElementIds no longer reports static IDs on elements in SVG contexts.
  • #11715 f05a3c3 Thanks @ematipico! - Fixed #5447, so the GitHub reporter now associates annotations with the correct files when Biome runs from a nested directory.
  • #11720 c7c4e2b Thanks @ematipico! - Fixed #7816: useHookAtTopLevel no longer reports methods named like hooks when called on another function's result, such as Reactotron.configure(...).useReactNative(...).
  • #11355 27177ca Thanks @dyc3! - Removed special HTML formatter handling for the obsolete element.
  • #11731 1534885 Thanks @ematipico! - Fixed an issue where Grit plugin code fixes weren't available as editor code actions.
  • #11726 dea163f Thanks @dyc3! - Fixed #11722: the JavaScript formatter inserts a newline before the closing angle bracket when a leading comment forces type arguments onto multiple lines.
     type Foo = Record<
       // comment
       string,
    -  number>;
    +  number
    +>;
  • #9758 02ea438 Thanks @Netail! - Added the nursery rule noJsonUnsafeValues, which disallows JSON values that are unsafe to use between different tools or languages. Invalid:
    [
      2e308, // Number evaluating to Infinity
      -2e308, // Number evaluating to -Infinity
      "\ud83d", // String with lone surrogate
      1e-400, // Unsafe zero (too small, will evaluate to 0)
      9007199254740992, // Unsafe integer (outside safe integer range)
      2.2250738585072009e-308, // Subnormal number
    ]
  • #11790 17d0ff0 Thanks @ematipico! - Fixed #8574: the JavaScript formatter sometimes added extra parentheses and moved comments when formatting multiline expressions after operators such as !. Comments now stay beside the values they describe, without an extra pair of parentheses.
     !(
    -  (
    -    cond1 || // force this to be multi line
    -    cond3
    -  ) // comment
    +  cond1 || // force this to be multi line
    +  cond3 // comment
     );
  • #11715 f05a3c3 Thanks @ematipico! - Fixed #7711: biome lint --suppress no longer fails with conflicting rule fixes when multiple diagnostics target a declaration preceded by a multiline comment.
  • #11700 0e9fe53 Thanks @dyc3! - Added the nursery rule noObsoleteTags, which reports obsolete HTML elements in HTML and JSX, such as Text.
  • #11735 9bd70c7 Thanks @ematipico! - Fixed #7363: Biome GritQL plugins now match TypeScript interface snippets such as interface $name { $body }.
  • #11729 f047985 Thanks @m1handr! - Added support for suite() as an alias of describe() across test analysis rules and formatter. Rules now recognize suite, fsuite, xsuite, and test.suite blocks. The formatter recognises them as test declarations.
  • #11778 4b7aa1f Thanks @ematipico! - Fixed #7727: GritQL snippets such as import $what from $where now match namespace imports, including type-only imports. Explicit import type $what from $where patterns also match type-only named and namespace imports.
  • #11715 f05a3c3 Thanks @ematipico! - Fixed #7603: useSingleJsDocAsterisk no longer reports asterisks that are part of JSDoc comment content, such as italic text, as extra line markers.
  • #11706 e19512a Thanks @dyc3! - Fixed #11704: files re-included by negation patterns in a nested .gitignore are processed when vcs.useIgnoreFile is enabled, even when the ignore file contains *.
  • #11718 76a302a Thanks @dyc3! - Fixed #8573: own-line comments before binary operators stay above the operator when javascript.formatter.operatorLinebreak is "before".
     foo
    -  || // comment
    -  bar;
    +  // comment
    +  || bar;
  • #9797 64fd314 Thanks @Netail! - Added the nursery rule useConsistentObjectKeys, which requires JSON object keys to follow a consistent Unicode representation.

What's Changed

  • feat(lint/js): add noReturnInFinally by @dyc3 in #9022
  • fix: honor negation in nested gitignore files by @dyc3 in #11706
  • feat(lint/js): add useConsistentFunctionStyle by @dyc3 in #11642
  • feat(lint): add noObsoleteTags by @dyc3 in #11700
  • fix: closed various bugs by @ematipico in #11715
  • fix(noUnknownAttribute): support React 19.3 DOM properties by @ternaus in #11717
  • fix(format/js): keep comments above binary operators with operatorLinebreak before by @dyc3 in #11718
  • fix(format/js): omit redundant unary operand parentheses by @dyc3 in #11724
  • fix(format/js): add newline before closing angle bracket after commented type arguments by @dyc3 in #11726
  • feat(biome_js_analyze): implement useValidTestTitle rule (#9176) by @m1handr in #11725
  • test(cli): remove path-dependent GitHub reporter snapshot by @dyc3 in #11728
  • fix(css_parser): allow final semicolon omission in SCSS at-rules by @denbezrukov in #11714
  • fix(analyzer): various bugs by @ematipico in #11720
  • fix(useSimplifiedLogicExpression): preserve all trivia by @ematipico in #11731
  • feat(markdown): port markdownlint MD040 fenced code language rule by @saberoueslati in #11267
  • fix(format): preserve template closing brace indentation by @FoundDream in #11461
  • feat: utils for case insensitive binary search by @dyc3 in #11719
  • feat(unit_tests): support suite() as an alias of describe() in test rules (#11727) by @m1handr in #11729
  • fix(analyzer): infer types for for-of bindings by @dyc3 in #11733
  • fix: various bug fixes by @ematipico in #11735
  • fix: correct code action offsets in embedded files in legacy htmlish support by @dyc3 in #11736
  • chore: lint rules on eslint-react-xyz umbrella-subset relationship by @Netail in #11738
  • fix(types): resolve generic method signatures in their own scope by @dyc3 in #11737
  • fix(js/parse): avoid consuming huge iterator by @ematipico in #11749
  • perf(format/html): replace string comparisons with token set checks by @dyc3 in #11355
  • feat(lint/html/svelte): add noSvelteAtDebugTags by @griff-rees in #11754
  • fix(html): write fixes back to attribute-expression embeds by @santichausis in #11743
  • perf(formatter): skip unnecessary comment and context scans by @denbezrukov in #11753
  • fix(css): preserve Sass function call boundaries by @denbezrukov in #11764
  • fix(css_parser): parse SCSS module variables in media queries by @denbezrukov in #11765
  • feat(type-gen): expand lowering codegen to cover more types by @dyc3 in #11734
  • fix(parse/js): fix class member modifier errors by @dyc3 in #11766
  • chore(deps): update dependency @changesets/cli to v3.0.2 by @renovate[bot] in #11769
  • chore(deps): update dependency @changesets/changelog-github to v1.0.1 by @renovate[bot] in #11768
  • chore(deps): update dependency @types/node to v24.13.4 by @renovate[bot] in #11771
  • chore(deps): update dependency tombi to v1.5.4 by @renovate[bot] in #11772
  • chore(deps): update github-actions by @renovate[bot] in #11773
  • chore(deps): update rust crate jiff to 0.2.37 by @renovate[bot] in #11774
  • chore(deps): update rust crate ureq to 3.4.2 by @renovate[bot] in #11775
  • fix(deps): update @biomejs packages by @renovate[bot] in #11776
  • fix: lint rules and typescript reference resolution by @ematipico in #11751
  • feat: expand useIncludes by @Netail in #11739
  • fix(grit): match import patterns by @ematipico in #11778
  • feat(codegen): lower primitive and scalar literal types by @dyc3 in #11756
  • feat(type_inference): handle built in global types with class members, lower WeakMap instance members by @dyc3 in #11757
  • feat(codegen): lower Set, Map, Date, RegExp class members by @dyc3 in #11758
  • feat(codegen): lower iterator and result declarations by @dyc3 in #11759
  • feat(html): detect undeclared custom Vue directives by @saberoueslati in #11651
  • feat(json_analyze): implement useConsistentObjectKeys by @Netail in #9797
  • fix(useConsistentTestIt): update imports with renamed calls by @dyc3 in #11740
  • fix(useImportExtensions): support JSX imports with declarations by @dyc3 in #11741
  • feat(json_analyze): implement noJsonUnsafeValues by @Netail in #9758
  • chore(deps): upgrade rustls by @dyc3 in #11781
  • fix(inference): indexed access types by @ematipico in #11780
  • fix(css): avoid repeated custom property dependency traversal by @dyc3 in #11784
  • refactor(core): retrieve services from salsa by @ematipico in #11779
  • fix: formatter and lint rules by @ematipico in #11790
  • fix(tailwind): ignore conditional test strings by @dyc3 in #11791
  • fix(tailwind): update dashed utility base names by @dyc3 in #11792
  • feat(analyze): add @shadcn/lint rule source by @dyc3 in #11793
  • fix(suppressions): respect top-level assist category by @dyc3 in #11770
  • fix(useExhaustiveSwitchCases): add option requireExplicitCase by @ematipico in #11777
  • ci: release by @github-actions[bot] in #11711

New Contributors

Full Changelog: https://github.com/biomejs/biome/compare/@biomejs/biome@2.5.13...@biomejs/biome@2.5.14

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论