Socket
Socket
Sign inDemoInstall

@biomejs/biome

Package Overview
Dependencies
6
Maintainers
4
Versions
63
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install
Previous134567Next

1.7.0

Diff

Changelog

Source

1.7.0 (2024-04-15)

Analyzer

Bug fixes
  • Now Biome can detect the script language in Svelte and Vue script blocks more reliably (#2245). Contributed by @Sec-ant

  • useExhaustiveDependencies no longer reports recursive calls as missing dependencies (#2361). Contributed by @arendjr

  • useExhaustiveDependencies correctly reports missing dependencies declared using function declarations (#2362). Contributed by @arendjr

  • Biome now can handle .svelte and .vue files with CRLF as the end-of-line sequence. Contributed by @Sec-ant

  • noMisplacedAssertion no longer reports method calls by describe, test, it objects (e.g. test.each([])()) (#2443). Contributed by @unvalley.

  • Biome now can handle .vue files with generic components (#2456).

    <script generic="T extends Record<string, any>" lang="ts" setup>
    //...
    </script>
    

    Contributed by @Sec-ant

Enhancements
  • Complete the well-known file lists for JSON-like files. Trailing commas are allowed in .jsonc files by default. Some well-known files like tsconfig.json and .babelrc don't use the .jsonc extension but still allow comments and trailing commas. While others, such as .eslintrc.json, only allow comments. Biome is able to identify these files and adjusts the json.parser.allowTrailingCommas option accordingly to ensure they are correctly parsed. Contributed by @Sec-ant

  • Fix dedent logic inconsistent with prettier where the indent-style is space and the indent-width is not 2. Contributed by @mdm317

CLI

New features
  • Add a command to migrate from ESLint

    biome migrate eslint allows you to migrate an ESLint configuration to Biome. The command supports legacy ESLint configurations and new flat ESLint configurations. Legacy ESLint configurations using the YAML format are not supported.

    When loading a legacy ESLint configuration, Biome resolves the extends field. It resolves both shared configurations and plugin presets! To do this, it invokes Node.js.

    Biome relies on the metadata of its rules to determine the equivalent rule of an ESLint rule. A Biome rule is either inspired or roughly identical to an ESLint rules. By default, inspired and nursery rules are excluded from the migration. You can use the CLI flags --include-inspired and --include-nursery to migrate them as well.

    Note that this is a best-effort approach. You are not guaranteed to get the same behavior as ESLint.

    Given the following ESLint configuration:

    {
          "ignore_patterns": ["**/*.test.js"],
          "globals": { "var2": "readonly" },
          "rules": {
              "eqeqeq": "error"
          },
          "overrides": [{
              "files": ["lib/*.js"],
              "rules": {
                "default-param-last": "off"
              }
          }]
    }
    

    biome migrate eslint --write changes the Biome configuration as follows:

    {
      "linter": {
        "rules": {
          "recommended": false,
          "suspicious": {
            "noDoubleEquals": "error"
          }
        }
      },
      "javascript": { "globals": ["var2"] },
      "overrides": [{
        "include": ["lib/*.js"],
        "linter": {
          "rules": {
            "style": {
              "useDefaultParameterLast": "off"
            }
          }
        }
      }]
    }
    

    Also, if the working directory contains .eslintignore, then Biome migrates the glob patterns. Nested .eslintignore in subdirectories and negated glob patterns are not supported.

    If you find any issue, please don't hesitate to report them.

    Contributed by @Conaclos

  • Added two new options to customise the emitted output of the CLI: --reporter=json and --reporter=json-pretty. With --reporter=json, the diagnostics and the summary will be printed in the terminal in JSON format. With --reporter=json-pretty, you can print the same information, but formatted using the same options of your configuration.

    NOTE: the shape of the JSON is considered experimental, and the shape of the JSON might change in the future.

    <details> <summary>Example of output when running `biome format` command</summary> ```json { "summary": { "changed": 0, "unchanged": 1, "errors": 1, "warnings": 0, "skipped": 0, "suggestedFixesSkipped": 0, "diagnosticsNotPrinted": 0 }, "diagnostics": [ { "category": "format", "severity": "error", "description": "Formatter would have printed the following content:", "message": [ { "elements": [], "content": "Formatter would have printed the following content:" } ], "advices": { "advices": [ { "diff": { "dictionary": " statement();\n", "ops": [ { "diffOp": { "delete": { "range": [0, 2] } } }, { "diffOp": { "equal": { "range": [2, 12] } } }, { "diffOp": { "delete": { "range": [0, 2] } } }, { "diffOp": { "equal": { "range": [12, 13] } } }, { "diffOp": { "delete": { "range": [0, 2] } } }, { "diffOp": { "insert": { "range": [13, 15] } } } ] } } ] }, "verboseAdvices": { "advices": [] }, "location": { "path": { "file": "format.js" }, "span": null, "sourceCode": null }, "tags": [], "source": null } ], "command": "format" } ``` </details>
  • Added new --staged flag to the check, format and lint subcommands.

    This new option allows users to apply the command only to the files that are staged (the ones that will be committed), which can be very useful to simplify writing git hook scripts such as pre-commit. Contributed by @castarco

Enhancements
  • Improve support of .prettierignore when migrating from Prettier

    Now, Biome translates most of the glob patterns in .prettierignore to the equivalent Biome ignore pattern. Only negated glob patterns are not supported.

    Contributed by @Conaclos

  • Support JavaScript configuration files when migrating from Prettier

    biome migrate prettier is now able to migrate Prettier configuration files ending with js, mjs, or cjs extensions. To do this, Biome invokes Node.js.

    Also, embedded Prettier configurations in package.json are now supported.

    Contributed by @Conaclos

  • Support overrides field in Prettier configuration files when migrating from Prettier. Contributed by @Conaclos

  • Support passing a file path to the --config-path flag or the BIOME_CONFIG_PATH environment variable.

    Now you can pass a .json/.jsonc file path with any filename to the --config-path flag or the BIOME_CONFIG_PATH environment variable. This will disable the configuration auto-resolution and Biome will try to read the configuration from the said file path (#2265).

    biome format --config-path=../biome.json ./src
    

    Contributed by @Sec-ant

Bug fixes
  • Biome now tags the diagnostics emitted by organizeImports and formatter with correct severity levels, so they will be properly filtered by the flag --diagnostic-level (#2288). Contributed by @Sec-ant

  • Biome now correctly filters out files that are not present in the current directory when using the --changed flag #1996. Contributed by @castarco

  • Biome now skips traversing fifo or socket files (#2311). Contributed by @Sec-ant

  • Biome now resolves configuration files exported from external libraries in extends from the working directory (CLI) or project root (LSP). This is the documented behavior and previous resolution behavior is considered as a bug (#2231). Contributed by @Sec-ant

Configuration

Bug fixes
  • Now setting group level all to false can disable recommended rules from that group when top level recommended is true or unset. Contributed by @Sec-ant

  • Biome configuration files can correctly extends .jsonc configuration files now (#2279). Contributed by @Sec-ant

  • Fixed the JSON schema for React hooks configuration (#2396). Contributed by @arendjr

Enhancements
  • Biome now displays the location of a parsing error for its configuration file (#1627).

    Previously, when Biome encountered a parsing error in its configuration file, it didn't indicate the location of the error. It now displays the name of the configuration file and the range where the error occurred.

    Contributed by @Conaclos

  • options is no longer required for rules without any options (#2313).

    Previously, the JSON schema required to set options to null when an object is used to set the diagnostic level of a rule without any option. However, if options is set to null, Biome emits an error.

    The schema is now fixed and it no longer requires specifying options. This makes the following configuration valid:

    {
      "linter": {
        "rules": {
          "style": {
            "noDefaultExport": {
              "level": "off"
            }
          }
        }
      }
    }
    

    Contributed by @Conaclos

Editors

Bug fixes

Formatter

Bug fixes
  • Fix #2291 by correctly handle comment placement for JSX spread attributes and JSX spread children. Contributed by @ah-yu

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 a new option jsxRuntime to the javascript configuration. When set to reactClassic, the noUnusedImports and useImportType rules use this information to make exceptions for the React global that is required by the React Classic JSX transform.

    This is only necessary for React users who haven't upgraded to the new JSX transform.

    Contributed by @Conaclos and @arendjr

  • Implement #2043: The React rule useExhaustiveDependencies is now also compatible with Preact hooks imported from preact/hooks or preact/compat. Contributed by @arendjr

  • Add rule noFlatMapIdentity to disallow unnecessary callback use on flatMap. Contributed by @isnakode

  • Add rule noConstantMathMinMaxClamp, which disallows using Math.min and Math.max to clamp a value where the result itself is constant. Contributed by @mgomulak

Enhancements
  • style/useFilenamingConvention now allows prefixing a filename with + (#2341).

    This is a convention used by Sveltekit and Vike.

    Contributed by @Conaclos

  • style/useNamingConvention now accepts PascalCase for local and top-level variables.

    This allows supporting local variables that hold a component or a regular class. The following code is now accepted:

    function loadComponent() {
      const Component = getComponent();
      return <Component />;
    }
    

    Contributed by @Conaclos

  • complexity/useLiteralKeys no longer report computed properties named __proto__ (#2430).

    In JavaScript, {["__proto__"]: null} and {__proto__: null} have not the same semantic. The first code set a regular property to null. The second one set the prototype of the object to null. See the MDN Docs for more details.

    The rule now ignores computed properties named __proto__.

    Contributed by @Conaclos

Bug fixes
  • Lint rules useNodejsImportProtocol, useNodeAssertStrict, noRestrictedImports, noNodejsModules will no longer check declare module statements anymore. Contributed by @Sec-ant

  • style/useNamingConvention now accepts any case for variables from object destructuring (#2332).

    The following name is now ignored:

    const { Strange_Style } = obj;
    

    Previously, the rule renamed this variable. This led to a runtime error.

    Contributed by @Conaclos

Parser

Bug fixes
  • Fixed an issue when Unicode surrogate pairs were encoded in JavaScript strings using an escape sequence (#2384). Contributed by @arendjr
dominionl
published 1.6.4-nightly.abab451 •

dominionl
published 1.6.4-nightly.a995ada •

dominionl
published 1.6.4 •

Changelog

Source

1.6.4 (2024-04-03)

Analyzer

Bug fixes
  • An operator with no spaces around in a binary expression no longer breaks the js analyzer (#2243). Contributed by @Sec-ant

CLI

Bug fixes
  • Fix the printed error count (#2048). Contributed by @Sec-ant

Configuration

Bug fixes
  • Correctly calculate enabled rules in lint rule groups. Now a specific rule belonging to a group can be enabled even if its group-level preset option recommended or all is false (#2191). Contributed by @Sec-ant

Editors

Bug fixes
  • Fix the unexpected code deletion and repetition when quickfix.biome is enabled and some import-related rules are applied (#2222, #688, #1015). Contributed by @Sec-ant

Linter

New features
Bug fixes
  • Fix #2211. noChildrenProp should work fine when children pass as a prop in a new line. Contributed by @fireairforce

  • Fix #2248. lint/a11y/useButtonType should not trigger when button element with spread attribute. Contributed by @fireairforce

  • Fix #2216. lint/style/useNamingConvention should not ignore JSX Component name binding. Contributed by @fireairforce

Enhancements
  • Add support for object property members in the rule useSortedClasses. Contributed by @ematipico

Parser

  • The parser doesn't throw any error when the frontmatter of .astro files contains an illegal return:

    ---
    const condition = true;
    if (condition) {
      return "Something";
    }
    ---
    <div></div>
    

    Contributed by @ematipico

dominionl
published 1.6.3 •

Changelog

Source

1.6.3 (2024-03-25)

CLI

Bug fixes
  • Fix configuration resolution. Biome is now able to correctly find the biome.jsonc configuration file when --config-path is explicitly set (#2164). Contributed by @Sec-ant

  • JavaScript/TypeScript files of different variants (.ts, .js, .tsx, .jsx) in a single workspace now have stable formatting behaviors when running the CLI command in paths of different nested levels or in different operating systems (#2080, #2109). Contributed by @Sec-ant

Configuration

Bug fixes
  • Complete the documentation and overrides support for options formatter.lineEnding, [language].formatter.lineEnding, formatter.attributePosition and javascript.formatter.attributePosition. Contributed by @Sec-ant

Formatter

Bug fixes
  • Fix #2172 by breaking long object destructuring patterns. Contributed by @ah-yu

Linter

New features
  • Add rule noEvolvingAny to disallow variables from evolving into any type through reassignments. Contributed by @fujiyamaorange
Enhancements
  • Rename noSemicolonInJsx to noSuspiciousSemicolonInJsx. Contributed by @fujiyamaorange

LSP

Bug fixes
  • Quickfix action no longer autofixes lint rule errors on save when linter is disabled (#2161). Contributed by @Sec-ant
  • Range formatting for Astro/Svelte/Vue doesn't place code out of place, especially when formatting on paste is enabled. Contributed by @ematipico
dominionl
published 1.6.2 •

Changelog

Source

1.6.2 (2024-03-22)

Analyzer

Bug fixes
  • The noSuperWithoutExtends rule now allows for calling super() in derived class constructors of class expressions (#2108). Contributed by @Sec-ant

  • Fix discrepancies on file source detection. Allow module syntax in .cts files (#2114). Contributed by @Sec-ant

CLI

Bug fixes
  • Fixes #2131, where folders were incorrectly ignored when running the command check. Now folders are correctly ignored based on their command. Contributed by @ematipico

  • Smoother handling of "endOfLine": "auto" in prettier migration: falling back to "lf" (#2145). Contributed by @eMerzh

Configuration

Bug fixes
  • Fix enabled rules calculation. The precendence of individual rules, all and recommend presets in top-level and group-level configs is now correctly respected. More details can be seen in (#2072) (#2028). Contributed by @Sec-ant

Formatter

Bug fixes
  • Fix #1661. Now nested conditionals are aligned with Prettier's logic, and won't contain mixed spaces and tabs. Contributed by @ematipico

JavaScript APIs

Enhancements
  • Support applying lint fixes when calling the lintContent method of the Biome class (#1956). Contributed by @mnahkies

Linter

New features
Bug fixes
  • Rule noUndeclaredDependencies now also validates peerDependencies and optionalDependencies (#2122). Contributed by @Sec-ant

  • Rule noUndeclaredDependencies won't check declare module statements anymore (#2123). Contributed by @Sec-ant

  • Fix #1925. The fix for useOptionalChain would sometimes suggest an incorrect fix that discarded optional chaining operators on the left-hand side of logical expressions. These are now preserved. Contributed by @arendjr

  • Rule noUndeclaredVariables now also checks for worker globals (#2121). Contributed by @Sec-ant

LSP

Bug fixes
  • Correctly parse .jsonc files. Contributed by @Sec-ant

  • Correctly resolve external extends configs. Contributed by @Sec-ant

dominionl
published 1.6.1 •

Changelog

Source

1.6.1 (2024-03-12)

CLI

Bug fixes
  • CLI is now able to automatically search and resolve biome.jsonc (#2008). Contributed by @Sec-ant
  • Fix a false positive where some files were counted as "fixed" even though they weren't modified. Contributed by @ematipico

Configuration

Bug fixes
  • json.formatter.trailingCommas option now works in overrides (#2009). Contributed by @Sec-ant

Linter

New features
  • Add rule noDoneCallback, this rule checks the function parameter of hooks & tests for use of the done argument, suggesting you return a promise instead. Contributed by @vasucp1207

    beforeEach(done => {
      // ...
    });
    
Bug fixes
  • useJsxKeyInIterable now recognizes function bodies wrapped in parentheses (#2011). Contributed by @Sec-ant

  • useShorthandFunctionType now preserves type parameters of generic interfaces when applying fixes (#2015). Contributed by @Sec-ant

  • Code fixes of useImportType and useExportType now handle multiline statements (#2041). Contributed by @Conaclos

  • noRedeclare no longer reports type parameter and parameter with identical names (#1992).

    The following code is no longer reported:

    function f<a>(a: a) {}
    

    Contributed by @Conaclos

  • noRedeclare now reports duplicate type parameters in a same declaration.

    The following type parameters are now reported as a redeclaration:

    function f<T, T>() {}
    

    Contributed by @Conaclos

  • noUndeclaredDependencies now recognizes imports of subpath exports.

    E.g., the following import statements no longer report errors if @mui/material and tailwindcss are installed as dependencies:

    import Button from "@mui/material/Button";
    import { fontFamily } from "tailwindcss/defaultTheme";
    

    Contributed by @Sec-ant

Parser

Bug fixes
  • JavaScript lexer is now able to lex regular expression literals with escaped non-ascii chars (#1941).

    Contributed by @Sec-ant

dominionl
published 1.6.0 •

Changelog

Source

1.6.0 (2024-03-08)

Analyzer

New features
  • Add partial for .astro files. Biome is able to sort imports inside the frontmatter of the Astro files. Contributed by @ematipico

    ---
    - import { getLocale } from "astro:i18n";
    - import { Code } from "astro:components";
    + import { Code } from "astro:components";
    + import { getLocale } from "astro:i18n";
    ---
    
    <div></div>
    
  • Add partial for .vue files. Biome is able to sort imports inside the script block of Vue files. Contributed by @nhedger

    <script setup lang="ts">
    - import Button from "./components/Button.vue";
    - import * as vueUse from "vue-use";
    + import * as vueUse from "vue-use";
    + import Button from "./components/Button.vue";
    </script/>
    
    <template></template>
    
  • Add partial for .svelte files. Biome is able to sort imports inside the script block of Svelte files. Contributed by @ematipico

    <script setup lang="ts">
    - import Button from "./components/Button.svelte";
    - import * as svelteUse from "svelte-use";
    + import * as svelteUse from "svelte-use";
    + import Button from "./components/Button.svelte";
    </script/>
    
    <div></div>
    
  • The analyzer now infers the correct quote from javascript.formatter.quoteStyle, if set. This means that code fixes suggested by the analyzer will use the same quote of the formatter. Contributed by @ematipico

Enhancements
  • noUnusedVariables ignores unused rest spread siblings.

    The following code is now valid:

    const { a, ...rest } = { a: 0, b: 1 };
    console.log(rest);
    

    Contributed by @ah-yu

  • Fix #1931. Built-in React hooks such as useEffect() can now be validated by the useExhaustiveDependendies, even when they're not being imported from the React library. To do so, simply configure them like any other user-provided hooks.

    Contributed by @arendjr

  • Implemented #1128. User-provided React hooks can now be configured to track stable results. For example:

    "useExhaustiveDependencies": {
        "level": "error",
        "options": {
            "hooks": [{
                "name": "useMyState",
                "stableResult": [
                    1
                ]
            }]
        }
    }
    

    This will allow the following to be validated:

    const [myState, setMyState] = useMyState();
    const toggleMyState = useCallback(() => {
      setMyState(!myState);
    }, [myState]); // Only `myState` needs to be specified here.
    

    Contributed by @arendjr

Bug fixes
  • 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

  • Imports that contain the protocol : are now sorted after the npm: modules, and before the URL modules. Contributed by @ematipico

    import express from "npm:express";
    - import Component from "./component.js"
    - import { sortBy } from "virtual:utils";
    + import { sortBy } from "virtual:utils";
    + import Component from "./component.js"
    
  • Fix #1081. The useAwait rule does not report for await...of. Contributed by @unvalley

  • Fix #1827 by properly analyzing nested try-finally statements. Contributed by @ah-yu

  • Fix #1924 Use the correct export name to sort in the import clause. Contributed by @ah-yu

  • Fix #1805 fix formatting arrow function which has conditional expression body Contributed by @mdm317

  • Fix #1781 by avoiding the retrieval of the entire static member expression for the reference if the static member expression does not start with the reference. Contributed by @ah-yu

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.

  • Now the file name printed in the diagnostics is clickable. If you run the CLI from your editor, you can <kbd> Ctrl</kbd>/<kbd title="Cmd"></kbd> + Click on the file name, and the editor will open said file. If row and columns are specified e.g. file.js:32:7, the editor will set the cursor right in that position. Contributed by @ematipico

  • Add an option --linter to biome rage. The option needs to check Biome linter configuration. Contributed by @seitarof

  • Add an option --formatter to biome rage. The option needs to check Biome formatter configuration. Contributed by @seitarof

  • The CLI now consistently reports the number of files tha were changed, out of the total files that were analysed. Contributed by @ematipico

  • The CLI now consistently shows the number of errors and warnings emitted. Contributed by @ematipico

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 completely skips the content of ignored directories.

    For now, directories cannot be ignored using files.include in the configuration file. This is a known limitation that we want to address in a future release.

    For instance, if you have a project with a folder src and a folder test, the following configuration doesn't completely ignore test.

    {
      "files": {
        "include": ["src"]
      }
    }
    

    Biome will traverse test, however all files of the directory are correctly ignored. This can result in file system errors, if Biome encounters dangling symbolic links or files with higher permissions.

    To avoid traversing the test directory, you should ignore the directory using ignore:

    {
      "files": {
        "include": ["src"],
        "ignore": ["test"]
      }
    }
    
  • 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

  • Fix #1774 by taking into account the option --no-errors-on-unmatched when running the CLI using --changed. Contributed by @antogyn

Enhancements
  • Removed a superfluous diagnostic that was printed during the linting/check phase of a file:

    test.js check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    
      × The file contains diagnostics that needs to be addressed.
    

    Contributed by @ematipico

  • The command format now emits parsing diagnostics if there are any, and it will terminate with a non-zero exit code. 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>
    
  • Add partial for .svelte files. Biome is able to format the script block of Svelte files. Contributed by @ematipico

    <script setup lang="ts">
    - statement ( );
    + statement();
    </script/>
    
    <div></div>
    
Enhancements
  • composer.json, deno.json, jsconfig.json, package.json and tsconfig.json are no longer protected files.

    This means that you can now format them.

    If you want to ignore these files, you can use the files.ignore configuration:

    {
      "files": {
        "ignore": [
          "composer.json",
          "jsconfig.json",
          "package.json",
          "tsconfig.json",
          "typescript.json",
          "deno.json",
          "deno.jsonc"
        ]
      }
    }
    

    The following files are still protected, and thus ignored:

    • composer.lock
    • npm-shrinkwrap.json
    • package-lock.json
    • yarn.lock

    Contributed by @pattrickrice and @Conaclos

Bug fixes
  • Fix #1039. Check unicode width instead of number of bytes when checking if regex expression is a simple argument.

    This no longer breaks.

    s(/🚀🚀/).s().s();
    

    Contributed by @kalleep

  • Fix #1218, by correctly preserving empty lines in member chains. Contributed by @ah-yu

  • Fix #1659 and #1662, by correctly taking into account the leading comma inside the formatter options. Contributed by @ematipico

  • Fix #1934. Fix invalid formatting of long arrow function for AsNeeded arrow parens Contributed by @fireairforce

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:

Additionally, the following rules are now recommended:

Removed rules
  • Remove nursery/useGroupedTypeImport. The rule style/useImportType covers the behavior of this rule.

    Note that removing a nursery rule is not considered a breaking change according to our semantic versioning.

    Contributed by @Conaclos

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 noUndeclaredDependencies, to detect the use of dependencies that aren't present in the package.json.

    The rule ignores imports using a protocol such as node:, bun:, jsr:, https:.

    Contributed by @ematipico and @Conaclos

  • Add rule noNamespaceImport, to report namespace imports:

    import * as foo from "foo";
    

    Contributed by @unvalley

  • Add partial support for .astro files. Biome is able to lint and fix the frontmatter of the Astro files. Contributed by @ematipico

    ---
    - delete a.b
    + a.b = undefined
    ---
    
    <div></div>
    
  • Add partial support for .vue files. Biome is able to lint and fix the script block of the Vue files.

    <script setup lang="ts">
    - delete a.b
    + a.b = undefined
    <script>
    
    <template></template>
    

    Contributed by @nhedger

  • Add rule useNodeAssertStrict, which promotes the use of node:assert/strict over node:assert. Contributed by @ematipico

  • Add rule noExportsInTest which disallows export or modules.exports in files containing test. Contributed by @ah-yu

  • Add rule noSemicolonInJsx to detect possible wrong semicolons inside JSX elements.

    const Component = () => {
      return (
        <div>
          <div />;
        </div>
      );
    }
    

    Contributed by @fujiyamaorange

  • Add rule noBarrelFile, to report the usage of barrel file:

    export * from "foo";
    

    Contributed by @togami2864

  • Add rule noReExportAll that report export * from "mod". Contributed by @mdm317

  • Add rule noExcessiveNestedTestSuites. Contributed by @vasucp1207

  • Add rule useJsxKeyInIterable. Contributed by @vohoanglong0107

Enhancements
  • noUselessFragments now rule not triggered for jsx attributes when the fragment child is simple text.

    export function SomeComponent() {
      return <div x-some-prop={<>Foo</>} />;
    }
    

    Also fixes code action when the fragment child is of type JsxExpressionChild.

    <>
      <Hello leftIcon={<>{provider?.icon}</>} />
      {<>{provider?.icon}</>}
      <>{provider?.icon}</>
    </>
    

    Contributed by @vasucp1207

  • 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

  • useNamingConvention now supports unicase letters (#1786).

    unicase letters have a single case: they are neither uppercase nor lowercase. Previously, Biome reported names in unicase as invalid. It now accepts a name in unicase everywhere.

    The following code is now accepted:

    const 안녕하세요 = { 안녕하세요: 0 };
    

    We still reject a name that mixes unicase characters with lowercase or uppercase characters: The following names are rejected:

    const A안녕하세요 = { a안녕하세요: 0 };
    

    Contributed by @Conaclos

  • useNamingConvention and useFilenamingConvention now provides a new option requireAscii to require identifiers to be in ASCII.

    To avoid any breaking change, this option is turned off by default. We intend to turn it on in the next major release of Biome (Biome 2.0).

    Set the requireAscii rule option to true to require identifiers to be in ASCII.

    {
      "linter": {
        "rules": {
          "style": {
            "useNamingConvention": { "options": { "requireAscii": false } }
          },
          "nursery": {
            "useFilenamingConvention": { "options": { "requireAscii": false } }
          }
        }
      }
    }
    

    Contributed by @Conaclos

  • noUnusedVariables no longer reports unused imports.

    We now have a dedicated rule for reporting unused imports: noUnusedImports

    Contributed by @Conaclos

Bug fixes
  • Fix missing link in noStaticOnlyClass documentation. Contributed by @yndajas

  • noConfusingVoidType no longer reports valid use of the void type in conditional types (#1812).

    The rule no longer reports the following code:

    type Conditional<T> = T extends void ? Record<string, never> : T
    

    Contributed by @lucasweng

  • noInvalidUseBeforeDeclaration no longer reports valid use of binding patterns (#1648).

    The rule no longer reports the following code:

    const { a = 0, b = a } = {};
    

    Contributed by @Conaclos

  • noUnusedVariables no longer reports used binding patterns (#1652).

    The rule no longer reports a as unused the following code:

    const { a = 0, b = a } = {};
    export { b };
    

    Contributed by @Conaclos

  • 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

  • Fix #1765. Now the rule noDelete doesn't trigger when deleting a dataset:

    delete element.dataset.prop;
    

    Contributed by @ematipico

  • useNamingConvention and useFilenamingConvention now reject identifiers with consecutive delimiters.

    The following name is now invalid because it includes two underscores:

    export const MY__CONSTANT = 0;
    

    Note that we still allow consecutive leading and consecutive trailing underscores.

    Contributed by @Conaclos

  • Fix #1932 Allow redeclaration of type parameters in different declarations. Contributed by @keita-hino

  • Fix #1945 Allow constructor with default parameters in noUselessConstructor

  • Fix #1982 Change to iterate over the module item lists and ignore .d.ts files. 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

Website

Bug fixes
  • Fix #1981. Identify TypeScript definition files by their file path within the playground. Contributed by @ah-yu
dominionl
published 1.5.3-nightly.4fa841c •

dominionl
published 1.5.3-nightly.69f9031 •

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc