Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@biomejs/biome

Package Overview
Dependencies
Maintainers
4
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@biomejs/biome - npm Package Versions

1
8

1.5.1

Diff

Changelog

Source

1.5.1 (2024-01-10)

CLI

Bug fixes
  • The diagnostics files/missingHandler are now shown only when the option --verbose is passed. Contributed by @ematipico
  • The diagnostics for protected files are now shown only when the option --verbose is passed. Contributed by @ematipico
  • Fix #1465, by taking in consideration the workspace folder when matching a pattern. Contributed by @ematipico
  • Fix #1465, by correctly process globs that contain file names. Contributed by @ematipico

Formatter

Bug fixes
  • Fix #1170. Fix placement of comments inside default switch clause. Now all line comments that have a preceding node will keep their position. Contributed by @kalleep

Linter

Bug fixes

Fix #1335. noUselessFragments now ignores code action on component props when the fragment is empty. Contributed by @vasucp1207

  • useConsistentArrayType was accidentally placed in the style rule group instead of the nursery group. It is now correctly placed under nursery.

Fix #1483. useConsistentArrayType now correctly handles its option. Contributed by @Conaclos

Fix #1502. useArrowFunction now correctly handle functions that return a (comma) sequence expression. Contributed by @Conaclos

Previously the rule made an erroneous suggestion:

- f(function() { return 0, 1; }, "");
+ f(() => 0, 1, "")

Now, the rule wraps any comma sequence between parentheses:

- f(function() { return 0, 1; }, "");
+ f(() => (0, 1), "")

Fix #1473: useHookAtTopLevel now correctly handles React components and hooks that are nested inside other functions. Contributed by @arendjr

dominionl
published 1.5.0 •

Changelog

Source

1.5.0 (2024-01-08)

Biome now scores 97% compatibility with Prettier and features more than 180 linter rules.

Analyzer

CLI

New features
  • Biome now shows a diagnostic when it encounters a protected file. Contributed by @ematipico

  • The command biome migrate now updates the $schema if there's an outdated version.

  • The CLI now takes in consideration the .gitignore in the home directory of the user, if it exists. Contributed by @ematipico

  • The biome ci command is now able to print GitHub Workflow Commands when there are diagnostics in our code. Contributed by @nikeee This might require setting the proper permissions on your GitHub action:

    permissions:
      pull-requests: write
    
  • The commands format, lint, check and ci now accept two new arguments: --changed and --since. Use these options with the VCS integration is enabled to process only the files that were changed. Contributed by @simonxabris

    biome format --write --changed
    
  • Introduced a new command called biome explain, which has the capability to display documentation for lint rules. Contributed by @kalleep

  • You can use the command biome explain to print the documentation of lint rules. Contributed by @kalleep

    biome explain noDebugger
    biome explain useAltText
    
  • You can use the command biome explain to print the directory where daemon logs are stored. Contributed by @ematipico

    biome explain daemon-logs
    
  • Removed the hard coded limit of 200 printable diagnostics. Contributed by @ematipico

Bug fixes
  • Fix #1247, Biome now prints a warning diagnostic if it encounters files that can't handle. Contributed by @ematipico

    You can ignore unknown file types using the files.ignoreUnknown configuration in biome.json:

    {
      "files": {
        "ignoreUnknown": true
      }
    }
    

    Or the --files-ignore-unknown CLI option:

    biome format --files-ignore-unknown=true --write .
    
  • Fix #709 and #805 by correctly parsing .gitignore files. Contributed by @ematipico

  • Fix #1117 by correctly respecting the matching. Contributed by @ematipico

  • Fix #691 and #1190, by correctly apply the configuration when computing overrides configuration. Contributed by @ematipico

Configuration

New features
  • Users can specify git ignore patterns inside ignore and include properties, for example it's possible to allow list globs of files using the ! character:

    {
      "files": {
        "ignore": [
          "node_modules/**",
          "!**/dist/**" // this is now accepted and allow files inside the `dist` folder
        ]
      }
    }
    

