Skip to content

Releases: biomejs/biome

Biome CLI v2.6.3

Choose a tag to compare

@github-actions github-actions released this 24 Oct 13:15
c5c3383

2.6.3

Patch Changes

  • #12275 807e616 Thanks @dyc3! - Added the new nursery rule noArraySortForMinMax, which reports sorting an array only to read its smallest or largest value. Use Math.min() or Math.max() instead.

    const minimum = array.toSorted((a, b) => a - b)[0];
  • #12432 cf61682 Thanks @dyc3! - Added the nursery rule noBooleanSortComparator, which reports sort comparators that return a boolean instead of a number. For example, array.sort((a, b) => a > b) never puts the first item before the second, so the array isn't sorted correctly.

  • #12304 b4654c5 Thanks @dyc3! - Added the new nursery rule noEagerArrayMethodsInLoops, which reports .map() and .filter() calls in the header of for...of loops. These calls build a new array that is only used by the loop.

    for (const name of users.map((user) => user.name)) {
      console.log(name);
    }
  • #12121 66c3791 Thanks @dyc3! - Added the nursery rule noNewRequire, which disallows calling require with new, such as new require("app-header").

  • #12316 34b520d Thanks @dyc3! - Added the new nursery rule noObsoleteAttributes, which disallows obsolete attributes on HTML elements and suggests what to use instead.

    <table bgcolor="#ffffff" cellpadding="5"></table>
  • #12258 cce2385 Thanks @dyc3! - Added the nursery rule noPathConcat, which disallows building file paths and URLs by joining strings to __dirname, __filename, import.meta.dirname, import.meta.filename, or import.meta.url.

    const fullPath = __dirname + "/foo.js"; // reported
  • #12287 e12ad78 Thanks @dyc3! - Added the new nursery rule noPlaywrightNthMethods, which disallows selecting Playwright elements by position with first(), last(), and nth(). A test that relies on the position of an element can act on a different element when the page changes.

    await page.locator("button").first().click();
  • #12343 62ad123 Thanks @vibbix! - Added the nursery rule noSelfNestedLayer, which disallows nesting a cascade layer inside a layer with the same name. Layer names inside an @layer block are relative to it, so the inner layer below creates the sublayer components.components instead of adding to components.

    @layer components {
      @layer components {
        .button {
          color: red;
        }
      }
    }
  • #12289 bbbd95d Thanks @dyc3! - Added the nursery rule noShortTimeValues, which reports CSS animation and transition times that are shorter than the configured minimum number of milliseconds. The rule does nothing until minimum is set.

    For example, the following code is invalid when minimum is 100:

    a {
      transition-duration: 80ms;
    }
  • #12431 f748ec0 Thanks @dyc3! - Added the nursery rule noSvelteInternal, which disallows importing from svelte/internal and its submodules. These modules are private to Svelte and can change or disappear in any release.

    import { get_current_component } from "svelte/internal";
  • #12270 8ae35c4 Thanks @dyc3! - Added the nursery rule noTanstackQueryRestDestructuring, which disallows rest destructuring and object spread on TanStack Query results. Both read every property of the result, so the component updates on every change to the query.

    import { useQuery } from "@tanstack/react-query";
    
    const { data, ...rest } = useQuery({ queryKey: ["todos"], queryFn: fetchTodos });

    The rule belongs to the new tanstackQuery domain.

  • #12308 372af2a Thanks @dyc3! - Added the new nursery rule noUnreadableForOfExpression, which reports for...of and for await...of loops that go through the result of a complex expression instead of a variable, a property, or a short call.

    for (const item of getItems(createArgument(seed))) {} // reported
  • #12422 0be8d10 Thanks @dyc3! - Added the new nursery rule noUnsafeReturn, which disallows returning a value typed as any from a function.

    function parse(text: string) {
      return JSON.parse(text); // reported
    }
  • #12311 8434c92 Thanks @dyc3! - Added the nursery rule noUselessSplice, which reports splice() calls that have a simpler alternative. For example, array.splice(0, 1) can be written as array.shift().

  • #12293 eaa4a2b Thanks @dyc3! - Added the nursery rule noVueUnusedEmitDeclarations, which reports events that a Vue component declares but never emits.

    For example, the following component never emits close:

    <script setup>
    const emit = defineEmits(["change", "close"]);
    emit("change");
    </script>
  • #12386 f01ebb0 Thanks @dyc3! - Added the nursery rule noVueVTextVHtmlOnComponent, which disallows v-text and v-html on Vue components. These directives replace everything inside the component's root element instead of filling its slot.

    <template>
      <MyComponent v-html="html"></MyComponent>
    </template>
  • #12385 7bd38b7 Thanks @dyc3! - Added the new nursery rule noVueWatchAfterAwait, which disallows creating watchers after an await in a Vue component's setup() function. Vue doesn't stop these watchers when the component is removed. A watcher is allowed when the function it returns is stored, so that function can be called later to stop the watcher.

    <script>
    import { watch } from "vue";
    
    export default {
      async setup() {
        await fetchUser();
        watch(source, () => {});
      },
    };
    </script>
  • #12286 50d2a4e Thanks @dyc3! - Added the nursery rule noZeroLengthUnit, which disallows units on zero lengths in CSS. Biome can remove the unit.

    a {
      top: 0px;
    }
  • #12300 ab2eb9e Thanks @dyc3! - Added the nursery rule [useBlockStatementOverIife](https://biom...

Read more

JavaScript APIs v6.1.0

Choose a tag to compare

