github biomejs/biome cli/v1.5.3-nightly.dca6a7a
CLI v1.5.3-nightly.dca6a7a

pre-release7 months ago

Analyzer

Bug fixed

  • Fix #1748. Now for the following case we won't provide an unsafe fix for the noNonNullAssertion rule:

    x[y.z!];

    Contributed by @ah-yu

  • Fix #1081. The useAwait rule does not report for await...of. Contributed by @unvalley

CLI

New features

  • Add a new command biome migrate prettier. The command will read the file .prettierrc/prettier.json and .prettierignore and map its configuration to Biome's one.
    Due to the different nature of .prettierignore globs and Biome's globs, it's highly advised to make sure that those still work under Biome.

Bug fixes

  • Don't process files under an ignored directory.

    Previously, Biome processed all files in the traversed hierarchy,
    even the files under an ignored directory.
    Now, it completly skip the content of ignored directories.

  • Fix #1508 by excluding deleted files from being processed. Contributed by @ematipico

  • Fix #1173. Fix the formatting of a single instruction with commented in a control flow body to ensure consistency. Contributed by @mdm317

  • Fix overriding of javascript.globals. Contributed by @arendjr

  • Fix a bug where syntax rules weren't run when pulling the diagnostics. Now Biome will emit more parsing diagnostics, e.g.

    check.js:1:17 parse/noDuplicatePrivateClassMembers ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    
      × Duplicate private class member "#foo"
    
      > 1 │ class A { #foo; #foo }
          │                 ^^^^
    
    

    Contributed by @ematipico

Configuration

New features

  • Add the ability to resolve the configuration files defined inside extends from the node_modules/ directory.

    If you want to resolve a configuration file that matches the specifier @org/configs/biome, then your package.json file must look this:

    {
      "name": "@org/configs",
      "exports": {
        "./biome": "./biome.json"
      }
    }

    And the biome.json file that "imports" said configuration, will look like this:

    {
      "extends": "@org/configs/biome"
    }

    Read the documentation to better understand how it works, expectations and restrictions.

Editors

Bug fixes

  • Fix a regression where ignored files where formatted in the editor. Contributed by @ematipico
  • Fix a bug where syntax rules weren't run when pulling the diagnostics. Now Biome will emit more parsing diagnostics, e.g.
    check.js:1:17 parse/noDuplicatePrivateClassMembers ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    
      × Duplicate private class member "#foo"
    
      > 1 │ class A { #foo; #foo }
          │                 ^^^^
    
    
    Contributed by @ematipico

Formatter

New features

  • Biome now allows to format the package.json file. This is now the default behaviour and users can remove their workarounds.
    If you rely on other tools to format package.json, you'll have to ignore it via configuration. Contributed by @pattrickrice

  • New formatter option attributePosition that have similar behavior as Prettier singleAttributePerLine #1706. Contributed by @octoshikari

  • Add partial for .astro files. Biome is able to format the frontmatter of the Astro files. Contributed by @ematipico

    ---
    - statement ( );
    + statement();
    ---
    
    <div></div>
  • Add partial for .vue files. Biome is able to format the script block of Vue files. Contributed by @nhedger

    <script setup lang="ts">
    - statement ( );
    + statement();
    </script/>
    
    <template></template>

Bug fixes

  • Fix #1039. Check unicode width instead of number of bytes when checking if regex expression is a simple argument. Contributed by @kalleep

    This no longer breaks.

    s(/🚀🚀/).s().s();
  • Fix #1218, by correctly preserving empty lines in member chains. Contributed by @ah-yu

JavaScript APIs

Linter

New features

  • Add the rule noSkippedTests, to disallow skipped tests:

    describe.skip("test", () => {});
    it.skip("test", () => {});

    Contributed by @ematipico

  • Add the rule noFocusedTests, to disallow skipped tests:

    describe.only("test", () => {});
    it.only("test", () => {});

    Contributed by @ematipico

  • Add rule useSortedClasses, to sort CSS utility classes:

    - <div class="px-2 foo p-4 bar" />
    + <div class="foo·bar·p-4·px-2" />

    Contributed by @DaniGuardiola

  • Add rule noUndeclaredependencies, to detect the use of dependencies that aren't present in the package.json

Enhancements

  • noUselessTernary now provides unsafe code fixes. Contributed by @vasucp1207

  • noApproximativeNumericConstant now provides unsafe code fixes and handle numbers without leading zero and numbers with digit separators.

    The following numbers are now reported as approximated constants.

    3.14_15; // PI
    .4342; // LOG10E

    Contributed by @Conaclos

  • noPrecisionLoss no longer reports number with extra zeros.

    The following numbers are now valid.

    .1230000000000000000000000;
    1230000000000000000000000.0;

    Contributed by @Conaclos

Bug fixes

  • Fix #1651. noVar now ignores TsGlobalDeclaration. Contributed by @vasucp1207

  • Fix #1640. useEnumInitializers code action now generates valid code when last member has a comment but no comma. Contributed by @kalleep

  • Fix #1653. Handle a shorthand value in useForOf to avoid the false-positive case. Contributed by @togami2864

  • Fix #1656. useOptionalChain code action now correctly handles logical and chains where methods with the same name are invoked with different arguments:

    - tags·&&·tags.includes('a')·&&·tags.includes('b')
    + tags?.includes('a') && tags.includes('b')

    Contributed by @lucasweng

  • Fix #1704. Convert / to escaped slash \/ to avoid parsing error in the result of autofix. Contributed by @togami2864

  • Fix#1697. Preserve leading trivia in autofix of suppression rules. Contributed by @togami2864

  • Fix#603. Trim trailing whitespace to avoid double insertion. Contributed by @togami2864

Parser

Bug fixes

  • Fix #1728. Correctly parse the global declaration when the { token is on the line following the global keyword.

    Now the following code is correctly parsed:

    declare global
    { }
    
    declare module foo {
      global
      { }
    }

    Contributed by @ah-yu

  • Fix #1730. Correctly parse delete expressions with operands that are not simple member expressions.

    delete(a.b);
    delete console.log(1);
    delete(() => {});

    Contributed by @printfn

What's Changed

Other changes

  • chore: update some deps by @ematipico in #1803
  • Refactored _pre.scss and made the copy command button sticky within its container. by @shoaibkh4n in #1797

Full Changelog: cli/v1.5.3-nightly.d2858ee...cli/v1.5.3-nightly.dca6a7a

Don't miss a new biome release

NewReleases is sending notifications on new releases.