Editors

New features
  • The LSP registers formatting without the need of using dynamic capabilities from the client.

    This brings formatting services to the editors that don't support or have limited support for dynamic capabilities.

Formatter

Bug fixes
  • Fix #1169. Account for escaped strings when computing layout for assignments. Contributed by @kalleep

  • Fix #851. Allow regular function expressions to group and break as call arguments, just like arrow function expressions. #1003 Contributed by @faultyserver

  • Fix #914. Only parenthesize type-casted function expressions as default exports. #1023 Contributed by @faultyserver

  • Fix #1112. Break block bodies in case clauses onto their own lines and preserve trailing fallthrough comments. #1035 Contributed by @faultyserver

  • Fix RemoveSoftLinesBuffer behavior to also removed conditional expanded content, ensuring no accidental, unused line breaks are included #1032 Contributed by @faultyserver

  • Fix #1024. Allow JSX expressions to nestle in arrow chains #1033 Contributed by @faultyserver

  • Fix incorrect breaking on the left side of assignments by always using fluid assignment. #1021 Contributed by @faultyserver

  • Fix breaking strategy for nested object patterns in function parameters #1054 Contributed by @faultyserver

  • Fix over-indention of arrow chain expressions by simplifying the way each chain is grouped #1036, #1136, and #1162 Contributed by @faultyserver.

  • Fix "simple" checks for calls and member expressions to correctly handle array accesses, complex arguments to single-argument function calls, and multiple-argument function calls. #1057 Contributed by @faultyserver

  • Fix text wrapping and empty line handling for JSX Text elements to match Prettier's behavior. #1075 Contributed by @faultyserver

  • Fix leading comments in concisely-printed arrays to prevent unwanted line breaks. #1135 Contributed by @faultyserver

  • Fix best_fitting and interned elements preventing expansion propagation from sibling elements. #1141 Contributed by @faultyserver

  • Fix heuristic for grouping function parameters when type parameters with constraints are present. #1153. Contributed by @faultyserver.

  • Fix binary-ish and type annotation handling for grouping call arguments in function expressions and call signatures. #1152 and #1160 Contributed by @faultyserver

  • Fix handling of nestled JSDoc comments to preserve behavior for overloads. #1195 Contributed by @faultyserver

  • Fix #1208. Fix extraction of inner types when checking for simple type annotations in call arguments. #1195 Contributed by @faultyserver

  • Fix #1220. Avoid duplicating comments in type unions for mapped, empty object, and empty tuple types. #1240 Contributed by @faultyserver

  • Fix #1356. Ensure if_group_fits_on_line content is always written in RemoveSoftLinesBuffers. #1357 Contributed by @faultyserver

  • Fix #1171. Correctly format empty statement with comment inside arrow body when used as single argument in call expression. Contributed by @kalleep

  • Fix #1106. Fix invalid formatting of single bindings when Arrow Parentheses is set to "AsNeeded" and the expression breaks over multiple lines. #1449 Contributed by @faultyserver

JavaScript APIs

Linter

Promoted rules

New rules are incubated in the nursery group. Once stable, we promote them to a stable group. The following rules are promoted:

New features
  • Add useExportType that enforces the use of type-only exports for types. Contributed by @Conaclos

      interface A {}
      interface B {}
      class C {}
    
    - export type { A, C }
    + export { type A, C }
    
    - export { type B }
    + export type { B }
    
  • Add useImportType that enforces the use of type-only imports for types. Contributed by @Conaclos

    - import { A, B } from "./mod.js";
    + import { type A, B } from "mod";
      let a: A;
      const b: B = new B();
    

    Also, the rule groups type-only imports:

    - import { type A, type B } from "./mod.js";
    + import type { A, B } from "./mod.js";
    
  • Add useFilenamingConvention, that enforces naming conventions for JavaScript and TypeScript filenames. Contributed by @Conaclos

    By default, the rule requires that a filename be in camelCase, kebab-case, snake_case, or matches the name of an export in the file. The rule provides options to restrict the allowed cases.

  • Add useNodejsImportProtocol that enforces the use of the node: protocol when importing Node.js modules. Contributed by @2-NOW, @vasucp1207, and @Conaclos

    - import fs from "fs";
    + import fs from "node:fs";
    
  • Add useNumberNamespace that enforces the use of the Number properties instead of the global ones.

    - parseInt;
    + Number.parseInt;
    - - Infinity;
    + Number.NEGATIVE_INFINITY;
    
  • Add useShorthandFunctionType that enforces using function types instead of object type with call signatures. Contributed by @emab, @ImBIOS, and @seitarof

    - interface Example {
    -   (): string;
    - }
    + type Example = () => string
    