@github-actions github-actions released this 21 Oct 09:49
8c814e1

6.1.0

Minor Changes

  • #9940 1aefcb1 Thanks @regseb! - Added spanInBytesToSpanInCodeUnits helper function in subpath exports of @biomejs/js-api.

    import { spanInBytesToSpanInCodeUnits } from "@biomejs/js-api/nodejs";
    // Or:
    // import { spanInBytesToSpanInCodeUnits } from "@biomejs/js-api/bundler";
    // import { spanInBytesToSpanInCodeUnits } from "@biomejs/js-api/web";
    
    const [start, end] = spanInBytesToSpanInCodeUnits(
        diagnostic.location.span,
        content
    );
    const text = content.slice(start, end); // Correctly extracts the text
  • #8912 e9785d8 Thanks @dyc3! - Added GritQL search to @biomejs/js-api. Parse a pattern with parsePattern(), search content with searchContent(), and release the pattern with dropPattern(). Matches are returned as UTF-8 byte offsets; use spanInBytesToSpanInCodeUnits() to convert them before slicing the content.

    const patternId = biome.parsePattern("`console.log($message)`", {
      defaultLanguage: "js",
    });
    const { matches } = biome.searchContent(projectKey, content, {
      filePath: "example.js",
      patternId,
    });
    biome.dropPattern(patternId);

Patch Changes

  • Updated dependencies []:
    • @biomejs/wasm-bundler@2.6.0
    • @biomejs/wasm-nodejs@2.6.0
    • @biomejs/wasm-web@2.6.0

What's Changed

Read more

Biome CLI v2.6.2

Choose a tag to compare

@github-actions github-actions released this 21 Oct 11:05
0d9aef6

2.6.2

Minor Changes

  • #11479 5c60ba8 Thanks @nhedger! - Added a --git flag to biome init. The flag enables Git VCS integration and sets vcs.useIgnoreFile to true in the generated configuration, even when the command runs outside a Git repository.

  • #11742 3a1356d Thanks @Netail! - Added the biome migrate stylelint command. It imports a Stylelint configuration and its ignore settings into your Biome configuration, mapping Stylelint rules to their Biome equivalents. Pass --write to apply the changes, and --include-inspired or --include-nursery to migrate additional rules.

  • #12318 774b5b5 Thanks @Netail! - Added the new assist action useGraphqlSortedDefinitions, which sorts the named definitions of a GraphQL document, such as types, type extensions, directives, fragments, and operations.

    Invalid:

    type User {
      id: ID!
    }
    
    enum Role {
      ADMIN
      USER
    }
    
    directive @auth on FIELD_DEFINITION
  • #6886 3479d15 Thanks @christymcgrory! - biome rage now shows the resolved files.includes and files.ignoreUnknown configuration.

  • #11102 0874b7f Thanks @gameroman! - Added support for useTailwindSortedClasses rule in HTML-ish files.

  • #10711 40de5a0 Thanks @soconnor-seeq! - Adds a new resolutionKind option for object-syntax plugin entries.

    This allows shared Biome configs in monorepos to load local Grit plugins from the package that declares them instead of resolving plugin paths from the consuming project.

    {
      "plugins": [
        { "path": "./grit/no-debugger.grit", "resolutionKind": "config" },
        { "path": "local-plugin.grit", "resolutionKind": "project" },
        { "path": "local-plugin.grit" }
      ]
    }

    Use resolutionKind: "config" to resolve the plugin from the configuration file that declares it. Use resolutionKind: "project" to resolve the plugin from the consuming project. When omitted, resolutionKind defaults to project. This only affects plugin resolution; includes still apply to end-user project files as usual.

  • #11432 4befd08 Thanks @ematipico! - Added biome inspect config to show resolved configuration values and their origins as human-readable diagnostics, including matching overrides.

    Configuration files can also extend other configurations up to ten levels deep. Repeated references to the same resolved file are ignored with an information diagnostic, while resolving multiple versions of one extended package produces an error.

  • #11477 ab05554 Thanks @nhedger! - Added automatic Git VCS integration when running biome init inside a Git repository, including from nested directories and Git worktrees. The generated configuration sets vcs.enabled and vcs.useIgnoreFile to true, with vcs.clientKind set to "git".

  • #11451 1ac4b09 Thanks @ematipico! - #### YAML is now supported

    Added support for formatting YAML files, both .yaml and .yml extensions

  • #11432 4befd08 Thanks @ematipico! - Configuration files can now recursively extend local files and npm package configurations up to ten levels. Every repeated reference participates in the merge, while resolving multiple versions of one extended package produces an error.

  • #11713 ac6a640 Thanks @dyc3! - Added support for Grit range() patterns, addressing #8454. Plugins can filter syntax nodes by optional start_line, start_column, end_line, and end_column bounds.

    For example, this pattern matches function calls contained entirely on line 2.

    range(start_line=2, end_line=2) as $call where {
        $call <: call_expression()
    }
    
  • #11244 0628b53 Thanks @ematipico! - Added the new CLI option --profile-type-inference to the commands lint and check.

    The profiler is designed to track the execution time of internal queries and operations, group them by file, and sort them from the most expensive to the least expensive.

    biome lint --profile-type-inference
    profiler ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    
      i Type inference profile (Biome <version>)
    
      src/index.ts
    
        Requests (top 5 of 12 groups; 28 source records; 46 executions)
          1. Promise classification <- nursery/noFloatingPromises
          ...
    
        Queries (top 8 of 25 groups; 61 source records; 94 executions)
          1. Promises / infer_expression_is_promise
          ...
    
        Whole-module inference (top 1 of 1 group; 1 source record; 1 execution)
          1. Import depth limit
          ...
    
      68 files omitted.
    
      ℹ To show all the information, use the --verbose option. The output might be very verbose, so it's advised to analyze a single file.
    
      $ biome lint --profile-type-inference --verbose ./path/to/file.ts
    

    Use --verbose to include detailed timings, attribution, breadth, and implementation references for the top source records in each file.

  • #12108 4fcb880 Thanks @ematipico! - Promoted 59 nursery rules to stable groups.

    Correctness

    Promoted the following rules to the correctness group with error severity. All of them are recommended:

    Suspicious

    Promoted the following rules to the suspicious group:

Read more

Biome CLI v2.5.15

Choose a tag to compare

@github-actions github-actions released this 30 Sep 15:23
0b4c11f

2.5.15

Patch Changes

  • #10634 b436ba0 Thanks @subaru-hello! - Added the new nursery rule noReactObjectTypeAsDefaultProp, which disallows array, object, and function values as default props in React components.

    For example, the following snippet triggers the rule.

    function Component({ items = [] }) {
      return items;
    }
  • #11956 faa8b37 Thanks @dyc3! - Added the nursery rule noSvelteExportLet, which disallows declaring Svelte component props with the legacy export let syntax. Use the $props() rune instead.

    <script>
      export let name;
    </script>
  • #10816 1b9479e Thanks @Th3S4mur41! - Added a new nursery rule useLogicalProperties that enforces the use of logical properties in CSS, promoting better internationalization and accessibility practices. The rule supports a direction option with "ltr" as the default and "rtl" as the alternative.
    This is a first rule covering parts of #9034

    {
      "linter": {
        "rules": {
          "nursery": {
            "useLogicalProperties": {
              "level": "warn",
              "options": {
                "direction": "rtl"
              }
            }
          }
        }
      }
    }
  • #11960 1fdb5c2 Thanks @dyc3! - Added the nursery rule useSvelteKitRuneImports, which reports imports from the deprecated $app/stores module and suggests $app/state instead.

    import { page } from "$app/stores";
  • #11723 3b429d1 Thanks @m1handr! - Fixed #11656: noAstroSetHtmlDirective now correctly reports set:html directives inside Astro template expressions.

  • #12023 874d5ae Thanks @codspeed! - Improved the performance of the HTML formatter up to 4x.

  • #11761 a3462fe Thanks @saberoueslati! - Fixed #11351: useSimplifiedLogicExpression no longer reports boolean literals on the right side of || and && outside boolean contexts, because removing them can change the result of the expression. For example, y = x || false is no longer reported, while if (x || false) still is.

  • #11732 ff4c4dd Thanks @dyc3! - Added the nursery rule noMeaninglessVoidOperator, which reports unnecessary uses of void, such as void log() when log returns void. The rule allows discarded call results, thenables, void 0, and calls returning never.

  • #11975 40dd3fb Thanks @ematipico! - Fixed the indentation of multiline Astro expressions, in templates and attribute values, when running biome check --write. Biome now formats Astro expressions with biome format too, and places them at the column of the surrounding markup.

     <div>
     	{items.map((item) => (
    -	<span>{item}</span>
    -))}
    +		<span>{item}</span>
    +	))}
     </div>
  • #12016 09d4000 Thanks @codspeed! - Improved the performance of indexing and analysis of big files up to 2x. The improvements are mostly visible in projects that make use of project and types lint rules.

  • #11750 089bde0 Thanks @dyc3! - Added the nursery rule useStrictBooleanExpressions, which reports ambiguous truthiness checks such as if (value) when value has type number | undefined. Non-nullable strings and numbers and nullable objects are allowed; the rule has no options.

  • #11494 ad5b362 Thanks @jp-knj! - Added the nursery rule noAstroConflictingSetDirectives, which reports Astro elements with multiple content sources, such as set:html, set:text, and child content.

    For example, <div set:html={html}>content</div> triggers the rule.

  • #11878 84d1b3b Thanks @dyc3! - Fixed #11748: useExhaustiveSwitchCases now reports missing cases for values created with the mapping overload of Array.from, including arrays imported from another module.

  • #11802 7d1f37e Thanks @dyc3! - Tailwind classes will now be detected in Svelte, Vue, and Astro class attribute expressions that don't use a class merging function.

  • #11910 9e50ea2 Thanks @ematipico! - Fixed #11504, a regression where Biome would silently ignore errors in the configuration file. Now errors are correctly retained and checked before executing any command.

  • #11921 d568632 Thanks @hirehamir! - Fixed #10846: when plugins fail to load, Biome now prints each failing plugin's path on its own line, instead of concatenating bare messages like Cannot read file.Cannot read file..

  • #11930 82ea5a6 Thanks @dyc3! - Fixed #11927: The HTML formatter no longer duplicates comments around Svelte blocks. This affected a comment after a block such as {#if} or {#each} at the end of an element, and a comment on the same line as the last element inside a block, before {:else}, {/if}, or a similar tag.

  • #11931 0cc46d8 Thanks @dyc3! - Fixed the indentation of comments at the end of a Svelte block's contents. A comment before {:else}, {:then}, {/if}, or a similar tag is now indented with the block's contents instead of with the tag.

     {#if condition}
     	<span>Text</span>
    -<!-- comment -->
    +	<!-- comment -->
     {/if}
  • #12031 ef0edd4 Thanks @dyc3! - Fixed #12027: Biome's test rules no longer mistake regular method calls named test, it, or describe for tests. For example, useValidTestTitle used to report the following regular expression check as a test with an invalid title:

    const isComment = /^\s*#/.test(line);
  • #11959 8477e61 Thanks @dyc3! - Fixed #11950: noUnusedVariables now reports arrow functions with expression bodies that only reference themselves, such as let h = () => h();.

  • [#11915](https://github...

Read more

Biome CLI v2.5.14

Choose a tag to compare

@github-actions github-actions released this 16 Sep 07:52
af4365d

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 <Fragment slot="name">{text}</Fragment> 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.

     <div lang="zh-Hant-TW">
    -  這個段落是那麼長, 在一行寫不行。
    +  這個段落是那麼長,
    +  在一行寫不行。
     </div>
  • #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:

    <button onclick={() => { if (open) close(); }}>Close</button>
  • #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 <Ul> and <Body> in Vue, Svelte, and Astro files.

    -<Body>
    -  <div>content</div>
    -</Body>
    +<Body><div>content</div></Body>
  • #11355 [27177ca](27177ca...

Read more

Biome CLI v2.5.13

Choose a tag to compare

@github-actions github-actions released this 10 Sep 11:09
810ea56

2.5.13

Patch Changes

  • #11379 07a0073 Thanks @Netail! - Added the nursery rule useLayeredStyles, which enforces that style rules are defined within a cascade layer and import rules to import its styles into a cascade layer.

    /* Invalid */
    @import 'foo.css';
    
    .my-style {
      color: red;
    }
    
    /* Valid */
    @import 'foo.css' layer(base);
    
    @layer base {
      .my-style {
        color: red;
      }
    }
  • #11667 e997900 Thanks @devtechedge! - Added the nursery rule useBetterDomTraversing, which prefers .firstChild, .firstElementChild, .closest(), and merged .querySelector() calls over positional DOM traversal.

    element.childNodes[0];
    element.children[0];
    element.parentElement.parentElement;
    element.querySelector("a").querySelector("b");
  • #11620 20e513a Thanks @jakeleventhal! - Fixed #11610, #11611, #11612, #11615, and #11616: Biome no longer fully infers an imported generic declaration just to apply its type arguments, restoring type-aware lint performance for large libraries such as Zod. This improves useRegexpExec, noFloatingPromises, noMisusedPromises, useNullishCoalescing, and noUnsafePlusOperands.

  • #11657 e322040 Thanks @ematipico! - Fixed #7495: noUselessConstructor now ignores TypeScript constructors that forward at least one argument to super, preserving constructors that narrow the subclass's accepted parameter types. The exemption also applies when the parent and child signatures are identical; JavaScript and zero-argument forwarding behavior are unchanged.

  • #11670 4969ee1 Thanks @ematipico! - Fixed #7076: useAriaPropsForRole and useFocusableInteractive no longer report non-focusable elements with role="separator". A separator with an explicit tabIndex or tabindex still requires aria-valuenow.

  • #11627 23aad6d Thanks @ematipico! - Fixed #6571 so Grit plugins can capture and inspect multiple named import specifiers.

  • #11631 00dbd3a Thanks @ematipico! - Reduced unnecessary type inference when type-aware lint rules inspect members of namespace imports from libraries such as Zod. Fixed type inference so blanket re-exports do not expose default exports.

  • #11628 a2f8ff7 Thanks @dyc3! - Added the nursery rule noXorAsExponentiation, which reports the bitwise XOR operator ^ between two decimal integer literals, where the exponentiation operator ** was likely intended.

    const kibibyte = 2 ^ 10; // 8, not 1024
  • #11670 4969ee1 Thanks @ematipico! - Fixed #7192: noUnusedPrivateClassMembers now considers compound assignments such as ??= to read and use private class members.

  • #11676 840a52a Thanks @dyc3! - Fixed #11672 and #11671 by disabling the experimental capitalized-call and effect-dependency checks in useReactCompiler, matching their exclusion from upstream's recommended lint preset. Valid calls such as Intl.NumberFormat() and captures of variables declared inside effects no longer produce these diagnostics.

  • #11660 49485ed Thanks @ematipico! - Fixed #11653: Astro template suppression comments ({/* biome-ignore lint: reason */}) now suppress matching HTML lint diagnostics on the following line when full HTML support is enabled.

  • #11664 9a73b9c Thanks @dyc3! - Improved the performance of useRegexpExec.

  • #11661 5341b3f Thanks @ematipico! - Fixed #7479. noUnusedVariables now treats Unicode escapes in identifiers as the same binding as their decoded spelling.

  • #11630 62e1fc5 Thanks @dyc3! - Fixed the HTML formatter inserting whitespace between adjacent Svelte expressions when their combined length exceeds the line width.

     <span>
    -  {head.median - base.median >= 0 ? "+" : "−"}
    -  {formatMs(Math.abs(head.median - base.median))}
    +  {head.median - base.median >= 0 ? "+" : "−"}{formatMs(Math.abs(head.median - base.median))}
     </span>
  • #11658 ed4bfa4 Thanks @fredrikblau! - Fixed #11644: useHeadingContent no longer reports headings that render their text with a directive: set:html and set:text in Astro files, v-html and v-text in Vue files.

    <h1 set:html={heading} />
    <h2 set:text={heading}></h2>
    <template>
      <h1 v-html="heading"></h1>
      <h2 v-text="heading"></h2>
    </template>
  • #11613 47d7383 Thanks @ematipico! - Improved the performance of Biome Formatter up to ~50% in some cases.

  • #11655 fd8fc74 Thanks @ematipico! - Fixed #6974, where noUnusedPrivateClassMembers incorrectly reported TypeScript private constructor properties read through object destructuring from this as unused.

  • #11618 21a10cf Thanks @siketyan! - Fixed #11605: Type inference now infers the type of an unannotated callback parameter from the signature of the function the callback is passed to, and honours explicit type arguments on call expressions. This improves type-aware analysis for noBaseToString, noFloatingPromises, noMisleadingReturnType, noMisusedPromises, [noUnnecessaryConditions](https://biomejs.dev/linter/r...

Read more

Biome CLI v2.5.12

Choose a tag to compare

@github-actions github-actions released this 03 Sep 07:25
0a31d7c

2.5.12

Patch Changes

  • #11440 b88f1ea Thanks @Princesseuh! - Fixed Astro attribute expressions rejecting TypeScript and JSX syntax that is accepted in text expressions.

    <Component icon={<Icon />} count={total as number} onSelect={(e: Event) => e} />
  • #11440 b88f1ea Thanks @Princesseuh! - Fixed Astro attribute names being split on : and . inside an expression, such as {x && <button x-on:keyup.enter={go} client:load.foo />}.

  • #11440 b88f1ea Thanks @Princesseuh! - Fixed a bare > in the children of an Astro expression being treated as markup, such as {x && <div>a > b</div>}.

  • #11440 b88f1ea Thanks @Princesseuh! - Fixed HTML comments inside an Astro expression failing to parse. They are now read as trivia, wherever they appear among the children.

    {x && <div><!-- first -->text<!-- last --></div>}
    {cond && <a></a><!-- c --><b></b>}
  • #11440 b88f1ea Thanks @Princesseuh! - Fixed is:raw children inside an Astro expression being read as JSX, such as {x && <div is:raw>{not js} < & text</div>}.

  • #11440 b88f1ea Thanks @Princesseuh! - Fixed an apostrophe or quote in the text of a JSX element inside an Astro expression ending the expression early, such as {items.map((i) => <li>it's {i}</li>)}.

  • #11440 b88f1ea Thanks @Princesseuh! - Fixed the children of a <script> or <style> inside an Astro expression being read as JSX. Their contents are text, so braces and comparisons no longer have to be escaped.

    {cond && <style>a { color: red }</style>}
    {cond && <script>let x = {a: 1};</script>}
  • #11440 b88f1ea Thanks @Princesseuh! - Added support for template literal attribute values inside an Astro expression, such as {x && <C data-x=`t${x}` />}.

  • #11440 b88f1ea Thanks @Princesseuh! - Fixed unquoted attribute values being rejected inside an Astro expression, such as {x && <a class=foo maxlength=255 href=/about>go</a>}.

  • #11440 b88f1ea Thanks @Princesseuh! - Fixed a template literal nested inside ${} breaking the rest of an Astro file, such as const href = `/blog${page === 0 ? '' : `/${page + 1}`}`;.

  • #11440 b88f1ea Thanks @Princesseuh! - Fixed a quote inside a regex character class breaking the rest of an Astro file, such as const unsafe = /[/"]/;.

  • #11508 54f3a2e Thanks @dyc3! - Added the nursery rule useFlatMathMinMax. Because Math.min() and Math.max() accept any number of arguments, the rule reports unnecessary nested calls to the same method:

    Math.max(Math.max(a, b), c);

    The fix flattens this expression to Math.max(a, b, c).

  • #11585 c5c8315 Thanks @Netail! - Fixed #11475: noUnresolvedImports no longer reports Bun runtime built-in modules (bun, bun:bundle, bun:ffi, bun:jsc, bun:sqlite, bun:test).

  • #11368 52a57b3 Thanks @Austin1serb! - Fixed #6830: Biome now reports a diagnostic for excessively deep syntax instead of overflowing the native stack while releasing the parsed tree.

  • #11596 1fc42ed Thanks @dyc3! - Added the nursery rule noThisOutsideOfClass. The rule reports this outside class members and TypeScript functions with an explicit this parameter.

    function Person(name) {
        this.name = name;
    }
  • #11555 2516335 Thanks @dyc3! - Fixed #11529, where noFloatingPromises missed unhandled Promise chains when the imported function's module belonged to an import cycle. Cyclic modules now preserve types for exports that do not participate in recursive type dependencies.

  • #11518 0fee70c Thanks @HarperZ9! - Fixed #11500: the formatter now prints the declare modifier before accessibility modifiers on class properties. private declare readonly name: string is now formatted as declare private readonly name: string, matching Prettier and TypeScript's canonical modifier order.

  • #11580 1277af2 Thanks @ematipico! - Fixed #5091: Biome no longer moves comments next to the < of a generic, which causes invalid TypeScript syntax:

    - Generic<// a comment
    + Generic<
    +   // a comment
  • #11577 42995d2 Thanks @ematipico! - Fixed #4592. Biome no longer crashes while parsing malformed delete expressions.

  • #11590 67963b4 Thanks @ematipico! - Fixed #6427 so Grit plugins can use function = ... as a node argument.

  • #11600 a689cb5 Thanks @ematipico! - Fixed #6644: noUnusedVariables now recognizes all interface declarations in a TypeScript declaration-merging group when the interface is referenced.

    The following snippet no longer triggers the rule.

    interface Things {
        foo: string;
    }
    
    interface Things {
        bar: string;
    }
    
    export type Key = keyof Things;
    
    interface Things {
        baz: string;
    }
  • #11591 d4a0716 Thanks @ematipico! - Fixed #6615. noDuplicateProperties no longer reports declarations nested in block at-rules as duplicates of declarations in their parent block.

  • #11492 f2a07aa Thanks @santichausis! - Fixed #11454: noMisplacedAssertion now recognises @fast-check/vitest's test.prop(...) (and .concurrent.prop, .skip.prop, etc.) as a test function, the same way it already recognises test.each. The JS formatter picks up the same recognition, so a curried test.prop(...)(...) call is now formatted with the regular breakable argument layout used for test.each/test.for, inste...

Read more

Biome CLI v2.5.11

Choose a tag to compare

@github-actions github-actions released this 27 Aug 20:49
4d9c1d5

2.5.11

Patch Changes

  • #11499 9743d0c Thanks @scs0209! - Fixed #11496: useValidAnchor now treats Astro JSX shorthand attributes like <a {href}> as a valid href.

  • #11437 88f805e Thanks @Princesseuh! - Fixed #9944: adjacent elements inside an Astro expression now parse as an implicit fragment instead of raising an error.

    {options.map(() =>
      <div />
      <div />
    )}
  • #11437 88f805e Thanks @Princesseuh! - Fixed Astro templates rejecting unclosed HTML void elements, such as {cond && <br>}.

  • #11507 e2fc036 Thanks @dyc3! - Fixed #11157: noUnusedVariables no longer reports Vue <script setup> bindings used by CSS v-bind() as unused.

  • #11398 afc4615 Thanks @dyc3! - Fixed #11389: Files passed through --stdin-file-path now use full HTML support for Astro, Svelte, and Vue when it is enabled.

  • #11526 372cd68 Thanks @dyc3! - Fixed noVueRefAsOperand to track Vue refs through declaration aliases and toRefs() properties, and to recognize useTemplateRef() results. The rule no longer reports false positives such as plain ref transfers, plain toRefs() property access, defineModel() modifiers, or the supported .effect member as operands.

    The refactor enabling these fixes also improves the performance of the rule.

  • #11458 a7cd286 Thanks @dyc3! - Fixed #11436: GritQL snippets such as export { $specifiers } from $source now match named re-exports with aliases, inline type modifiers, and multiple specifiers.

  • #11515 382b15d Thanks @dyc3! - Fixed #11390, where noFloatingPromises performed expensive full type inference for calls to non-Promise methods declared on third-party TypeScript classes. The rule now classifies those calls using targeted type information.

  • #11516 6f40e82 Thanks @levrik! - Fixed noVueRefAsOperand so it no longer reports a callback parameter (e.g. from .find(), .map()) as an unwrapped ref value just because it's nested inside a ref(), computed(), or similar call.

    const result = computed(() => list.find((item) => item.label === "a"));

    Previously, item here was incorrectly treated as a ref value because the rule attributed it to the outer computed() call.

  • #11495 496268d Thanks @Netail! - Fixed useGraphqlNamingConvention so it no longer reports GraphQL enum value definitions with comments & descriptions and now displays a more accurate diagnostic range.

  • #11407 6ef52b0 Thanks @1678092075! - Fixed #11214: noUnusedVariables no longer reports type parameters declared by non-default function overload signatures that have an implementation.

  • #11322 5c353e6 Thanks @jp-knj! - Added a new nursery rule noAstroSetHtmlDirective, which disallows Astro's set:html directive because untrusted content can introduce cross-site scripting vulnerabilities.

    For example, the following snippet triggers the rule:

    <div set:html={content} />
  • #11462 18883b7 Thanks @dyc3! - Fixed #10776: useVueHyphenatedAttributes no longer reports lowercase attribute names containing punctuation, such as pt:header:data-test-id and some_attr.

  • #11476 3270ca4 Thanks @dyc3! - Fixed #10330: Vue interpolation delimiters now stay attached to whitespace-sensitive element boundaries and adjacent inline siblings, wrapping their expression when needed to fit the configured line width. Interpolations followed by text now also converge after one formatting pass.

    -<v-btn v-if="store.state.user" variant="text" to="/my-rooms"
    -  >{{ $t("nav.my-rooms") }}</v-btn
    ->
    +<v-btn v-if="store.state.user" variant="text" to="/my-rooms">{{
    +  $t("nav.my-rooms")
    +}}</v-btn>
  • #11191 3e5367f Thanks @ematipico! - Added the nursery rule noUndeclaredCustomProperties, which reports references to custom properties that are not defined in available CSS, static HTML-like style attributes, or JSX string style attributes.

    For example, the following snippet triggers the rule:

    a { color: var(--undefined-color); }
  • #11435 7754894 Thanks @levrik! - Fixed: Variables and imports used as custom Vue directives are no longer reported as unused.

    For example:

    <script setup>
    const vHighlight = {
      mounted: (element) => {
        element.style.color = "red";
      },
    };
    </script>
    
    <template>
      <p v-highlight>Hello</p>
    </template>
  • #11501 e6acded Thanks @aminya! - Improved the performance of useArraySortCompare by skipping type inference for calls to unrelated methods.

  • #11467 66b282c Thanks @dyc3! - Fixed #11464: Biome now parses parenthesized object literals returned from arrow functions when they contain a conditional expression and a nested arrow function.

  • #11456 db9aa2a Thanks @dyc3! - Fixed #10278: Marked the fix for noThisInStatic as unsafe by default.

  • #11502 652aedb Thanks @levrik! - noGlobalAssign no longer reports assignments to a Vue <script setup> binding from a template expression, when the binding's name happens to match a built-in global (e.g. open, parent, top).

    For example, this no longer triggers a diagnostic:

    <script setup>
    const open = defineModel();
    </script>
    
    <template>
      <button @click="open = !open">Toggle</button>
    </template>

What's Changed

Read more

Biome CLI v2.5.10

Choose a tag to compare

@github-actions github-actions released this 21 Aug 17:40
05797b1

2.5.10

Patch Changes

  • #11403 8f7786f Thanks @Princesseuh! - Fixed Astro rejecting JavaScript comments between attributes.

    <div /* block comment */ class="something"></div>
    <Component /* c */ client:load />
  • #11403 8f7786f Thanks @Princesseuh! - Fixed a bare < in Astro text being treated as the start of a tag, such as <p>5 < 6 and 7 > 6</p>. As in HTML, a < that cannot open a tag is text and needs no escaping.

  • #11438 3133ffa Thanks @Princesseuh! - Fixed #8294: an Astro expression holding only a comment is no longer reported as a parse error, which also stopped the whole file from being formatted.

    <div>{/* a note */}</div>
    <div class={/* a note */}>x</div>
  • #11403 8f7786f Thanks @Princesseuh! - Fixed #9165: an empty Astro expression such as <div>{}</div> no longer fails to parse. Astro renders {} as nothing.

  • #11403 8f7786f Thanks @Princesseuh! - Fixed Astro expressions containing a comment failing to parse.

    <div>{/* block comment */ x}</div>
    <div>{/* only a comment */}</div>
  • #11403 8f7786f Thanks @Princesseuh! - Added support for Astro's fragment shorthand.

    <>
      <p>a</p>
    </>
  • #11403 8f7786f Thanks @Princesseuh! - Fixed an Astro frontmatter block being cut short by a closing tag inside a string or comment.

    ---
    const a = "</script>";
    // </script> in a comment
    ---
  • #11403 8f7786f Thanks @Princesseuh! - Fixed --- being read as an Astro frontmatter fence when markup precedes it. Astro only recognizes frontmatter at the very start of a file, so a file opening with a comment now has no frontmatter, and its --- lines are content.

    <!-- c -->
    ---
    this is text, not frontmatter
    ---
  • #11403 8f7786f Thanks @Princesseuh! - Fixed an Astro frontmatter block ending early on a line that merely starts with a dash.

    ---
    --count;
    ---
  • #11403 8f7786f Thanks @Princesseuh! - Fixed the children of an Astro element carrying is:raw being parsed as markup instead of raw text. This now also covers <script> and <style>, whose contents Astro emits verbatim rather than processing, so they are no longer linted as JavaScript or CSS.

    <article is:raw><% awesome %></article>
    <script is:raw>{{ mustache }}</script>
  • #11403 8f7786f Thanks @Princesseuh! - Fixed Astro rejecting attribute names that start with a colon, such as :href.

  • #11403 8f7786f Thanks @Princesseuh! - Fixed the Astro parser failing to recover from a malformed closing tag such as <div></{<//, so that a later mistake is reported where it happens rather than cascading.

  • #11403 8f7786f Thanks @Princesseuh! - Fixed { inside an Astro <math> element opening an expression. MathML is foreign content where Astro parses no expressions, so LaTeX such as R^{2x} now survives as text. <svg> is unaffected.

  • #11403 8f7786f Thanks @Princesseuh! - Fixed {{ at the start of an Astro expression being read as an interpolation. Astro has no {{ }} syntax, so {{ a: 1 }} and <Comp a={{ b: 1 }} /> are object literals.

  • #11403 8f7786f Thanks @Princesseuh! - Fixed expressions inside an Astro <pre> or <textarea> being read as raw text. Astro parses both as ordinary elements, so their markup and interpolations are now parsed, and a variable used only inside one is no longer reported as unused.

    <pre>{value}</pre>
    <textarea><div>{value}</div></textarea>
  • #11403 8f7786f Thanks @Princesseuh! - Added support for template literal attribute values in Astro, such as <div class=`a ${b} c`>.

  • #11403 8f7786f Thanks @Princesseuh! - Fixed Astro rejecting HTML5 unquoted attribute values that contain `, =, ' or ", such as <a href=a=b> and <a href=a'b>.

  • #11393 dec5a8f Thanks @1678092075! - Fixed #11207: useStrictMode no longer reports Vue event handlers such as @click="count++".

  • #11431 c065f99 Thanks @levrik! - Fixed #11429: Variables and imports used by Vue same-name bindings such as :disabled or v-bind:disabled are no longer reported as unused.

  • #11409 405dedb Thanks @ematipico! - Fixed a memory leak in the LSP server where memory usage kept growing over long editor sessions.

  • #11422 a51eff7 Thanks @dyc3! - Fixed #11416: Biome no longer crashes when parsing incomplete {let} or {const} declarations in Svelte files.

  • #11378 34b715c Thanks @Netail! - Added extra rule sources from @eslint/css. biome migrate eslint detects rules in your eslint configurations more reliably.

  • #11403 8f7786f Thanks @Princesseuh! - Fixed {#, {/, {: and {@ being read as Svelte block openings in every HTML-like file. They are now Svelte-only, so in HTML, Vue and Angular files a sequence such as {#if x} is ordinary text instead of a parse error.

  • #11443 8d45229 Thanks @ematipico! - Fixed #11390: noFloatingPromises no longer performs unnecessary type inference on call arguments when checking methods of non-generic class instances created with new.

  • #11425 9c2667b Thanks @dyc3! - Fixed #6426: GritQL plugins now match and rewrite metavariables embedded in quoted strings.

  • #11441 00317c3 Thanks @dyc3! - Improved performance of [`useN...

Read more

Biome CLI v2.5.9

Choose a tag to compare

@github-actions github-actions released this 17 Aug 23:03
2081460

2.5.9

Patch Changes

  • #11321 41386f3 Thanks @dyc3! - Fixed #11315: The CSS parser now recovers at declaration boundaries after bogus declarations, allowing subsequent valid declarations to be parsed.

  • #11248 57b197e Thanks @yanthomasdev! - Expanded the environment variable metadata used by biome rage to include BIOME_BINARY, BIOME_LOG_FILE, and RUST_BACKTRACE as well as reworded explanations for better readability.

  • #11377 a8798ea Thanks @Netail! - Added a new nursery rule useNamedLayer which disallows anonymous cascade layers.

    @layer {
      a {
        color: red;
      }
    }
  • #11327 6771cf5 Thanks @dyc3! - The HTML formatter now preserves meaningful blank lines in HTML, including spacing after elements with trailing spaces and blank lines between comment groups.

     <div>
       <!-- first group -->
    +
       <!-- second group -->
     </div>
  • #10312 ba8aa18 Thanks @dyc3! - Added the nursery rule useTailwindShorthandClasses, which suggests shorter Tailwind utility classes. For example, the rule suggests replacing w-4 h-4 with size-4.

  • #11333 715e0cd Thanks @kkkhs! - Fixed #11328: lint/nursery/useExpect now recognizes Vitest Browser Mode expect.element() calls as assertions.

  • #11343 9b98211 Thanks @johncarmack1984! - Fixed #11311: the CSS parser now accepts Tailwind container-query variant names in @variant, such as @xl and @max-xl. These previously produced a parse error and a noUnknownAtRules diagnostic.

    @variant @xl {
      div {
        background: red;
      }
    }
  • #11220 3e8c488 Thanks @santichausis! - Fixed #9541: noUndeclaredVariables, noUnusedImports, and noUnusedVariables now correctly recognise exported variables and functions declared in one embedded <script> block as usable from a sibling <script> block, in Svelte's <script module>/<script> pair and Vue's non-setup <script> blocks.

    For example, Biome no longer reports greet as undeclared in the following Svelte component:

    <script module>
      export function greet() {
        console.log("Hello!");
      }
    </script>
    
    <script>
      greet();
    </script>
  • #11300 36430eb Thanks @dyc3! - Fixed the HTML formatter's whitespace handling for marquee, noscript, video, audio, and object elements.

    - <marquee behavior="alternate"> This text will bounce </marquee>
    + <marquee behavior="alternate">This text will bounce</marquee>
  • #11299 6559e6c Thanks @jp-knj! - Added the nursery rule useAstroClientOnlyDirectiveValue, which reports Astro client:only directives without an initializer.

    For example, <Component client:only /> triggers the rule.

  • #11365 7529811 Thanks @MHJahanbakhsh! - Fixed #11229: The useGenericFontNames rule now treats math as a valid generic font family.

  • #11346 674f5f4 Thanks @Jayllyz! - Fixed #11335: noComponentHookFactories now reports a use-prefixed variable only when a function is assigned to it directly.

    function factory() {
      const useColors = true; // no longer reported
      const useStore = createStore({ count: 0 }); // no longer reported
      const useData = () => useState(null); // still reported
      return useColors;
    }
  • #11334 c87c46a Thanks @zkasuran! - Fixed #11317: noSvgWithoutTitle no longer reports an svg that uses the boolean shorthand aria-hidden (equivalent to aria-hidden={true} in React).

  • #11364 13853b1 Thanks @ematipico! - Fixed a bug where useJsxKeyInIterable incorrectly flagged Astro files.

  • #11321 41386f3 Thanks @dyc3! - Fixed #11315: Invalid CSS declarations in HTML style attributes now produce parser diagnostics instead of causing a panic.

  • #11325 67c3bf0 Thanks @dyc3! - Fixed HTML text wrapping to account for the width of an adjacent closing tag, avoiding lines that exceed the configured width when the final word and tag must move together.

     <a-long-long-long-element
    -  >foo bar foo bar foo bar foo bar foo bar foo bar foo bar</a-long-long-long-element
    +  >foo bar foo bar foo bar foo bar foo bar foo
    +  bar</a-long-long-long-element
     >
  • #11367 fe5b5d4 Thanks @ematipico! - Fixed TypeScript compilerOptions.paths resolution when mapping targets omit ./. Biome now resolves these targets relative to their configured path base.

  • #11316 17e48d6 Thanks @wanxiankai! - Fixed #11289: the safe fix for noExtraBooleanCast now preserves parentheses around nested conditional expressions.

  • #11254 d25d113 Thanks @dyc3! - Fixed #11242: Biome no longer crashes with an access violation when analysing files on Windows ARM64.

  • #11221 85aac73 Thanks @freeatnet! - Added the nursery rule noUnsafeTypeAssertion, which disallows TypeScript type assertions while allowing const assertions.

    const value = input as SomeType;
  • #11314 7ffb677 Thanks @ematipico! - Fixed #11310: Restored the performance of noMisusedPromises and noFloatingPromises when analyzed expressions share deep imported type paths.

  • #11356 6cd3263 Thanks [@...

Read more