- Add [noNodejsModules](https://biomejs.dev/linter/rules/no-nodejs-modules), that disallows the use of _Node.js_ modules. Contributed by @anonrig, @ematipico, and @Conaclos

- Add [noInvalidUseBeforeDeclaration](https://biomejs.dev/linter/rules/no-invalid-use-before-declaration) that reports variables and function parameters used before their declaration. Contributed by @Conaclos

  ```js
  function f() {
    console.log(c); // Use of `c` before its declaration.
    const c = 0;
  }
  • Add useConsistentArrayType that enforces the use of a consistent syntax for array types. Contributed by @eryue0220

    This rule will replace useShorthandArrayType. It provides an option to choose between the shorthand or the generic syntax.

  • Add noEmptyTypeParameters that ensures that any type parameter list has at least one type parameter. Contributed by @togami2864

    This will report the following empty type parameter lists:

    interface Foo<> {}
    //           ^^
    type Bar<> = {};
    //      ^^
    
  • Add noGlobalEval that reports any use of the global eval. Contributed by @you-5805

  • Add noGlobalAssign that reports assignment to global variables. Contributed by @chansuke

    Object = {}; // report assignment to `Object`.
    
  • Add noMisleadingCharacterClass that disallows characters made with multiple code points in character class. Contributed by @togami2864

  • Add noThenProperty that disallows the use of then as property name. Adding a then property makes an object thenable that can lead to errors with Promises. Contributed by @togami2864

  • Add noUselessTernary that disallows conditional expressions ( ternaries) when simpler alternatives exist.

    var a = x ? true : true; // this could be simplified to `x`
    
Enhancements
Bug fixes

Fix #1061. noRedeclare no longer reports overloads of export default function. Contributed by @Conaclos

The following code is no longer reported:

export default function(a: boolean): boolean;
export default function(a: number): number;
export default function(a: number | boolean): number | boolean {
  return a;
}

Fix #651, useExhaustiveDependencies no longer reports out of scope dependencies. Contributed by @kalleep

The following code is no longer reported:

let outer = false;

const Component = ({}) => {
  useEffect(() => {
    outer = true;
  }, []);
}

Fix #1191. noUselessElse now preserve comments of the else clause. Contributed by @Conaclos

For example, the rule suggested the following fix:

  function f(x) {
    if (x <0) {
      return 0;
    }
-   // Comment
-   else {
      return x;
-   }
  }

Now the rule suggests a fix that preserves the comment of the else clause:

  function f(x) {
    if (x <0) {
      return 0;
    }
    // Comment
-   else {
      return x;
-   }
  }

Fix #1383. noConfusingVoidType now accepts the void type in type parameter lists.

The rule no longer reports the following code:

f<void>();

Fix #728. useSingleVarDeclarator no longer outputs invalid code. Contributed by @Conaclos

Fix #1167. useValidAriaProps no longer reports aria-atomic as invalid. Contributed by @unvalley

Fix #1192. useTemplate now correctly handles parenthesized expressions and respects type coercions. Contributed by @n-gude

These cases are now properly handled:

"a" + (1 + 2) // `a${1 + 2}`
1 + (2 + "a") // `${1}${2}a`

Fix #1456. useTemplate now reports expressions with an interpolated template literal and non-string expressions. Contributed by @n-gude

The following code is now reported:

`a${1}` + 2;

Fix #1436. useArrowFunction now applies a correct fix when a function expression is used in a call expression or a member access. Contributed by @Conaclos

For example, the rule proposed the following fix:

- const called = function() {}();
+ const called = () => {}();

It now proposes a fix that adds the needed parentheses:

- const called = function() {}();
+ const called = (() => {})();

Fix #696. useHookAtTopLevel now correctly detects early returns before the calls to the hook.

  • The code fix of noUselessTypeCOnstraint now adds a trailing comma when needed to disambiguate a type parameter list from a JSX element. COntributed by @Conaclos

Fix #578. useExhaustiveDependencies now correctly recognizes hooks namespaced under the React namespace. Contributed by @XiNiHa

Fix #910. noSvgWithoutTitle now ignores <svg> element with aria-hidden="true". COntributed by @vasucp1207

Parser

BREAKING CHANGES
  • The representation of imports has been simplified. Contributed by @Conaclos

    The new representation is closer to the ECMAScript standard. It provides a single way of representing a namespace import such as import * as ns from "". It rules out some invalid states that was previously representable. For example, it is no longer possible to represent a combined import with a type qualifier such as import type D, { N } from "".

    See #1163 for more details.

New features
  • Imports and exports with both an import attribute and a type qualifier are now reported as parse errors.

    import type A from "mod" with { type: "json" };
    //     ^^^^              ^^^^^^^^^^^^^^^^^^^^^
    //     parse error
    
Bug fixes
  • Fix #1077 where parenthesized identifiers in conditional expression were being parsed as arrow expressions. Contributed by @kalleep

    These cases are now properly parsed:

    JavaScript:

      a ? (b) : a => {};
    

    TypeScript:

      a ? (b) : a => {};
    

    JSX:

      bar ? (foo) : (<a>{() => {}}</a>);
    
  • Allow empty type parameter lists for interfaces and type aliases (#1237). COntributed by @togami2864

    TypeScript allows interface declarations and type aliases to have empty type parameter lists. Previously Biome didn't handle this edge case. Now, it correctly parses this syntax:

    interface Foo<> {}
    type Bar<> = {};
    

Crates

BREAKING CHANGES
  • Rename the biome_js_unicode_table crate to biome_unicode_table (#1302). COntributed by @chansuke
dominionl
published 1.4.1-nightly.d869a33 •

dominionl
published 1.4.1-nightly.22dd4e1 •

dominionl
published 1.4.1-nightly.efc084c •

dominionl
published 1.4.1-nightly.e087146 •

dominionl
published 1.4.1-nightly.570d680 •

dominionl
published 1.4.1-nightly.bc772a3 •

dominionl
published 1.4.1 •

Changelog

Source

1.4.1 (2023-11-30)

Editors

Bug fixes
  • Fix #933. Some files are properly ignored in the LSP too. E.g. package.json, tsconfig.json, etc.
  • Fix #1394, by inferring the language extension from the internal saved files. Now newly created files JavaScript correctly show diagnostics.

Formatter

Bug fixes
  • Fix some accidental line breaks when printing array expressions within arrow functions and other long lines #917. Contributed by @faultyserver

  • Match Prettier's breaking strategy for ArrowChain layouts #934. Contributed by @faultyserver

  • Fix double-printing of leading comments in arrow chain expressions #951. Contributed by @faultyserver

Linter

Bug fixes
  • Fix #910, where the rule noSvgWithoutTitle should skip elements that have aria-hidden attributes. Contributed by @vasucp1207
New features
  • Add useForOf rule. The rule recommends a for-of loop when the loop index is only used to read from an array that is being iterated. Contributed by @victor-teles
Enhancement
  • Address #924 and #920. noUselessElse now ignores else clauses that follow at least one if statement that doesn't break early. Contributed by @Conaclos

    For example, the following code is no longer reported by the rule:

    function f(x) {
        if (x < 0) {
          // this `if` doesn't break early.
        } else if (x > 0) {
            return x;
        } else {
            // This `else` block was previously reported as useless.
        }
    }
    
Bug fixes

Fix #918. useSimpleNumberKeys no longer repports false positive on comments. Contributed by @kalleep

  • Fix #953. noRedeclare no longer reports type parameters with the same name in different mapped types as redeclarations. Contributed by @Conaclos

Fix #608. useExhaustiveDependencies no longer repports missing dependencies for React hooks without dependency array. Contributed by @kalleep

Parser

dominionl
published 1.4.0 •

Changelog

Source

1.4.0 (2023-11-27)

CLI

  • Remove the CLI options from the lsp-proxy, as they were never meant to be passed to that command. Contributed by @ematipico

  • Add option --config-path to lsp-proxy and start commands. It's now possible to tell the Daemon server to load biome.json from a custom path. Contributed by @ematipico

  • Add option --diagnostic-level. It lets users control the level of diagnostics printed by the CLI. Possible values are: "info", "warn", and "hint". Contributed by @simonxabris

  • Add option --line-feed to the format command. Contributed by @SuperchupuDev

  • Add option --bracket-same-line to the format command. Contributed by @faultyserver

  • Add option --bracket-spacing to the format command. Contributed by @faultyserver

Bug fixes
  • Fix the command format, now it returns a non-zero exit code when if there pending diffs. Contributed by @ematipico

Formatter

New features
  • Add the configuration formatter.lineFeed. It allows changing the type of line endings. Contributed by @SuperchupuDev

  • Add the configuration javascript.formatter.bracketSameLine. It allows controlling whether ending > of a multi-line JSX element should be on the last attribute line or not. #627. Contributed by @faultyserver

  • Add the configuration javascript.formatter.bracketSpacing. It allows controlling whether spaces are inserted around the brackets of object literals. #627. Contributed by @faultyserver

Bug fixes
  • Fix #832, the formatter no longer keeps an unnecessary trailing comma in type parameter lists. Contributed by @Conaclos

    - class A<T,> {}
    + class A<T> {}
    
  • Fix #301, the formatter should not break before the in keyword. Contributed by @ematipico

Linter

Promoted rules

The following rules are now recommended:

The following rules are now deprecated:

New features
  • Add noDefaultExport which disallows export default. Contributed by @Conaclos

  • Add noAriaHiddenOnFocusable which reports hidden and focusable elements. Contributed by @vasucp1207

  • Add noImplicitAnyLet that reports variables declared with let and without initialization and type annotation. Contributed by @TaKO8Ki and @b4s36t4

  • Add useAwait that reports async functions that don't use an await expression.

  • Add useValidAriaRole. Contributed by @vasucp1207

  • Add useRegexLiterals that suggests turning call to the regex constructor into regex literals. COntributed by @Yuiki

Enhancements
Bug fixes
  • Fix #639 by ignoring unused TypeScript's mapped key. Contributed by @Conaclos

  • Fix #565 by handling several infer with the same name in extends clauses of TypeScript's conditional types. Contributed by @Conaclos

Fix #653. noUnusedImports now correctly removes the entire line where the unused import is. Contributed by @Conaclos

  • Fix #607 useExhaustiveDependencies, ignore optional chaining, Contributed by @msdlisper

  • Fix #676, by using the correct node for the "noreferrer" when applying the code action. Contributed by @ematipico

  • Fix #455. The CLI can now print complex emojis to the console correctly.

Fix #727. noInferrableTypes now correctly keeps type annotations when the initialization expression is null. Contributed by @Conaclos

Fix #784, noSvgWithoutTitle fixes false-positives to aria-label and reports svg's role attribute is implicit. Contributed by @unvalley

Parser

Bug fixes
  • Fix #846 that erroneously parsed <const T,>() => {} as a JSX tag instead of an arrow function when both TypeScript and JSX are enabled.

VSCode

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc