From 76167dbb1969713b82dad712faad964d11889d68 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Thu, 6 Feb 2025 08:28:51 +0000 Subject: [PATCH] ci: publish workflow via changesets (#5038) Co-authored-by: dyc3 <1808807+dyc3@users.noreply.github.com> --- .changeset/config.json | 2 +- .github/workflows/prepare_release.yml | 30 - .../{release_knope.yml => release.yml} | 221 +- .github/workflows/release_cli.yml | 4 - CHANGELOG.md | 6588 +---------------- CHANGELOG_v1.md | 6587 ++++++++++++++++ justfile | 4 - package.json | 3 +- packages/@biomejs/biome/CHANGELOG.md | 1 + .../biome/scripts/generate-packages.mjs | 36 +- 10 files changed, 6743 insertions(+), 6733 deletions(-) delete mode 100644 .github/workflows/prepare_release.yml rename .github/workflows/{release_knope.yml => release.yml} (58%) mode change 100644 => 120000 CHANGELOG.md create mode 100644 CHANGELOG_v1.md create mode 100644 packages/@biomejs/biome/CHANGELOG.md diff --git a/.changeset/config.json b/.changeset/config.json index f3c8d5e988a3..c54c930db3b9 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,6 +1,6 @@ { "$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json", - "changelog": ["@changesets/changelog-github", { "repo": "withastro/astro" }], + "changelog": ["@changesets/changelog-github", { "repo": "biomejs/biome" }], "commit": false, "fixed": [ [ diff --git a/.github/workflows/prepare_release.yml b/.github/workflows/prepare_release.yml deleted file mode 100644 index 6beb6f6b6db9..000000000000 --- a/.github/workflows/prepare_release.yml +++ /dev/null @@ -1,30 +0,0 @@ -on: - push: - branches: [ main ] -name: Prepare Release PR - -permissions: - actions: write - contents: write - pull-requests: write - -jobs: - prepare-release: - if: "!contains(github.event.head_commit.message, 'chore: prepare release')" # Skip merges from releases - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - - name: Configure Git - run: | - git config --global user.name GitHub Actions - git config user.email github-actions@github.com - - uses: knope-dev/action@407e9ef7c272d2dd53a4e71e39a7839e29933c48 # v2.1.0 - with: - version: 0.16.2 - github-token: ${{ secrets.GITHUB_TOKEN }} - - run: knope prepare-release --verbose - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - continue-on-error: true diff --git a/.github/workflows/release_knope.yml b/.github/workflows/release.yml similarity index 58% rename from .github/workflows/release_knope.yml rename to .github/workflows/release.yml index 805dcf803b76..c96a298cfc71 100644 --- a/.github/workflows/release_knope.yml +++ b/.github/workflows/release.yml @@ -1,37 +1,80 @@ name: Release on: - pull_request: - types: [ closed ] - branches: [ main ] + push: + branches: + - main +concurrency: ${{ github.workflow }}-${{ github.ref }} + +permissions: + actions: write + contents: write + pull-requests: write jobs: - retrieve-version: - if: github.head_ref == 'release/automated-ci' && github.event.pull_request.merged == true - name: Retrieve version + changesets: + name: Release runs-on: ubuntu-latest - outputs: - version: ${{ env.version }} - version_changed: ${{ steps.version.outputs.changed }} steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Setup Node.js 20.x + uses: actions/setup-node@v3 + with: + node-version: 20.x + + - name: Pin Corepack 0.20 + run: | + echo "Before: corepack => $(corepack --version || echo 'not installed')" + npm install -g corepack@0.20 + echo "After : corepack => $(corepack --version)" + corepack enable + pnpm --version + + - name: Create Release Pull Request + uses: changesets/action@v1 + with: + version: pnpm run version + commit: "ci: release" + title: "ci: release" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Check version changes + # Retrieve version of `@biomejs/biome` and `@biomejs/js-api` + version: + needs: changesets + if: steps.changesets.outputs.hasChangesets == 'false' && github.head_ref == 'changeset-release/main' + outputs: + cli-version: ${{ env.cli-version }} + js-api-version: ${{ env.cli-js-api-version }} + + steps: + - name: Check CLI version changes uses: EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425 # v2.1.5 - id: version + id: cli-version-changed with: diff-search: true file-name: packages/@biomejs/biome/package.json - - name: Set version name - if: steps.version.outputs.changed == 'true' + - name: Check JS API version changes + uses: EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425 # v2.1.5 + id: js-api-version-changed + with: + diff-search: true + file-name: packages/@biomejs/js-api/package.json + + - name: Set Biome Version as Environment Variable run: | - echo "Version change found! New version: ${{ steps.version.outputs.version }} (${{ steps.version.outputs.version_type }})" - echo "version=${{ steps.version.outputs.version }}" >> $GITHUB_ENV + echo "cli-version=${{ steps.cli-version-changed.outputs.version }}" >> $GITHUB_ENV + echo "js-api-version=${{ steps.js-api-version-changed.outputs.version }}" >> $GITHUB_ENV + # Building jobs - build: + build-binaries: + needs: version + if: steps.cli-version-changed.outputs.changed == 'true' strategy: matrix: include: @@ -59,13 +102,9 @@ jobs: - os: macos-14 target: aarch64-apple-darwin code-target: darwin-arm64 + name: Package ${{ matrix.code-target }} runs-on: ${{ matrix.os }} - needs: retrieve-version - env: - version: ${{ needs.check.outputs.version }} - outputs: - version: ${{ env.version }} steps: - name: Checkout repository @@ -76,14 +115,8 @@ jobs: with: node-version: 20 - - name: Install toolchain - uses: moonrepo/setup-rust@e013866c4215f77c925f42f60257dec7dd18836e # v1.2.1 - with: - channel: stable - cache-target: release - cache-base: main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install Rust toolchain + run: rustup target add ${{ matrix.target }} - name: Install arm64 toolchain if: matrix.code-target == 'linux-arm64' || matrix.code-target == 'linux-arm64-musl' @@ -115,7 +148,7 @@ jobs: # Strip all debug symbols from the resulting binaries RUSTFLAGS: "-C strip=symbols -C codegen-units=1" # Inline the version of the npm package in the CLI binary - BIOME_VERSION: ${{ env.version }} + BIOME_VERSION: ${{ env.cli-version }} # Copy the CLI binary and rename it to include the name of the target platform - name: Copy CLI binary @@ -129,8 +162,8 @@ jobs: mkdir dist cp target/${{ matrix.target }}/release/biome ./dist/biome-${{ matrix.code-target }} - - - name: Upload Artifact + # Upload the CLI binary as a build artifact + - name: Upload CLI artifact uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 with: name: cli-${{ matrix.target }} @@ -140,7 +173,8 @@ jobs: build-wasm: name: Build WASM runs-on: ubuntu-latest - needs: retrieve-version + needs: version + if: steps.cli-version-changed.outputs.changed == 'true' steps: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -165,11 +199,60 @@ jobs: ./packages/@biomejs/wasm-web if-no-files-found: error - release: + build-js-api: + name: Package JavaScript APIs + runs-on: ubuntu-latest + needs: version + if: steps.js-api-version-changed.outputs.changed == 'true' + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Install Node.js + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 + with: + node-version: 20 + + - name: Install wasm-pack + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + + - name: Cache pnpm modules + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}- + - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 + + - name: Compile backends + run: | + pnpm --filter @biomejs/js-api run build:wasm-bundler + pnpm --filter @biomejs/js-api run build:wasm-node + pnpm --filter @biomejs/js-api run build:wasm-web + pnpm --filter @biomejs/backend-jsonrpc i + pnpm --filter @biomejs/backend-jsonrpc run build + + - name: Build package + run: | + pnpm --filter @biomejs/js-api i + pnpm --filter @biomejs/js-api run build + + - name: Upload JS API artifact + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: js-api + path: | + ./packages/@biomejs/js-api/dist + if-no-files-found: error + + # Publishing jobs + + publish-cli: name: Publish runs-on: ubuntu-latest needs: - - build + - build-binaries - build-wasm environment: npm-publish permissions: @@ -190,18 +273,29 @@ jobs: merge-multiple: true path: packages/@biomejs - - uses: knope-dev/action@407e9ef7c272d2dd53a4e71e39a7839e29933c48 # v2.1.0 + - name: Install Node.js + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: - version: 0.16.2 - github-token: ${{ secrets.GITHUB_TOKEN }} - - run: knope release + node-version: 20 + registry-url: 'https://registry.npmjs.org' + + - name: Generate npm packages + run: node packages/@biomejs/biome/scripts/generate-packages.mjs + + - name: Publish npm packages as latest + run: for package in packages/@biomejs/*; do if [ $package != "packages/@biomejs/js-api" ]; then npm publish $package --tag latest --access public --provenance; fi; done env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Upload assets to the latest tag + run: | + files=$(ls biome-* | tr '\n' ' ') + gh release upload @biomejs/biome@${{ env.cli-version }} $files - publish-npm: - name: Publish npm packages + publish-js-api: + name: Publish runs-on: ubuntu-latest - needs: release + needs: build-js-api environment: npm-publish permissions: contents: write @@ -209,47 +303,18 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Download CLI artifacts + - name: Download package artifact uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: - pattern: cli-* - merge-multiple: true - - name: Download WASM artifacts - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - pattern: wasm-* - merge-multiple: true - path: packages/@biomejs + name: js-api + path: packages/@biomejs/js-api/dist - name: Install Node.js uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: node-version: 20 registry-url: 'https://registry.npmjs.org' - - - name: Publish npm packages as latest - run: for package in packages/@biomejs/*; do if [ $package != "packages/@biomejs/js-api" ]; then npm publish $package --tag latest --access public; fi; done + - name: Publish npm package as latest + run: npm publish packages/@biomejs/js-api --tag latest --access public --provenance env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Publish npm packages as nightly - run: for package in packages/@biomejs/*; do if [ $package != "packages/@biomejs/js-api" ]; then npm publish $package --tag nightly --access public; fi; done - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - publish-crate: - name: Publish crates - needs: release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Install toolchain - uses: moonrepo/setup-rust@e013866c4215f77c925f42f60257dec7dd18836e # v1.2.1 - with: - channel: stable - cache-target: release - cache-base: main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: katyo/publish-crates@v2 - with: - registry-token: ${{ secrets.CARGO_TOKEN }} diff --git a/.github/workflows/release_cli.yml b/.github/workflows/release_cli.yml index 192e425eed32..cb54afc16e3e 100644 --- a/.github/workflows/release_cli.yml +++ b/.github/workflows/release_cli.yml @@ -15,9 +15,6 @@ jobs: runs-on: ubuntu-latest outputs: version: ${{ env.version }} - prerelease: ${{ env.prerelease }} - nightly: ${{ env.nightly }} - version_changed: ${{ steps.version.outputs.changed }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -28,7 +25,6 @@ jobs: - name: Check version changes uses: EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425 # v2.1.5 - if: env.nightly != 'true' id: version with: diff-search: true diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index ef45e7f37f97..000000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,6587 +0,0 @@ -# Biome changelog - -This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -Due to the nature of Biome as a toolchain, -it can be unclear what changes are considered major, minor, or patch. -Read our [guidelines to categorize a change](https://biomejs.dev/internals/versioning). - -New entries must be placed in a section entitled `Unreleased`. -Read -our [guidelines for writing a good changelog entry](https://github.com/biomejs/biome/blob/main/CONTRIBUTING.md#changelog). - -## Unreleased - -- Add `RegExpStringIterator` to TypeScript globals -- Fix [#4323](https://github.com/biomejs/biome/issues/4258), where `lint/a11y/useSemanticElement` accidentally showed recommendations for `role="searchbox"` instead of `role="search"` - -### Analyzer - -#### Bug fixes - -- Fix CSS parser case error, `@-moz-document url-prefix(https://example.com)` and `@-moz-document domain(example.com)` are now valid. Contributed by @eryue0220 -- Fix [#4258](https://github.com/biomejs/biome/issues/4258), where fixed css parse error with @-moz-document url-prefix(). Contributed by @eryue0220 - -### CLI - -#### Bug fixes - -- Don't parse the files that don't end with the json extension as JSON files in the `.vscode` directory ([#4391](https://github.com/biomejs/biome/issues/4391)). Contributed by @Conaclos - -- `biome migrate eslint` now correctly resolves scoped package named `eslint-config` with a path. - Contributed by @Conaclos - -- `biome migrate eslint` now correctly handles shared ESLint configuration that don't follow the ESLint naming convention ([#4528](https://github.com/biomejs/biome/issues/4528)). - - ESLint recommends that a package that exports a shared configuration be prefixed with `eslint-config-` or simply named `eslint-config`. - This is only a recommendation. - Packages that export shared configurations can have arbitrary names. - Biome is now able to load any package. - - Contributed by @Conaclos - -- `biome migrate eslint` now correctly handles ESLint configuration with `null` values in file lists ([#4740](https://github.com/biomejs/biome/issues/4740)). - Contributed by @Conaclos - -- Fix [#4202](https://github.com/biomejs/biome/issues/4202), where the formatting of the test function was different from prettier. Contributed by @mdm317 - -### Configuration - -### Editors - -### Formatter - -- Fix [#4413](https://github.com/biomejs/biome/issues/4413), where the GraphQL formatter adds a new line at the start of block comments on Windows. Contributed by @vohoanglong0107 - -### Bug fixes - -- Fix [#4121](https://github.com/biomejs/biome/issues/4326), don't ident a CSS selector when has leading comments. Contributed by @fireairforce - -- Fix [#4334](https://github.com/biomejs/biome/issues/4334), don't insert trailing comma on type import statement. Contributed by @fireairforce - -- Fix [#3229](https://github.com/biomejs/biome/issues/3229), where Biome wasn't idempotent when block comments were placed inside compound selectors. Contributed by @ematipico - -- Fix [#4026](https://github.com/biomejs/biome/issues/4026), don't move comments in `grid-template`. Contributed by @fireairforce - -- Fix [#4533](https://github.com/biomejs/biome/issues/4533), don't throw error when pseudeo class after a webkit scrollbar pseudeo element. - - The follow code will not report: - - ```css - ::-webkit-scrollbar-thumb:hover {} - ``` - - Contributed by @fireairforce - -- Fix [#4575](https://github.com/biomejs/biome/issues/4575), don't wrap selector identation after css comments. Contributed by @fireairforce - -- Fix [#4553](https://github.com/biomejs/biome/issues/4553), `noUselessFragments` fix result has invalid syntax for JSX attribute, the follow code will fix: - - ```jsx - Loading...}> - {children} - ; - ``` - - it will fix as: - - ```jsx - Loading...}> - {children} - ; - ``` - -- `noDuplicateProperties` now throws lint errors properly when we use `@supports` (fix [#4756](https://github.com/biomejs/biome/issues/4756)) Contributed by @mehm8128 - -- Fix [#4719](https://github.com/biomejs/biome/issues/4719), `bracketSameLine` now performs as expected when a comment is placed before the last JSX attribute. Contributed by @bushuai - -### JavaScript APIs - -### Linter - -#### New features - -- Add [noUselessUndefined](https://biomejs.dev/linter/rules/no-useless-undefined/). Contributed by @unvalley - -- [useFilenamingConvention](https://biomejs.dev/linter/rules/use-filenaming-convention) accepts a new option `match` ([#4105](https://github.com/biomejs/biome/issues/4105)). - - You can now validate filenames with a regular expression. - For instance, you can allow filenames to start with `%`: - - ```json - { - "linter": { - "rules": { - "style": { - "useFilenamingConvention": { - "level": "warn", - "options": { - "match": "%?(.+?)[.](.+)", - "filenameCases": ["camelCase"] - } - } - } - } - } - } - ``` - - If the regular expression captures strings, the first capture is considered to be the name of the file, and the second one to be the extensions (dot-separated values). - The name of the file and the extensions are checked against `filenameCases`. - Given the previous configuration, the filename `%index.d.ts` is valid because the first capture `index` is in `camelCase` and the second capture `d.ts` include dot-separated values in `lowercase`. - On the other hand, `%Index.d.ts` is not valid because the first capture `Index` is in `PascalCase`. - - Note that specifying `match` disallows any exceptions that are handled by the rule by default. - For example, the previous configuration doesn't allow filenames to be prefixed with underscores, - a period or a plus sign. - You need to include them in the regular expression if you still want to allow these exceptions. - - Contributed by @Conaclos - -- [useFilenamingConvention](https://biomejs.dev/linter/rules/use-filenaming-convention) and [useNamingConvention](https://biomejs.dev/linter/rules/use-naming-convention) `match` options now accept case-insensitive and case-sensitive groups. - - By default, the regular expression in `match` is case-sensitive. - You can now make it case-insensitive by using a case-insensitive group `(?i:)`. - For example, the regular expression `(?i:a)` matches `a` and `A`. - - Contributed by @Conaclos - -- [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/) now provides the `checkTypes` option ([#3998](https://github.com/biomejs/biome/issues/3998)). - - `noUndeclaredVariables` is inspired by the [no-undef ESLint rule](https://eslint.org/docs/latest/rules/no-undef). It reports all references that are not bound to any declarations within a module. - Node.js, JavaScript and TypeScript globals are ignored. - Biome provides the `javascript.globals` option to list additional globals that should be ignored by the rule. - - In TypeScript projects, developers often use global declaration files to declare global types. - Biome is currently unable to detect these global types. - This creates many false positives for `noUndeclaredVariables`. - - TypeScript is better suited to perform this kind of check. - As proof of this, TypeScript ESLint doesn't provide any rule that extends the `no-undef` ESLint rule. - - This is why we introduce today a new option `checkTypes` which, when it is set to `false`, ignores undeclared type references. - Given the following configuration... - - ```json - { - "linter": { - "rules": { - "correctness": { - "noUndeclaredVariables": { - "level": "error", - "options": { "checkTypes": false } - } - } - } - } - } - ``` - - ... `UndeclaredType` is not reported by the rule. - - ```ts - export default function(): UndeclaredType {} - ``` - - We plan to turn off the option by default in Biome 2.0 - Also, this will bring the Biome rule closer to the [no-undef ESLint rule](https://eslint.org/docs/latest/rules/no-undef). - - Contributed by @Conaclos - -- Add [noGlobalDirnameFilename](https://biomejs.dev/linter/rules/no-global-dirname-filename/). Contributed by @unvalley - -- Add [noUnwantedPolyfillio](https://biomejs.dev/linter/rules/no-unwanted-polyfillio/). Contributed by @unvalley - -- [noForEach](https://biomejs.dev/linter/rules/no-for-each/) now provides a new option `validIdentifiers` ([#3351](https://github.com/biomejs/biome/issues/3351)) to specify which variable names are allowed to call `forEach`. - - Identifiers containing dots (e.g., "lib._") or empty strings are not allowed. Invalid configurations will produce a diagnostic warning. - - ```json - { - "linter": { - "rules": { - "complexity": { - "noForEach": { - "level": "error", - "options": { - "allowedIdentifiers": ["Effect", "_"] - } - } - } - } - } - } - ``` - - Contributed by @lucasweng - -- [useSortedClasses](https://biomejs.dev/linter/rules/use-sorted-classes/) now supports wildcards in the `function` option. - - ```json - { - "linter": { - "rules": { - "nursery": { - "useSortedClasses": { - "level": "warn", - "options": { - "functions": ["tw.*"] - } - } - } - } - } - } - ``` - - This allows the rule to handle class sorting for tagged template literals like `` tw.div`...` ``, used in libraries such as [twin.macro](https://github.com/ben-rogerson/twin.macro) and [react-twc](https://github.com/gregberge/twc). - -#### Enhancements - -- `useExportType` and `useImportType` now ignore TypeScript declaration files ([#4416](https://github.com/biomejs/biome/pull/4416)). Contributed by @Conaclos -- [useArrayLiterals](https://biomejs.dev/linter/rules/use-array-literals/) now provides a code fix. - - ```diff - - const xs = new Array(); - + const xs = []; - ``` - - The code fix is currently marked as unsafe. - We plan to make it safe in a future release of Biome. - - Contributed by @Conaclos - -- `noUnusedImports` now reports empty named imports and suggests its removal ([#3574](https://github.com/biomejs/biome/issues/3574)). - - The rule now suggests the removal of empty named imports such as: - - ```diff - - import {} from "mod"; - ``` - - Contributed by @Conaclos - -- `noUnusedImports` now keeps comments separated from the import with a blank line ([#3401](https://github.com/biomejs/biome/issues/3401)). - - Here is an example: - - ```diff - // Orphan comment - - - // Header comment - - import {} from "mod"; - ``` - - Contributed by @Conaclos - -- `useValidTypeof` now accepts comparisons with variables. - - Previously, the rule required to compare a `typeof` expression against another `typeof` expression or a valid string literal. - We now accept more cases, notably comparison against a variable: - - ```js - if (typeof foo === bar) { - // ... - } - ``` - - Contributed by @Conaclos - -- [noUnknownProperty](https://biomejs.dev/linter/rules/no-unknown-property/) now accepts more known CSS properties ([#4549](https://github.com/biomejs/biome/issues/4549)). - - ```diff - - ['anchor-default', 'anchor-scroll', 'inset-area', 'position-animation', 'position-fallback', 'position-fallback-bounds', 'position-try-options'] - + ['anchor-scope', 'interpolate-size', 'line-fit-edge', 'masonry', 'masonry-auto-tracks', 'masonry-direction', 'masonry-fill', 'masonry-flow', 'masonry-slack', 'masonry-template-areas', 'masonry-template-tracks', 'position-anchor', 'position-area', 'position-try-fallbacks', 'position-visibility', 'scroll-start-target', 'text-box', 'view-transition-class', 'view-transition-group'] - ``` - - This change replaces deprecated properties, improving CSS validation. - - Contributed by @lucasweng - -#### Bug fixes - -- [noControlCharactersInRegex](https://biomejs.dev/linter/rules/no-control-characters-in-regex) no longer panics when it encounters an unterminated unicode escape sequence ([#4565](https://github.com/biomejs/biome/issues/4565)). Contributed by @Conaclos - -- [useArrayLiterals](https://biomejs.dev/linter/rules/use-array-literals/) now reports all expressions using the `Array` constructors. - - Previously, the rule reported only use of the `Array` constructor in expressions statements. - - ```js - // This was reported - new Array(); - // This was not reported - const xs = new Array(); - ``` - - Contributed by @Conaclos - -- [useArrowFunction](https://biomejs.dev/linter/rules/use-arrow-function/) now preserves directives ([#4530](https://github.com/biomejs/biome/issues/4530)). - - Previously the rule removed the directives when a function expression was turned into an arrow function. - The rule now correctly keeps the directives. - - ```diff - - const withDirective = function () { - + const withDirective = () => { - "use server"; - return 0; - } - ``` - - Contributed by @Conaclos - -- [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/) is now able to bind read of value to a type-only import in ambient contexts ([#4526](https://github.com/biomejs/biome/issues/4526)). - - In the following code, `A` is now correctly bound to the type-only import. - Previously, `A` was reported as an undeclared variable. - - ```ts - import type { A } from "mod"; - - declare class B extends A {} - ``` - - Contributed by @Conaclos - -- [noUnusedVariables](https://biomejs.dev/linter/rules/no-unused-variables/) no longer reports top-level variables in a global declaration file as unused. Contributed by @Conaclos - -- [useNamingConvention](https://biomejs.dev/linter/rules/use-naming-convention/) no longer suggests renaming top-level variables in a global declaration file. Contributed by @Conaclos - -- [noMisleadingCharacterClass](https://biomejs.dev/linter/rules/no-misleading-character-class/) no longer panics on malformed escape sequences that end with a multi-byte character ([#4587](https://github.com/biomejs/biome/issues/4587)). Contributed by @Conaclos - -- [noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports/) no longer reports used values imported as types in an external module ([#3895])(https://github.com/biomejs/biome/issues/3895). Contributed by @Conaclos - -- Fixed a panic related to bogus import statements in `useExhaustiveDependencies` ([#4568](https://github.com/biomejs/biome/issues/4568)) Contributed by @dyc3 - -- Fixed `useSortedClasses` false positive and Supplementary test case ([#3394](https://github.com/biomejs/biome/issues/3394)) Contributed by @hangaoke1 -- [noLabelWithoutControl](https://biomejs.dev/linter/rules/no-label-without-control/) detects button tags as input ([#4511])(https://github.com/biomejs/biome/issues/4511). Contributed by @unvalley - -- [noUselessFragments](https://biomejs.dev/linter/rules/no-useless-fragments/) now handles `JsxAttributeInitializerClause`, ensuring that fragments inside expressions like ` />` are preserved. ([#4208](https://github.com/biomejs/biome/issues/4208)). Contributed by @MaxtuneLee - -- [useSortedClasses](https://biomejs.dev/linter/rules/use-sorted-classes/) now suggests code fixes that match the JSX quote style of the formatter ([#4855](https://github.com/biomejs/biome/issues/4855)). Contributed by @lucasweng - -### Parser - -#### Bug fixes - -- Fix [#4317](https://github.com/biomejs/biome/issues/4317), setter parameter can contain a trailing comma, the following example will now parsed correctly: - - ```js - export class DummyClass { - set input( - value: string, - ) {} - } - ``` - - Contributed by @fireairforce - -- Fix [#3836](https://github.com/biomejs/biome/issues/3836), css parser allow multiple semicolons after a declaration, the following example will now parsed correctly: - - ```css - .foo { - color: red;; - } - ``` - - Contributed by @fireairforce - -- Fix [#342](https://github.com/biomejs/biome/issues/342), js parser handle unterminated `JSX_STRING_LITERAL` properly - - ```jsx - function Comp() { - return ( - {line || <> } - ) - } - ``` - - Contributed by @fireairforce - -- [noUnusedFunctionParameters](https://biomejs.dev/linter/rules/no-unused-function-parameters/) and [noUnusedVariables](https://biomejs.dev/linter/rules/no-unused-variables/) no longer reports a parameter as unused when another parameter has a constructor type with the same parameter name ([#4227](https://github.com/biomejs/biome/issues/4227)). - - In the following code, the `name` parameter is no longer reported as unused. - - ```ts - export class Foo { - bar(name: string, _class: new (name: string) => any) { - return name - } - } - ``` - - Contributed by @Conaclos - -- [noUndeclaredDependencies](https://biomejs.dev/linter/rules/no-undeclared-dependencies/) now accepts dependency names with dots. Contributed by @Conaclos - -- [useFilenamingConvention](https://biomejs.dev/linter/rules/use-filenaming-convention) now correctly handles renamed exports ([#4254](https://github.com/biomejs/biome/issues/4254)). - - The rule allows the filename to be named as one of the exports of the module. - For instance, the file containing the following export can be named `Button`. - - ```js - class Button {} - export { Button } - ``` - - The rule now correctly handles the renaming of an export. - For example, the file containing the following export can only be named `Button`. - Previously the rule expected the file to be named `A`. - - ```js - class A {} - export { A as Button } - ``` - - Contributed by @Conaclos - -- [useConsistentMemberAccessibility](https://biomejs.dev/linter/rules/use-consistent-member-accessibility/) now ignore private class members such as `#property` ([#4276](https://github.com/biomejs/biome/issues/4276)). Contributed by @Conaclos - -- [noUnknownFunction](https://biomejs.dev/linter/rules/no-unknown-function/) correctly handles `calc-size` function ([#4212](https://github.com/biomejs/biome/issues/4212)). - - The following code `calc-size` is no longer reported as unknown: - - ```css - .a { height: calc-size(0px); } - ``` - - Contributed by @fireairforce - - - [useNamingConvention](https://biomejs.dev/linter/rules/use-naming-convention/) now allows configuring conventions for readonly index signatures. - - Contributed by @sepruko - -- [noDuplicateCustomProperties](https://biomejs.dev/linter/rules/no-duplicate-custom-properties/) now correctly handles custom properties and ignores non-custom properties. - Previously, the rule incorrectly reported duplicates for all properties, including non-custom ones. Contributed by @togami2864 - -### Parser - -#### Bug Fixes - -- The CSS parser now accepts more emoji in identifiers ([#3627](https://github.com/biomejs/biome/issues/3627#issuecomment-2392388022)). - - Browsers accept more emoji than the standard allows. - Biome now accepts these additional emojis. - - The following code is now correctly parsed: - - ```css - p { - --✨-color: red; - color: var(--✨-color); - } - ``` - - Contributed by @Conaclos - -- Add support for parsing typescript's `resolution-mode` in Import Types([#2115](https://github.com/biomejs/biome/issues/2115)) - - ```ts - export type Fs = typeof import('fs', { with: { 'resolution-mode': 'import' } }); - export type TypeFromRequire = - import("pkg", { with: { "resolution-mode": "require" } }).TypeFromRequire; - export type TypeFromImport = - import("pkg", { with: { "resolution-mode": "import" } }).TypeFromImport; - ``` - - Contributed by @fireairforce - -## v1.9.3 (2024-10-01) - -### CLI - -#### New features - -- GritQL queries that match functions or methods will now match async functions or methods as well. - - If this is not what you want, you can capture the `async` keyword (or its absence) in a metavariable and assert its emptiness: - - ```grit - $async function foo() {} where $async <: . - ``` - - Contributed by @arendjr - -#### Bug fixes - -- Fix [#4077](https://github.com/biomejs/biome/issues/4077): Grit queries no longer need to match the statement's trailing semicolon. Contributed by @arendjr - -- Fix [#4102](https://github.com/biomejs/biome/issues/4102). Now the CLI command `lint` doesn't exit with an error code when using `--write`/`--fix`. Contributed by @ematipico - -### Configuration - -#### Bug fixes -- Fix [#4125](https://github.com/biomejs/biome/issues/4125), where `noLabelWithoutControl` options where incorrectly marked as mandatory. Contributed by @ematipico - -### Editors - -- Fix a case where CSS files weren't correctly linted using the default configuration. Contributed by @ematipico - -#### Bug fixes - -- Fix [#4116](https://github.com/biomejs/biome/issues/4116). Unify LSP code action kinds. Contributed by @vitallium - -### Formatter - -#### Bug fixes - -- Fix [#3924](https://github.com/biomejs/biome/issues/3924) where GraphQL formatter panics in block comments with empty line. Contributed by @vohoanglong0107 -- Fix [#3364](https://github.com/biomejs/biome/issues/3364) where the `useSelfClosingElements` rule forces the `script` tag to be self-closing. Previously, this rule applies to all elements and cannot be disabled for native HTML elements. - - Now, this rule accepts a `ignoreHtmlElements` option, which when set to `true`, ignores native HTML elements and allows them to be non-self-closing. - - Contributed by @abidjappie - -- Fix a case where raw values inside `url()` functions weren't properly trimmed. - ```diff - .value { - - background: url( - - whitespace-around-string - - ); - + background: url(whitespace-around-string); - } - ``` - Contributed by @ematipico - -- Fixed [#4076](https://github.com/biomejs/biome/issues/4076), where a media query wasn't correctly formatted: - ```diff - .class { - - @media (1024px <= width <=1280px) { - + @media (1024px <= width <= 1280px) { - color: red; - } - } - ``` - Contributed by @blaze-d83 - -### JavaScript API - -#### Bug fixes - -- Fix [#3881](https://github.com/biomejs/biome/issues/3881), by updating the APIs to use the latest WASM changes. Contributed by @ematipico - -### Linter - -#### New features - -- Add [noDescendingSpecificity](https://biomejs.dev/linter/rules/no-descending-specificity/). Contributed by @tunamaguro - -- Add [noNestedTernary](https://biomejs.dev/linter/rules/no-nested-ternary/). Contributed by @kaykdm - -- Add [noTemplateCurlyInString](https://biomejs.dev/linter/rules/no-template-curly-in-string/). Contributed by @fireairforce - -- Add [noOctalEscape](https://biomejs.dev/linter/rules/no-octal-escape/). Contributed by @fireairforce - -#### Enhancements - -- Add an option `reportUnnecessaryDependencies` to [useExhaustiveDependencies](https://biomejs.dev/linter/rules/use-exhaustive-dependencies/). - - Defaults to true. When set to false, errors will be suppressed for React hooks that declare dependencies but do not use them. - - Contributed by @simon-paris - -- Add an option `reportMissingDependenciesArray` to [useExhaustiveDependencies](https://biomejs.dev/linter/rules/use-exhaustive-dependencies/). Contributed by @simon-paris - -#### Bug fixes - -- [noControlCharactersInRegex](https://www.biomejs.dev/linter/rules/no-control-characters-in-regex) no longer panics on regexes with incomplete escape sequences. Contributed by @Conaclos - -- [noMisleadingCharacterClass](https://biomejs.dev/linter/rules/no-misleading-character-class/) no longer reports issues outside of character classes. - - The following code is no longer reported: - - ```js - /[a-z]👍/; - ``` - - Contributed by @Conaclos - -- [noUndeclaredDependencies](https://biomejs.dev/linter/rules/no-undeclared-dependencies/) no longer reports Node.js builtin modules as undeclared dependencies. - - The rule no longer reports the following code: - - ```js - import * as fs from "fs"; - ``` - - Contributed by @Conaclos - -- [noUnusedVariables](https://biomejs.dev/linter/rules/no-unused-variables/) no longer panics when suggesting the renaming of a variable at the start of a file ([#4114](https://github.com/biomejs/biome/issues/4114)). Contributed by @Conaclos - -- [noUselessEscapeInRegex](https://biomejs.dev/linter/rules/no-useless-escape-in-regex/) no longer panics on regexes that start with an empty character class. Contributed by @Conaclos - -- [noUselessStringConcat](https://biomejs.dev/linter/rules/no-useless-string-concat/) no longer panics when it encounters malformed code. Contributed by @Conaclos - -- [noUnusedFunctionParameters](https://biomejs.dev/linter/rules/no-unused-function-parameters/) no longer reports unused parameters inside an object pattern with a rest parameter. - - In the following code, the rule no longer reports `a` as unused. - - ```js - function f({ a, ...rest }) { - return rest; - } - ``` - - This matches the behavior of [noUnusedVariables](https://biomejs.dev/linter/rules/no-unused-variables/). - - Contributed by @Conaclos - -- [useButtonType](https://biomejs.dev/linter/rules/use-button-type/) no longer reports dynamically created button with a valid type ([#4072](https://github.com/biomejs/biome/issues/4072)). - - The following code is no longer reported: - - ```js - React.createElement("button", { type: "button" }, "foo") - ``` - - Contributed by @Conaclos - -- [useSemanticElements](https://biomejs.dev/linter/rules/use-semantic-elements/) now ignores elements with the `img` role ([#3994](https://github.com/biomejs/biome/issues/3994)). - - [MDN recommends](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/img_role) using `role="img"` for grouping images or creating an image from other elements. - The following code is no longer reported: - - ```jsx -
-

🐈 😂

-
- ``` - - Contributed by @Conaclos - -- [useSemanticElements](https://biomejs.dev/linter/rules/use-semantic-elements/) now ignores `alert` and `alertdialog` roles ([#3858](https://github.com/biomejs/biome/issues/3858)). Contributed by @Conaclos - -- [noUselessFragments](https://biomejs.dev/linter/rules/no-useless-fragments/) don't create invaild JSX code when Fragments children contains JSX Expression and in a LogicalExpression. Contributed by @fireairforce - -### Parser - -#### Bug fixes - -- Forbid undefined as type name for typescript parser. Contributed by @fireairforce - -## v1.9.2 (2024-09-19) - -### CLI - -#### New features - -- Added support for custom GritQL definitions, including: - - Pattern and predicate definitions: https://docs.grit.io/guides/patterns - - Function definitions: https://docs.grit.io/language/functions#function-definitions - - Contributed by @arendjr - -#### Bug fixes - -- Fix [#3917](https://github.com/biomejs/biome/issues/3917), where the fixed files were incorrectly computed. Contributed by @ematipico -- Fixed an issue that caused GritQL `contains` queries to report false positives when the matched - node appeared inside a sibling node. Contributed by @arendjr - -### Editors - -#### Bug fixes - -- Fix [#3923](https://github.com/biomejs/biome/issues/3923). Now the `.editorconfig` is correctly parsed by the LSP, and the options are correctly applied to files when formatting is triggered. - Plus, the Biome LSP now watches for any change to the `.editorconfig`, and updates the formatting settings. -- Reduced the number of log files generated by the LSP server. Now the maximum number of logs saved on disk is **seven**. Contributed by @ematipico -- Fix the code actions capabilities available in the LSP Biome server. Before, the LSP was using the default capabilities, which resulted in pulling code actions even when they were disabled by the editor. - - This means that the code actions are pulled by the client **only** when the editor enables `quickfix.biome`, `source.organizeImports.biome` and `source.fixAll.biome`. - - Now, if you enable `organizeImports.enabled: true` in the `biome.json`, and then you configure your editor with the following code action `source.organizeImports.biome: false`, the editor **won't** sort the imports. - - Contributed by @ematipico - -### Linter - -#### New features - -- Add [nursery/noMissingVarFunction](https://biomejs.dev/linter/rules/no-missing-var-function). Contributed by @michellocana -- Add [nursery/useComponentExportOnlyModules](https://biomejs.dev/linter/rules/use-component-export-only-modules). Use this rule in React projects to enforce a code styling that fits React Refresh. Contributed by @GunseiKPaseri - -#### Bug fixes - -- [noLabelWithoutControl](https://biomejs.dev/linter/rules/no-label-without-control/) now accept JSX expression as label value ([#3875](https://github.com/biomejs/biome/issues/3875)). Contributed by @Conaclos - -- [useFilenamingConvention](https://biomejs.dev/linter/rules/use-filenaming-convention) no longer suggests names with a disallowed case ([#3952](https://github.com/biomejs/biome/issues/3952)). Contributed by @Conaclos - -- [useFilenamingConvention](https://biomejs.dev/linter/rules/use-filenaming-convention) now recognizes file names starting with ASCII digits as lowercase ([#3952](https://github.com/biomejs/biome/issues/3952)). - - Thus, `2024-09-17-filename`, `2024_09_17_filename` and `20240917FileName` are in `kebab-case`, `snake_case`, and `camelCase` respectively. - - Contributed by @Conaclos - -- [useFilenamingConvention](https://biomejs.dev/linter/rules/use-filenaming-convention) now applies the configured formats to the file extensions ([#3650](https://github.com/biomejs/biome/discussions/3650)). Contributed by @Conaclos - -### Parser - -#### Bug fixes - -- [useStrictMode](https://biomejs.dev/linter/rules/use-strict-mode/) now reports Script files with some directives, but without the `use strict` directive. Contributed by @Conaclos - -- The CSS parser now accepts the characters U+FFDCF and U+FFFD in identifiers. Contributed by @Conaclos - -## v1.9.1 (2024-09-15) - -### CLI - -#### Bug fixes - -- `useEditorConfig` now loads the editorconfig when running `biome ci` [#3864](https://github.com/biomejs/biome/issues/3864). Contributed by @dyc3 - -### Editors - -#### Bug fixes - -- Revert [#3731](https://github.com/biomejs/biome/pull/3731) to fix broken quick fixes and code actions. Contributed by @nhedger - -### Linter - -#### New Features - -- Add [nursery/noProcessEnv](https://biomejs.dev/linter/rules/no-process-env/). Contributed by @unvalley - -#### Bug fixes - -- [noUndeclaredDependencies](https://biomejs.dev/linter/rules/no-undeclared-dependencies/) now ignores `@/` imports and recognizes type imports from Definitely Typed and `bun` imports. Contributed by @Conaclos - -## v1.9.0 (2024-09-12) - -### Analyzer - -- Implement the [semantic model for CSS](https://github.com/biomejs/biome/pull/3546). Contributed by @togami2864 - -### CLI - -#### New features - -- Add `--graphql-linter-enabled` option, to control whether the linter should be enabled or not for GraphQL files. Contributed by @ematipico - -- New EXPERIMENTAL `search` command. The search command allows you to search a Biome project using [GritQL syntax](https://biomejs.dev/reference/gritql). - - GritQL is a powerful language that lets you do _structural_ searches on your codebase. This means that trivia such as whitespace or even the type of strings quotes used will be ignored in your search query. It also has many features for querying the structure of your code, making it much more elegant for searching code than regular expressions. - - While we believe this command may already be useful to users in some situations (especially when integrated in the IDE extensions!), we also had an ulterior motive for adding this command: We intend to utilize GritQL for our plugin efforts, and by allowing our users to try it out in a first iteration, we hope to gain insight in the type of queries you want to do, as well as the bugs we need to focus on. - - For now, the `search` command is explicitly marked as EXPERIMENTAL, since many bugs remain. Keep this in mind when you try it out, and please [let us know](https://github.com/biomejs/biome/issues) your issues! - - Note: GritQL escapes code snippets using backticks, but most shells interpret backticks as command invocations. To avoid this, it's best to put _single quotes_ around your Grit queries. - - ```shell - biome search '`console.log($message)`' # find all `console.log` invocations - ``` - - Contributed by @arendjr and @BackupMiles - -- The option `--max-diagnostics` now accept a `none` value, which lifts the limit of diagnostics shown. Contributed by @ematipico - - Add a new reporter `--reporter=gitlab`, that emits diagnostics for using the [GitLab Code Quality report](https://docs.gitlab.com/ee/ci/testing/code_quality.html#implement-a-custom-tool). - - ```json - [ - { - "description": "Use === instead of ==. == is only allowed when comparing against `null`", - "check_name": "lint/suspicious/noDoubleEquals", - "fingerprint": "6143155163249580709", - "severity": "critical", - "location": { - "path": "main.ts", - "lines": { - "begin": 4 - } - } - } - ] - ``` - - Contributed by @NiclasvanEyk - -- Add new options to the `lsp-proxy` and `start` commands: - - `--log-path`: a directory where to store the daemon logs. The commands also accepts the environment variable `BIOME_LOG_PATH`. - - `--log-prefix-name`: a prefix that's added to the file name of the logs. It defaults to `server.log`. The commands also accepts the environment variable `BIOME_LOG_PREFIX_NAME`. - - @Contributed by @ematipico - -#### Enhancements - -- When a `--reporter` is provided, and it's different from the default one, the value provided by via `--max-diagnostics` is ignored and **the limit is lifted**. Contributed by @ematipico - -- `biome init` now generates a new config file with more options set. - This change intends to improve discoverability of the options and to set the more commonly used options to their default values. - Contributed by @Conaclos - -- The `--verbose` flag now reports the list of files that were evaluated, and the list of files that were fixed. - The **evaluated** files are the those files that can be handled by Biome, files that are ignored, don't have an extension or have an extension that Biome can't evaluate are excluded by this list. - The **fixed** files are those files that were handled by Biome and *changed*. Files that stays the same after the process are excluded from this list. - - ```shell - VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ℹ Files processed: - - - biome/biome.json - - biome/packages/@biomejs/cli-win32-arm64/package.json - - biome/packages/tailwindcss-config-analyzer/package.json - - VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ℹ Files fixed: - - - biome/biome/packages/tailwindcss-config-analyzer/src/generate-tailwind-preset.ts - ``` - - Contributed by @ematipico - -- Allow passing `nursery` to the `--only` and `--skip` filters. - - The `--only` option allows you to run a given rule or rule group. - The `--skip` option allows you to skip the execution of a given group or a given rule. - - Previously, it was not possible to pass `nursery`. - This restriction is now removed, as it may make sense to skip the nursery rules that a project has enabled. - - Contributed by @Conaclos - -- The CLI now returns an error code when calling a command in `stdin` mode, and the contents of the files aren't fixed. For example, the following example will result in an error code of `1` because the `lint` command triggers some lint rules: - - ```shell - echo "let x = 1" | biome lint --stdin-file-path=stdin.js - ``` - - Contributed by @ematipico - -#### Bug fixes - -- `biome lint --write` now takes `--only` and `--skip` into account ([#3470](https://github.com/biomejs/biome/issues/3470)). Contributed by @Conaclos - -- Fix [#3368](https://github.com/biomejs/biome/issues/3368), now the reporter `github` tracks the diagnostics that belong to formatting and organize imports. Contributed by @ematipico - -- Fix [#3545](https://github.com/biomejs/biome/issues/3545), display a warning, 'Avoid using unnecessary Fragment,' when a Fragment contains only one child element that is placed on a new line. Contributed by @satojin219 - -- Migrating from Prettier or ESLint no longer overwrite the `overrides` field from the configuration ([#3544](https://github.com/biomejs/biome/issues/3544)). Contributed by @Conaclos - -- Fix JSX expressions for `noAriaHiddenOnFocusable` ([#3708](https://github.com/biomejs/biome/pull/3708)). Contributed by @anthonyshew - -- Fix edge case for `` elements that use `role="img"` ([#3728](https://github.com/biomejs/biome/pull/3728)). Contributed by @anthonyshew - -- Fix [#3633](https://github.com/biomejs/biome/issues/3633), where diagnostics where incorrectly printed if the code has errors. Contributed by @ematipico - -- Allow `aria-label` on heading to prevent `useHeadingContent` diagnostic ([#3767](https://github.com/biomejs/biome/pull/3767)). Contributed by @anthonyshew - -- Fix edge case [#3791](https://github.com/biomejs/biome/issues/3791) for rule `noFocusedTests` being used with non-string-like expressions ([#3793](https://github.com/biomejs/biome/pull/3793)). Contributed by @h-a-n-a - -- Fix optional ARIA properties for `role="separator"` in `useAriaPropsForRole` ([#3856](https://github.com/biomejs/biome/pull/3856)). Contributed by @anthonyshew - -### Configuration - -- Add support for loading configuration from `.editorconfig` files ([#1724](https://github.com/biomejs/biome/issues/1724)). - - Configuration supplied in `.editorconfig` will be overridden by the configuration in `biome.json`. Support is disabled by default and can be enabled by adding the following to your formatter configuration in `biome.json`: - - ```json - { - "formatter": { - "useEditorconfig": true - } - } - ``` - - Contributed by @dyc3 - -- `overrides` from an extended configuration is now merged with the `overrides` of the extension. - - Given the following shared configuration `biome.shared.json`: - - ```json5 - { - "overrides": [ - { - "include": ["**/*.json"], - // ... - } - ] - } - ``` - - and the following configuration: - - ```json5 - { - "extends": ["./biome.shared.json"], - "overrides": [ - { - "include": ["**/*.ts"], - // ... - } - ] - } - ``` - - Previously, the `overrides` from `biome.shared.json` was overwritten. - It is now merged and results in the following configuration: - - ```json5 - { - "extends": ["./biome.shared.json"], - "overrides": [ - { - "include": ["**/*.json"], - // ... - }, - { - "include": ["**/*.ts"], - // ... - } - ] - } - ``` - - Contributed by @Conaclos - -### Editors - -- Fix [#3577](https://github.com/biomejs/biome/issues/3577), where the update of the configuration file was resulting in the creation of a new internal project. Contributed by @ematipico - -- Fix [#3696](https://github.com/biomejs/biome/issues/3696), where `biome.jsonc` was incorrectly parsed with incorrect options. Contributed by @ematipico - -### Formatter - -- The CSS formatter is enabled by default. Which means that you don't need to opt-in anymore using the configuration file `biome.json`: - - ```diff - { - - "css": { - - "formatter": { - - "enabled": true - - } - - } - } - ``` - - Contributed by @ematipico - -- Add parentheses for nullcoalescing in ternaries. - - This change aligns on [Prettier 3.3.3](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#333). - This adds clarity to operator precedence. - - ```diff - - foo ? bar ?? foo : baz; - + foo ? (bar ?? foo) : baz; - ``` - - Contributed by @Conaclos - -- Keep the parentheses around `infer ... extends` declarations in type unions and type intersections ([#3419](https://github.com/biomejs/biome/issues/3419)). Contributed by @Conaclos - -- Keep parentheses around a `yield` expression inside a type assertion. - - Previously, Biome removed parentheses around some expressions that require them inside a type assertion. - For example, in the following code, Biome now preserves the parentheses. - - ```ts - function* f() { - return (yield 0); - } - ``` - - Contributed by @Conaclos - -- Remove parentheses around expressions that don't need them inside a decorator. - - Biome now matches Prettier in the following cases: - - ```diff - class { - - @(decorator) - + @decorator - method() {} - }, - class { - - @(decorator()) - + @decorator() - method() {} - }, - class { - @(decorator?.()) - method() {} - }, - ``` - - Contributed by @Conaclos - -- Keep parentheses around objects preceded with a `@satisfies` comment. - - In the following example, parentheses are no longer removed. - - ```ts - export const PROPS = /** @satisfies {Record} */ ({ - prop: 0, - }); - ``` - - Contributed by @Conaclos - -### Linter - -#### Promoted rules - -New rules are incubated in the nursery group. -Once stable, we promote them to a stable group. - -The following CSS rules are promoted: - -- [a11y/useGenericFontNames](https://biomejs.dev/linter/rules/use-generic-font-names/) -- [correctness/noInvalidDirectionInLinearGradient](https://biomejs.dev/linter/rules/no-invalid-direction-in-linear-gradient/) -- [correctness/noInvalidGridAreas](https://biomejs.dev/linter/rules/no-invalid-grid-areas/) -- [correctness/noInvalidPositionAtImportRule](https://biomejs.dev/linter/rules/no-invalid-position-at-import-rule/) -- [correctness/noUnknownFunction](https://biomejs.dev/linter/rules/no-unknown-function/) -- [correctness/noUnknownMediaFeatureName](https://biomejs.dev/linter/rules/no-unknown-media-feature-name/) -- [correctness/noUnknownProperty](https://biomejs.dev/linter/rules/no-unknown-property/) -- [correctness/noUnknownUnit](https://biomejs.dev/linter/rules/no-unknown-unit/) -- [correctness/noUnmatchableAnbSelector](https://biomejs.dev/linter/rules/no-unmatchable-anb-selector/) -- [suspicious/noDuplicateAtImportRules](https://biomejs.dev/linter/rules/no-duplicate-at-import-rules/) -- [suspicious/noDuplicateFontNames](https://biomejs.dev/linter/rules/no-duplicate-font-names/) -- [suspicious/noDuplicateSelectorsKeyframeBlock](https://biomejs.dev/linter/rules/no-duplicate-selectors-keyframe-block/) -- [suspicious/noEmptyBlock](https://biomejs.dev/linter/rules/no-empty-block/) -- [suspicious/noImportantInKeyframe](https://biomejs.dev/linter/rules/no-important-in-keyframe/) -- [suspicious/noShorthandPropertyOverrides](https://biomejs.dev/linter/rules/no-shorthand-property-overrides/) - -The following JavaScript rules are promoted: - -- [a11y/noLabelWithoutControl](https://biomejs.dev/linter/rules/no-label-without-control/) -- [a11y/useFocusableInteractive](https://biomejs.dev/linter/rules/use-focusable-interactive/) -- [a11y/useSemanticElements](https://biomejs.dev/linter/rules/use-semantic-elements/) -- [complexity/noUselessStringConcat](https://biomejs.dev/linter/rules/no-useless-string-concat/) -- [complexity/noUselessUndefinedInitialization](https://biomejs.dev/linter/rules/no-useless-undefined-initialization/) -- [complexity/useDateNow](https://biomejs.dev/linter/rules/use-date-now/) -- [correctness/noUndeclaredDependencies](https://biomejs.dev/linter/rules/no-undeclared-dependencies/) -- [correctness/noInvalidBuiltinInstantiation](https://biomejs.dev/linter/rules/no-invalid-builtin-instantiation/) -- [correctness/noUnusedFunctionParameters](https://biomejs.dev/linter/rules/no-unused-function-parameters/) -- [correctness/useImportExtensions](https://biomejs.dev/linter/rules/use-import-extensions/) -- [performance/useTopLevelRegex](https://biomejs.dev/linter/rules/use-top-level-regex/) -- [style/noDoneCallback](https://biomejs.dev/linter/rules/no-done-callback/) -- [style/noYodaExpression](https://biomejs.dev/linter/rules/no-yoda-expression/) -- [style/useConsistentBuiltinInstantiation](https://biomejs.dev/linter/rules/use-consistent-builtin-instantiation/) -- [style/useDefaultSwitchClause](https://biomejs.dev/linter/rules/use-default-switch-clause/) -- [style/useExplicitLengthCheck](https://biomejs.dev/linter/rules/use-explicit-length-check/) -- [style/useThrowNewError](https://biomejs.dev/linter/rules/use-throw-new-error/) -- [style/useThrowOnlyError](https://biomejs.dev/linter/rules/use-throw-only-error/) -- [suspicious/noConsole](https://biomejs.dev/linter/rules/no-console/) -- [suspicious/noEvolvingTypes](https://biomejs.dev/linter/rules/no-evolving-types/) -- [suspicious/noMisplacedAssertion](https://biomejs.dev/linter/rules/no-misplaced-assertion/) -- [suspicious/noReactSpecificProps](https://biomejs.dev/linter/rules/no-react-specific-props/) -- [suspicious/useErrorMessage](https://biomejs.dev/linter/rules/use-error-message/) -- [suspicious/useNumberToFixedDigitsArgument](https://biomejs.dev/linter/rules/use-number-to-fixed-digits-argument/) - -#### Deprecated rules - -- `correctness/noInvalidNewBuiltin` is deprecated. Use [correctness/noInvalidBuiltinInstantiation](https://biomejs.dev/linter/rules/no-invalid-builtin-instantiation/) instead. -- `style/useSingleCaseStatement` is deprecated. Use [correctness/noSwitchDeclarations](https://biomejs.dev/linter/rules/no-switch-declarations/) instead. -- `suspicious/noConsoleLog` is deprecated. Use [suspicious/noConsole](https://biomejs.dev/linter/rules/no-console/) instead. - -#### New features - -- Implement [css suppression action](https://github.com/biomejs/biome/issues/3278). Contributed by @togami2864 - -- Add support for GraphQL linting. Contributed by @ematipico - -- Add [nursery/noCommonJs](https://biomejs.dev/linter/rules/no-common-js/). Contributed by @minht11 - -- Add [nursery/noDuplicateCustomProperties](https://biomejs.dev/linter/rules/no-duplicate-custom-properties/). Contributed by @chansuke - -- Add [nursery/noEnum](https://biomejs.dev/linter/rules/no-enum/). Contributed by @nickfla1 - -- Add [nursery/noDynamicNamespaceImportAccess](https://biomejs.dev/linter/no-dynamic-namespace-import-access/). Contributed by @minht11 - -- Add [nursery/noIrregularWhitespace](https://biomejs.dev/linter/rules/no-irregular-whitespace). Contributed by @michellocana - -- Add [nursery/noRestrictedTypes](https://biomejs.dev/linter/no-restricted-types/). Contributed by @minht11 - -- Add [nursery/noSecrets](https://biomejs.dev/linter/rules/no-secrets/). Contributed by @SaadBazaz - -- Add [nursery/noUselessEscapeInRegex](https://biomejs.dev/linter/rules/no-useless-escape-in-regex/). Contributed by @Conaclos - -- Add [nursery/noValueAtRule](https://biomejs.dev/linter/rules/no-value-at-rule/). Contributed by @rishabh3112 - -- Add [nursery/useAriaPropsSupportedByRole](https://biomejs.dev/linter/rules/use-aria-props-supported-by-role/). Contributed by @ryo-ebata - -- Add [nursery/useConsistentMemberAccessibility](https://biomejs.dev/linter/rules/use-consistent-member-accessibility/). Contributed by @seitarof - -- Add [nursery/useStrictMode](https://biomejs.dev/linter/rules/use-strict-mode/). Contributed by @ematipico - -- Add [nursery/useTrimStartEnd](https://biomejs.dev/linter/rules/use-trim-start-end/). Contributed by @chansuke - -- Add [nursery/noIrregularWhitespace](https://biomejs.dev/linter/rules/no-irreguluar-whitespace/). Contributed by @DerTimonius - -#### Enhancements - -- Rename `nursery/noUnknownSelectorPseudoElement` to `nursery/noUnknownPseudoElement`. Contributed by @togami2864 - -- The CSS linter is now enabled by default. Which means that you don't need to opt-in anymore using the configuration file `biome.json`: - - ```diff - { - - "css": { - - "linter": { - - "enabled": true - - } - - } - } - ``` - - Contributed by @ematipico - -- The JavaScript linter recognizes TypeScript 5.5 and 5.6 globals. Contributed by @Conaclos - -- [noBlankTarget](https://biomejs.dev/linter/rules/no-blank-target/) now supports an array of allowed domains. - - The following configuration allows `example.com` and `example.org` as blank targets. - - ```json - "linter": { - "rules": { - "a11y": { - "noBlankTarget": { - "level": "error", - "options": { - "allowDomains": ["example.com", "example.org"] - } - } - } - } - } - ``` - - Contributed by @Jayllyz - -- [noConsole](https://biomejs.dev/linter/rules/no-console/) now accepts an option that specifies some allowed calls on `console`. Contributed by @Conaclos - -- Add an `ignoreNull` option for [noDoubleEquals](https://biomejs.dev/linter/rules/no-double-equals/). - - By default the rule allows loose comparisons against `null`. - The option `ignoreNull` can be set to `false` for reporting loose comparison against `null`. - - Contributed by @peaBerberian. - -- [noDuplicateObjectKeys](https://biomejs.dev/linter/rules/no-duplicate-object-keys/) now works for JSON and JSONC files. Contributed by @ematipico - -- [noInvalidUseBeforeDeclaration](https://biomejs.dev/linter/rules/no-invalid-use-before-declaration) now reports direct use of an enum member before its declaration. - - In the following code, `A` is reported as use before its declaration. - - ```ts - enum E { - B = A << 1, - A = 1, - } - ``` - - Contributed by @Conaclos - -- [noNodejsModules](https://biomejs.dev/linter/rules/no-nodejs-modules/) now ignores imports of a package which has the same name as a Node.js module. Contributed by @Conaclos - -- [noNodejsModules](https://biomejs.dev/linter/rules/no-nodejs-modules/) now ignores type-only imports ([#1674](https://github.com/biomejs/biome/issues/1674)). - - The rule no longer reports type-only imports such as: - - ```ts - import type assert from "assert"; - import type * as assert2 from "assert"; - ``` - - Contributed by @Conaclos - -- [noRedundantUseStrict](https://biomejs.dev/linter/rules/no-redundant-use-strict/) no longer reports `"use strict"` directives when the `package.json` marks explicitly the file as a script using the field `"type": "commonjs"`. Contributed by @ematipico - -- [noStaticOnlyClass](https://biomejs.dev/linter/rules/no-static-only-class/) no longer reports a class that extends another class ([#3612](https://github.com/biomejs/biome/issues/3612)). Contributed by @errmayank - -- [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/) no longer reports a direct reference to an enum member ([#2974](https://github.com/biomejs/biome/issues/2974)). - - In the following code, the `A` reference is no longer reported as an undeclared variable. - - ```ts - enum E { - A = 1, - B = A << 1, - } - ``` - - Contributed by @Conaclos - -- [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/) recognized Svelte 5 runes in Svelte components and svelte files. - - Svelte 5 introduced runes. - The rule now recognizes Svelte 5 runes in files ending with the `.svelte`, `.svelte.js` or `.svelte.ts` extensions. - - Contributed by @Conaclos - -- [noUnusedVariables](https://biomejs.dev/linter/rules/no-unused-variables/) now checks TypeScript declaration files. - - This allows to report a type that is unused because it isn't exported. - Global declarations files (declarations files without exports and imports) are still ignored. - - Contributed by @Conaclos - -- [useFilenamingConvention](https://biomejs.dev/linter/rules/use-filenaming-convention) now supports [unicase](https://en.wikipedia.org/wiki/Unicase) letters. - - [unicase](https://en.wikipedia.org/wiki/Unicase) letters have a single case: they are neither uppercase nor lowercase. - Biome now accepts filenames in unicase. - For example, the filename `안녕하세요` is now accepted. - - We still reject a name that mixes unicase characters with lowercase or uppercase characters. - For example, the filename `A안녕하세요` is rejected. - - This change also fixes [#3353](https://github.com/biomejs/biome/issues/3353). - Filenames consisting only of numbers are now accepted. - - Contributed by @Conaclos - -- [useFilenamingConvention](https://biomejs.dev/linter/rules/use-filenaming-convention) now supports Next.js/Nuxt/Astro dynamic routes ([#3465](https://github.com/biomejs/biome/issues/3465)). - - [Next.js](https://nextjs.org/docs/pages/building-your-application/routing/dynamic-routes#catch-all-segments), [SolidStart](https://docs.solidjs.com/solid-start/building-your-application/routing#renaming-index), [Nuxt](https://nuxt.com/docs/guide/directory-structure/server#catch-all-route), and [Astro](https://docs.astro.build/en/guides/routing/#rest-parameters) support dynamic routes such as `[...slug].js` and `[[...slug]].js`. - - Biome now recognizes this syntax. `slug` must contain only alphanumeric characters. - - Contributed by @Conaclos - -- [useExportType](https://biomejs.dev/linter/rules/use-export-type/) no longer reports empty `export` ([#3535](https://github.com/biomejs/biome/issues/3535)). - - An empty `export {}` allows you to force TypeScript to consider a file with no imports and exports as an EcmaScript module. - While `export type {}` is valid, it is more common to use `export {}`. - Users may find it confusing that the linter asks them to convert it to `export type {}`. - Also, a bundler should be able to remove `export {}` as well as `export type {}`. - So it is not so useful to report `export {}`. - - Contributed by @Conaclos - -#### Bug fixes - -- [noControlCharactersInRegex](https://www.biomejs.dev/linter/rules/no-control-characters-in-regex) now corretcly handle `\u` escapes in unicode-aware regexes. - - Previously, the rule didn't consider regex with the `v` flags as unicode-aware regexes. - Moreover, `\uhhhh` was not handled in unicode-aware regexes. - - Contributed by @Conaclos - -- [noControlCharactersInRegex](https://www.biomejs.dev/linter/rules/no-control-characters-in-regex) now reports control characters and escape sequence of control characters in string regexes. Contributed by @Conaclos - -- `noExcessiveNestedTestSuites`: fix an edge case where the rule would alert on heavily nested zod schemas. Contributed by @dyc3 - -- `noExtraNonNullAssertion` no longer reports a single non-null assertion enclosed in parentheses ([#3352](https://github.com/biomejs/biome/issues/3352)). Contributed by @Conaclos - -- [noMultipleSpacesInRegularExpressionLiterals](https://biomejs.dev/linter/rules/no-multiple-spaces-in-regular-expression-literals/) now correctly provides a code fix when Unicode characters are used. Contributed by @Conaclos - -- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare/) no longer report redeclartions for lexically scoped function declarations [#3664](https://github.com/biomejs/biome/issues/3664). - - In JavaScript strict mode, function declarations are lexically scoped: - they cannot be accessed outside the block where they are declared. - - In non-strict mode, function declarations are hoisted to the top of the enclosing function or global scope. - - Previously Biome always hoisted function declarations. - It now takes into account whether the code is in strict or non strict mode. - - Contributed by @Conaclos - -- [noUndeclaredDependencies](https://biomejs.dev/linter/rules/no-undeclared-dependencies/) now ignores self package imports. - - Given teh following `package.json`: - - ```json - { - "name": "my-package", - "main": "index.js" - } - ``` - - The following import is no longer reported by the rule: - - ```js - import * as mod from "my-package"; - ``` - - Contributed by @Conaclos - -- Fix [[#3149](https://github.com/biomejs/biome/issues/3149)] crashes that occurred when applying the `noUselessFragments` unsafe fixes in certain scenarios. Contributed by @unvalley - -- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare/) no longer reports a variable named as the function expression where it is declared. Contributed by @Conaclos - -- `useAdjacentOverloadSignatures` no longer reports a `#private` class member and a public class member that share the same name ([#3309](https://github.com/biomejs/biome/issues/3309)). - - The following code is no longer reported: - - ```js - class C { - #f() {} - g() {} - f() {} - } - ``` - - Contributed by @Conaclos - -- [useAltText](https://www.biomejs.dev/linter/rules/use-alt-text) n olonger requests alt text for elements hidden from assistive technologies ([#3316](https://github.com/biomejs/biome/issues/3316)). Contributed by @robintown - -- [useNamingConvention](https://biomejs.dev/linter/rules/use-naming-convention/) now accepts applying custom convention on abstract classes. Contributed by @Conaclos - -- [useNamingConvention](https://biomejs.dev/linter/rules/use-naming-convention/) no longer suggests an empty fix when a name doesn't match strict Pascal case ([#3561](https://github.com/biomejs/biome/issues/3561)). - - Previously the following code led `useNamingConvention` to suggest an empty fix. - The rule no longer provides a fix for this case. - - ```ts - type AAb = any - ``` - - Contributed by @Conaclos - -- [useNamingConvention](https://biomejs.dev/linter/rules/use-naming-convention/) no longer provides fixes for global TypeScript declaration files. - - Global TypeScript declaration files have no epxorts and no imports. - All the declared types are available in all files of the project. - Thus, it is not safe to propose renaming only in the declaration file. - - Contributed by @Conaclos - -- [useSortedClasses](https://biomejs.dev/linter/rules/use-sorted-classes/) lint error with Template literals ([#3394](https://github.com/biomejs/biome/issues/3394)). Contributed by @hangaoke1 - -- [useValidAriaValues](https://biomejs.dev/linter/rules/use-valid-aria-values/) now correctly check property types ([3748](https://github.com/biomejs/biome/issues/3748)). - - Properties that expect a string now accept arbitrary text. - An identifiers can now be made up of any characters except ASCII whitespace. - An identifier list can now be separated by any ASCII whitespace. - - Contributed by @Conaclos - -### Parser - -#### Enhancements - -- The JSON parser now allows comments in `turbo.json` and `jest.config.json`. Contributed by @Netail and @Conaclos - -- The JSON parser now allows comments in files with the `.json` extension under the `.vscode` and `.zed` directories. - - Biome recognizes are well known JSON files that allows comments and/or trailing commas. - Previously, Biome did not recognize JSON files under the `.vscode` and the `.zed` directories as JSON files that allow comments. - You had to configure Biome to recognize them: - - ```json - { - "overrides": [ - { - "include": ["**/.vscode/*.json", "**/.zed/*.json"], - "json": { "parser": { "allowComments": true } } - } - ] - } - ``` - - This override is no longer needed! - Note that JSON files under the `.vscode` and the `.zed` directories don't accept trailing commas. - - Contributed by @Conaclos - -#### Bug fixes - -- The CSS parser now accepts emoji in identifiers ([3627](https://github.com/biomejs/biome/issues/3627)). - - The following code is now correctly parsed: - - ```css - p { - --🥔-color: red; - color: var(--🥔-color); - } - ``` - - Contributed by @Conaclos - -- Fix [#3287](https://github.com/biomejs/biome/issues/3287) nested selectors with pseudo-classes. Contributed by @denbezrukov - -- Fix [#3349](https://github.com/biomejs/biome/issues/3349) allow CSS multiple ampersand support. Contributed by @denbezrukov - - ```css - .class { - && { - color: red; - } - } - ``` - -- Fix [#3410](https://github.com/biomejs/biome/issues/3410) by correctly parsing break statements containing keywords. - ```js - out: while (true) { - break out; - } - ``` - Contributed by @ah-yu - -- Fix [#3464](https://github.com/biomejs/biome/issues/3464) by enabling JSX in `.vue` files that use the `lang='jsx'` or `lang='tsx'` attribute. Contributed by @ematipico - - -## v1.8.3 (2024-06-27) - -### CLI - -#### Bug fixes - -- Fix [#3104](https://github.com/biomejs/biome/issues/3104) by suppressing node warnings when using `biome migrate`. Contributed by @SuperchupuDev - -- Force colors to be off when using the GitHub reporter to properly create annotations in GitHub actions ([#3148](https://github.com/biomejs/biome/issues/3148)). Contributed by @Sec-ant - -### Parser - -#### Bug fixes - -- Implement [CSS unicode range](https://github.com/biomejs/biome/pull/3251). Contributed by @denbezrukov - -### Formatter - -#### Bug fixes - -- Fix [#3184](https://github.com/biomejs/biome/issues/3184) CSS formatter converts custom identifiers to lowercase. Contributed by @denbezrukov -- Fix [#3256](https://github.com/biomejs/biome/issues/3256) constant crashes when editing css files #3256. Contributed by @denbezrukov - -### Linter - -#### New features - -- Add `nursery/useDeprecatedReason` rule. Contributed by @vohoanglong0107. -- Add [nursery/noExportedImports](https://biomejs.dev/linter/rules/no-exported-imports/). Contributed by @Conaclos - -#### Enhancements - -- Implement [suggestedExtensions option](https://github.com/biomejs/biome/pull/3274) for `useImportExtensions` rule. Contributed by @drdaemos - -#### Bug fixes - -- `useConsistentArrayType` and `useShorthandArrayType` now ignore `Array` in the `extends` and `implements` clauses. Fix [#3247](https://github.com/biomejs/biome/issues/3247). Contributed by @Conaclos -- Fixes [#3066](https://github.com/biomejs/biome/issues/3066) by taking into account the dependencies declared in the `package.json`. Contributed by @ematipico -- The code action of the `useArrowFunction` rule now preserves a trailing comma when there is only a single type parameter in the arrow function and JSX is enabled. Fixes [#3292](https://github.com/biomejs/biome/issues/3292). Contributed by @Sec-ant - -#### Enhancements -- Enhance tailwind sorting lint rule [#1274](https://github.com/biomejs/biome/issues/1274) with variant support. - - Every preconfigured variant is assigned a `weight` that concurs on establishing the output sorting order. - Since nesting variants on the same utility class is possible, the resulting `weight` is the Bitwise XOR of all the variants weight for that class. - Dynamic variants (e.g. `has-[.custom-class]`, `group-[:checked]`) are also supported and they take the `weight` of their base variant name the custom value attached (e.g. `has-[.custom-class]` takes `has` weight). - Arbitrary variants (e.g. `[&nth-child(2)]`) don't have a weight assigned and they are placed after every known variant. - Classes with the same amount of arbitrary variants follow lexicographical order. The class that has the highest number of nested arbitrary variants is placed last. - Screen variants (e.g. `sm:`, `max-md:`, `min-lg:`) are not supported yet. - - Contributed by @lutaok - -## v1.8.2 (2024-06-20) - -### CLI - -#### Bug fixes - -- Fix [#3201](https://github.com/biomejs/biome/issues/3201) by correctly injecting the source code of the file when printing the diagnostics. Contributed by @ematipico -- Fix [#3179](https://github.com/biomejs/biome/issues/3179) where comma separators are not correctly removed after running `biome migrate` and thus choke the parser. Contributed by @Sec-ant -- Fix [#3232](https://github.com/biomejs/biome/issues/3232) by correctly using the colors set by the user. Contributed by @ematipico - -#### Enhancement - -- Reword the reporter message `No fixes needed` to `No fixes applied`. - - The former message is misleading when there're still errors or warnings in the files that should be taken care of manually. For example: - - ```block - Checked 2 files in
:
foo
}; -}); - -// invalid -[].map((item) => { - return <>{item.condition ?
:
foo
}; -}); -``` -- `noExcessiveNestedTestSuites` no longer erroneously alerts on `describe` calls that are not invoking the global `describe` function. [#2599](https://github.com/biomejs/biome/issues/2599) Contributed by @dyc3 -```js -// now valid -z.object({}) - .describe('') - .describe('') - .describe('') - .describe('') - .describe('') - .describe(''); -``` -- `noEmptyBlockStatements` no longer reports empty constructors using typescript parameter properties. [#3005](https://github.com/biomejs/biome/issues/3005) Contributed by @dyc3 -- `noEmptyBlockStatements` no longer reports empty private or protected constructors. Contributed by @dyc3 - -- [noExportsInTest](https://biomejs.dev/linter/rules/no-exports-in-test/) rule no longer treats files with in-source testing as test files https://github.com/biomejs/biome/issues/2859. Contributed by @ah-yu -- [useSortedClasses](https://biomejs.dev/linter/rules/use-sorted-classes/) now keeps leading and trailing spaces when applying the code action inside template literals: - - ``` - i Unsafe fix: Sort the classes. - - 1 1 │ <> - 2 │ - → - 2 │ + → - 3 3 │
- 4 4 │ - ``` -- [noUndeclaredDependencies](https://biomejs.dev/linter/rules/no-undeclared-dependencies/) is correctly triggered when running `biome ci`. Contributed by @ematipico -- [noUnusedVariables](https://biomejs.dev/linter/rules/no-unused-variables/) no longer panics when a certain combination of characters is typed. Contributed by @ematipico - -- [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/) no logger alerts on `arguments` object in a function scope. Contributed by @ah-yu -### Parser - -#### Enhancements - -- `lang="tsx"` is now supported in Vue Single File Components. [#2765](https://github.com/biomejs/biome/issues/2765) Contributed by @dyc3 - -#### Bug fixes - -- The `const` modifier for type parameters is now accepted for TypeScript `new` signatures ([#2825](https://github.com/biomejs/biome/issues/2825)). - - The following code is now correctly parsed: - - ```ts - interface I { - new(x: T): T - } - ``` - - Contributed by @Conaclos - -- Some invalid TypeScript syntax caused the Biome parser to crash. - - The following invalid syntax no longer causes the Biome parser to crash: - - ```ts - declare using x: null; - declare qwait using x: null; - ``` - - Contributed by @Conaclos - -## 1.7.3 (2024-05-06) - -### CLI - -#### Bug fixes - -- The [stdin-file-path](https://biomejs.dev/guides/integrate-in-editor/#use-stdin) option now works correctly for Astro/Svelte/Vue files ([#2686](https://github.com/biomejs/biome/pull/2686)) - - Fix [#2225](https://github.com/biomejs/biome/issues/2225) where lint output become empty for Vue files. - - Contributed by @tasshi-me - -- `biome migrate eslint` now correctly resolve `@scope/eslint-config` ([#2705](https://github.com/biomejs/biome/issues/2705)). Contributed by @Conaclos - -### Linter - -#### New features - -- Add [nursery/noUselessStringConcat](https://biomejs.dev/linter/rules/no-useless-string-concat/). -- Add [nursery/useExplicitLengthCheck](https://biomejs.dev/linter/rules/use-explicit-length-check/). Contributed by @minht11 - -- `useExhaustiveDependencies` now recognizes (some) dependencies that change on - every render ([#2374](https://github.com/biomejs/biome/issues/2374)). - Contributed by @arendjr - -#### Bug fixes - -- [noBlankTarget](https://biomejs.dev/linter/rules/no-blank-target/) no longer hangs when applying a code fix ([#2675](https://github.com/biomejs/biome/issues/2675)). - - Previously, the following code made Biome hangs when applying a code fix. - - ```jsx - - ``` - - Contributed by @Conaclos - -- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare/) no longer panics on conditional type ([#2659](https://github.com/biomejs/biome/issues/2659)). - - This is a regression introduced by [#2394](https://github.com/biomejs/biome/issues/2394). - This regression makes `noRedeclare` panics on every conditional types with `infer` bindings. - - Contributed by @Conaclos - -- [noUnusedLabels](https://biomejs.dev/linter/rules/no-unused-labels/) and [noConfusingLabels](https://biomejs.dev/linter/rules/no-confusing-labels/) now ignore svelte reactive statements ([#2571](https://github.com/biomejs/biome/issues/2571)). - - The rules now ignore reactive Svelte blocks in Svelte components. - - ```svelte - - ``` - - Contributed by @Conaclos - -- [useExportType](https://biomejs.dev/linter/rules/use-export-type/) no longer removes leading comments ([#2685](https://github.com/biomejs/biome/issues/2685)). - - Previously, `useExportType` removed leading comments when it factorized the `type` qualifier. - It now provides a code fix that preserves the leading comments: - - ```diff - - export { - + export type { - /**leading comment*/ - - type T - + T - } - ``` - - Contributed by @Conaclos - -- [useJsxKeyInIterable](https://biomejs.dev/linter/rules/use-jsx-key-in-iterable/) no longer reports false positive when iterating on non-jsx items ([#2590](https://github.com/biomejs/biome/issues/2590)). - - The following snipet of code no longer triggers the rule: - - ```jsx - <>{data.reduce((total, next) => total + next, 0)} - ``` - - Contributed by @dyc3 - -- Fix typo by renaming `useConsistentBuiltinInstatiation` to `useConsistentBuiltinInstantiation` - Contributed by @minht11 -- Fix the rule `useSingleCaseStatement` including `break` statements when counting the number of statements in a `switch` statement (#2696) - - -## 1.7.2 (2024-04-30) - -### Analyzer - -#### Bug fixes - -- Import sorting now ignores side effect imports ([#817](https://github.com/biomejs/biome/issues/817)). - - A side effect import consists now in its own group. - This ensures that side effect imports are not reordered. - - Here is an example of how imports are now sorted: - - ```diff - import "z" - - import { D } from "d"; - import { C } from "c"; - + import { D } from "d"; - import "y" - import "x" - - import { B } from "b"; - import { A } from "a"; - + import { B } from "b"; - import "w" - ``` - - Contributed by @Conaclos - -- Import sorting now adds spaces where needed ([#1665](https://github.com/biomejs/biome/issues/1665)) - Contributed by @Conaclos - -### CLI - -#### Bug fixes - -- `biome migrate eslint` now handles cyclic references. - - Some plugins and configurations export objects with cyclic references. - This causes `biome migrate eslint` to fail or ignore them. - These edge cases are now handled correctly. - - Contributed by @Conaclos - -### Formatter - -#### Bug fixes - -- Correctly handle placement of comments inside named import clauses. [#2566](https://github.com/biomejs/biome/pull/2566). Contributed by @ah-yu - -### Linter - -#### New features - -- Add [nursery/noReactSpecificProps](https://biomejs.dev/linter/rules/no-react-specific-props/). - Contributed by @marvin-j97 - -- Add [noUselessUndefinedInitialization](https://biomejs.dev/linter/rules/no-useless-undefined-initialization/). - Contributed by @lutaok - -- Add [nursery/useArrayLiterals](https://biomejs.dev/linter/rules/use-array-literals/). - Contributed by @Kazuhiro-Mimaki - -- Add [nursery/useConsistentBuiltinInstatiation](https://biomejs.dev/linter/rules/use-consistent-builtin-instantiation/). - Contributed by @minht11 - -- Add [nursery/useDefaultSwitchClause](https://biomejs.dev/linter/rules/use-default-switch-clause/). - Contributed by @michellocana - -#### Bug fixes - -- [noDuplicateJsonKeys](https://biomejs.dev/linter/rules/no-duplicate-json-keys/) no longer crashes when a JSON file contains an unterminated string ([#2357](https://github.com/biomejs/biome/issues/2357)). - Contributed by @Conaclos - -- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare/) now reports redeclarations of parameters in a functions body ([#2394](https://github.com/biomejs/biome/issues/2394)). - - The rule was unable to detect redeclarations of a parameter or a type parameter in the function body. - The following two redeclarations are now reported: - - ```ts - function f(a) { - type T = number; // redeclaration - const a = 0; // redeclaration - } - ``` - - Contributed by @Conaclos - -- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare/) no longer reports overloads in object types ([#2608](https://github.com/biomejs/biome/issues/2608)). - - The rule no longer report redeclarations in the following code: - - ```ts - type Overloads = { - ({ a }: { a: number }): number, - ({ a }: { a: string }): string, - }; - ``` - - Contributed by @Conaclos - -- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare/) now merge default function export declarations and types ([#2372](https://github.com/biomejs/biome/issues/2372)). - - The following code is no longer reported as a redeclaration: - - ```ts - interface Foo {} - export default function Foo() {} - ``` - - Contributed by @Conaclos - -- [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/) no longer reports variable-only and type-only exports ([#2637](https://github.com/biomejs/biome/issues/2637)). - Contributed by @Conaclos - -- [noUnusedVariables](https://biomejs.dev/linter/rules/no-unused-variables/) no longer crash Biome when encountering a malformed conditional type ([#1695](https://github.com/biomejs/biome/issues/1695)). - Contributed by @Conaclos - -- [useConst](https://biomejs.dev/linter/rules/use-const/) now ignores a variable that is read before its assignment. - - Previously, the rule reported the following example: - - ```js - let x; - x; // read - x = 0; // write - ``` - - It is now correctly ignored. - - Contributed by @Conaclos - -- [useShorthandFunctionType](https://biomejs.dev/linter/rules/use-shorthand-function-type/) now suggests correct code fixes when parentheses are required ([#2595](https://github.com/biomejs/biome/issues/2595)). - - Previously, the rule didn't add parentheses when they were needed. - It now adds parentheses when the function signature is inside an array, a union, or an intersection. - - ```diff - - type Union = { (): number } | string; - + type Union = (() => number) | string; - ``` - - Contributed by @Conaclos - -- [useTemplate](https://biomejs.dev/linter/rules/use-template/) now correctly escapes strings ([#2580](https://github.com/biomejs/biome/issues/2580)). - - Previously, the rule didn't correctly escape characters preceded by an escaped character. - - Contributed by @Conaclos - -- [noMisplacedAssertion](https://biomejs.dev/linter/rules/no-misplaced-assertion/) now allow these matchers - - - `expect.any()` - - `expect.anything()` - - `expect.closeTo` - - `expect.arrayContaining` - - `expect.objectContaining` - - `expect.stringContaining` - - `expect.stringMatching` - - `expect.extend` - - `expect.addEqualityTesters` - - `expect.addSnapshotSerializer` - - Contributed by @fujiyamaorange - -### Parser - -#### Bug fixes - -- The language parsers no longer panic on unterminated strings followed by a newline and a space ([#2606](https://github.com/biomejs/biome/issues/2606), [#2410](https://github.com/biomejs/biome/issues/2410)). - - The following example is now parsed without making Biome panics: - - ``` - " - " - ``` - - Contributed by @Conaclos - - -## 1.7.1 (2024-04-22) - -### Editors - -#### Bug fixes - -- Fix [#2403](https://github.com/biomejs/biome/issues/2403) by printing the errors in the client console. Contributed by @ematipico - -### Formatter - -#### Bug fixes - -- Add parentheses for the return expression that has leading multiline comments. [#2504](https://github.com/biomejs/biome/pull/2504). Contributed by @ah-yu - -- Correctly format dangling comments of continue statements. [#2555](https://github.com/biomejs/biome/pull/2555). Contributed by @ah-yu - -- Prevent comments from being eaten by the formatter [#2578](https://github.com/biomejs/biome/pull/2578). Now the comments won't be eaten for the following code: - ```js - console.log((a,b/* comment */)); - ``` - Contributed by @ah-yu - -- Correctly format nested union type to avoid reformatting issue. [#2628](https://github.com/biomejs/biome/pull/2628). Contributed by @ah-yu - -### Linter - -#### Bug fixes - -- Fix case where `jsxRuntime` wasn't being respected by `useImportType` rule ([#2473](https://github.com/biomejs/biome/issues/2473)).Contributed by @arendjr -- Fix [#2460](https://github.com/biomejs/biome/issues/2460), where the rule `noUselessFragments` was crashing the linter in some cases. Now cases like these are correctly handled: - ```jsx - callFunction(<>{bar}) - ``` - Contributed by @ematipico -- Fix [#2366](https://github.com/biomejs/biome/issues/2366), where `noDuplicateJsonKeys` incorrectly computed the kes to highlight. Contributed by @ematipico -#### Enhancements - -- The rule `noMisplacedAssertions` now considers valid calling `expect` inside `waitFor`: - ```js - import { waitFor } from '@testing-library/react'; - - await waitFor(() => { - expect(111).toBe(222); - }); - ``` - Contributed by @ematipico - - -## 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](https://github.com/biomejs/biome/issues/2245)). Contributed by @Sec-ant - -- `useExhaustiveDependencies` no longer reports recursive calls as missing - dependencies ([#2361](https://github.com/biomejs/biome/issues/2361)). - Contributed by @arendjr - -- `useExhaustiveDependencies` correctly reports missing dependencies declared - using function declarations ([#2362](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/2443)). Contributed by @unvalley. - -- Biome now can handle `.vue` files with [generic components](https://vuejs.org/api/sfc-script-setup#generics) ([#2456](https://github.com/biomejs/biome/issues/2456)). - ```vue - - ``` - 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](https://eslint.org/docs/latest/use/configure/configuration-files) and [new flat ESLint configurations](https://eslint.org/docs/latest/use/configure/configuration-files-new). - 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](https://biomejs.dev/linter/rules-sources/). - 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: - - ```json - { - "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: - - ```json - { - "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. - -
- Example of output when running `biome format` command - ```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" - } - ``` -
- -- 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](https://github.com/biomejs/biome/issues/2265)). - - ```shell - 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](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/1996). Contributed by @castarco - -- Biome now skips traversing `fifo` or `socket` files ([#2311](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/2279)). Contributed by @Sec-ant - -- Fixed the JSON schema for React hooks configuration ([#2396](https://github.com/biomejs/biome/issues/2396)). Contributed by @arendjr - -#### Enhancements - -- Biome now displays the location of a parsing error for its configuration file ([#1627](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/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: - - ```json - { - "linter": { - "rules": { - "style": { - "noDefaultExport": { - "level": "off" - } - } - } - } - } - ``` - - Contributed by @Conaclos - -### Editors - -#### Bug fixes - -- Biome extension is now able to parse the JSX syntax in files that associated with the `javascript` [language identifier](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem). This is an ad hoc fix, because [in the React world, `.js` files are allowed to include JSX syntax](https://github.com/facebook/create-react-app/issues/87#issuecomment-234627904), and these files are often associated with the `javascript` language identifier in most of the editors. Plus, [some editor extensions](https://github.com/michaelgmcd/vscode-language-babel/blob/8b3a472748ad07c99dc022b66795c9eb46be4ccb/package.json#L63-L80) will also associate `.jsx` files with the `javascript` language identifier. Relative links: [discussion](https://github.com/biomejs/biome/discussions/838#discussioncomment-9047539), [#2085](https://github.com/biomejs/biome/issues/2085). Contributed by @Sec-ant - -### Formatter - -#### Bug fixes - -- Fix [#2291](https://github.com/biomejs/biome/issues/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: - -- [complecity/noExcessiveNestedTestSuites](https://biomejs.dev/linter/rules/no-excessive-nested-test-suites) -- [complexity/noUselessTernary](https://biomejs.dev/linter/rules/no-useless-ternary) -- [correctness/useJsxKeyInIterable](https://biomejs.dev/linter/rules/use-jsx-key-in-iterable) -- [performance/noBarrelFile](https://biomejs.dev/linter/rules/no-barrel-file/) -- [performance/noReExportAll](https://biomejs.dev/linter/rules/no-re-export-all/) -- [style/noNamespaceImport](https://biomejs.dev/linter/rules/no-namespace-import/) -- [style/useNodeAssertStrict](https://biomejs.dev/linter/rules/use-node-assert-strict/) -- [suspicious/noDuplicateTestHooks](https://biomejs.dev/linter/rules/no-duplicate-test-hooks/) -- [suspicious/noExportsInTest](https://biomejs.dev/linter/rules/no-exports-in-test/) -- [suspicious/noFocusedTests](https://biomejs.dev/linter/rules/no-focused-tests/) -- [suspicious/noSkippedTests](https://biomejs.dev/linter/rules/no-skipped-tests/) -- [suspicious/noSuspiciousSemicolonInJsx](https://biomejs.dev/linter/rules/no-suspicious-semicolon-in-jsx) - -#### New features - -- Add a new option `jsxRuntime` to the `javascript` configuration. When set to `reactClassic`, the [noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports) and [useImportType](https://biomejs.dev/linter/rules/use-import-type) 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](https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html). - - Contributed by @Conaclos and @arendjr - -- Implement [#2043](https://github.com/biomejs/biome/issues/2043): The React rule [`useExhaustiveDependencies`](https://biomejs.dev/linter/rules/use-exhaustive-dependencies/) is now also compatible with Preact hooks imported from `preact/hooks` or `preact/compat`. Contributed by @arendjr - -- Add rule [noFlatMapIdentity](https://biomejs.dev/linter/rules/no-flat-map-identity) to disallow unnecessary callback use on `flatMap`. Contributed by @isnakode - -- Add rule [noConstantMathMinMaxClamp](https://biomejs.dev/linter/rules/no-constant-math-min-max-clamp), which disallows using `Math.min` and `Math.max` to clamp a value where the result itself is constant. Contributed by @mgomulak - -#### Enhancements - -- [style/useFilenamingConvention](https://biomejs.dev/linter/rules/use-filenaming-convention/) now allows prefixing a filename with `+` ([#2341](https://github.com/biomejs/biome/issues/2341)). - - This is a convention used by [Sveltekit](https://kit.svelte.dev/docs/routing#page) and [Vike](https://vike.dev/route). - - Contributed by @Conaclos - -- [style/useNamingConvention](https://biomejs.dev/linter/rules/use-naming-convention/) 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: - - ```tsx - function loadComponent() { - const Component = getComponent(); - return ; - } - ``` - - Contributed by @Conaclos - -- [complexity/useLiteralKeys](https://biomejs.dev/linter/rules/use-literal-keys/) no longer report computed properties named `__proto__` ([#2430](https://github.com/biomejs/biome/issues/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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto) 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](https://biomejs.dev/linter/rules/use-naming-convention/) now accepts any case for variables from object destructuring ([#2332](https://github.com/biomejs/biome/issues/2332)). - - The following name is now ignored: - - ```js - 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](https://github.com/biomejs/biome/issues/2384)). - Contributed by @arendjr - - -## 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](https://github.com/biomejs/biome/issues/2243)). Contributed by @Sec-ant - -### CLI - -#### Bug fixes - -- Fix the printed error count ([#2048](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/2222), [#688](https://github.com/biomejs/biome/issues/688), [#1015](https://github.com/biomejs/biome/issues/1015)). Contributed by @Sec-ant - -### Linter - -#### New features - -- Add [nursery/noMisplacedAssertion](https://biomejs.dev/linter/rules/no-misplaced-assertion/). COntributed by @ematipico - -#### Bug fixes - -- Fix [#2211](https://github.com/biomejs/biome/issues/2211). noChildrenProp should work fine when children pass as a prop in a new line. Contributed by @fireairforce - -- Fix [#2248](https://github.com/biomejs/biome/issues/2248). `lint/a11y/useButtonType` should not trigger when button element with spread attribute. Contributed by @fireairforce - -- Fix [#2216](https://github.com/biomejs/biome/issues/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: - - ```astro - --- - const condition = true; - if (condition) { - return "Something"; - } - --- -
- ``` - Contributed by @ematipico - -## 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](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/2080), [#2109](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/2172) by breaking long object destructuring patterns. Contributed by @ah-yu - -### Linter - -#### New features - -- Add rule [noEvolvingTypes](https://biomejs.dev/linter/rules/no-evolving-any) 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](https://github.com/biomejs/biome/issues/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 - -## 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](https://github.com/biomejs/biome/issues/2108)). Contributed by @Sec-ant - -- Fix discrepancies on file source detection. Allow module syntax in `.cts` files ([#2114](https://github.com/biomejs/biome/issues/2114)). Contributed by @Sec-ant - -### CLI - -#### Bug fixes - -- Fixes [#2131](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/pull/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](https://github.com/biomejs/biome/pull/2072)) ([#2028](https://github.com/biomejs/biome/issues/2028)). Contributed by @Sec-ant - -### Formatter - -#### Bug fixes - -- Fix [#1661](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/pull/1956)). Contributed by @mnahkies - -### Linter - -#### New features - -- Add [nursery/noDuplicateElseIf](https://biomejs.dev/linter/rules/no-duplicate-else-if/). COntributed by @mdm317 - -#### Bug fixes - -- Rule `noUndeclaredDependencies` now also validates `peerDependencies` and `optionalDependencies` ([#2122](https://github.com/biomejs/biome/issues/2122)). Contributed by @Sec-ant - -- Rule `noUndeclaredDependencies` won't check `declare module` statements anymore ([#2123](https://github.com/biomejs/biome/issues/2123)). Contributed by @Sec-ant - -- Fix [#1925](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/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 - -## 1.6.1 (2024-03-12) - -### CLI - -#### Bug fixes - -- CLI is now able to automatically search and resolve `biome.jsonc` ([#2008](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/2009)). Contributed by @Sec-ant - -### Linter - -#### New features - -- Add rule [noDoneCallback](https://biomejs.dev/linter/rules/no-done-callback), this rule checks the function parameter of hooks & tests - for use of the done argument, suggesting you return a promise instead. Contributed by @vasucp1207 - - ```js - beforeEach(done => { - // ... - }); - ``` - -#### Bug fixes - -- [useJsxKeyInIterable](https://biomejs.dev/linter/rules/use-jsx-key-in-iterable) now recognizes function bodies wrapped in parentheses ([#2011](https://github.com/biomejs/biome/issues/2011)). Contributed by @Sec-ant - -- [useShorthandFunctionType](https://biomejs.dev/linter/rules/use-shorthand-function-type) now preserves type parameters of generic interfaces when applying fixes ([#2015](https://github.com/biomejs/biome/issues/2015)). Contributed by @Sec-ant - -- Code fixes of [useImportType](https://biomejs.dev/linter/rules/use-import-type) and [useExportType](https://biomejs.dev/linter/rules/use-export-type) now handle multiline statements ([#2041](https://github.com/biomejs/biome/issues/2041)). Contributed by @Conaclos - -- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare) no longer reports type parameter and parameter with identical names ([#1992](https://github.com/biomejs/biome/issues/1992)). - - The following code is no longer reported: - - ```ts - function f(a: a) {} - ``` - - Contributed by @Conaclos - -- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare) now reports duplicate type parameters in a same declaration. - - The following type parameters are now reported as a redeclaration: - - ```ts - function f() {} - ``` - - Contributed by @Conaclos - -- [noUndeclaredDependencies](https://biomejs.dev/linter/rules/no-undeclared-dependencies/) 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: - - ```ts - 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](https://github.com/biomejs/biome/issues/1941)). - - Contributed by @Sec-ant - -## 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 - - ```diff - --- - - import { getLocale } from "astro:i18n"; - - import { Code } from "astro:components"; - + import { Code } from "astro:components"; - + import { getLocale } from "astro:i18n"; - --- - -
- ``` -- Add partial for `.vue` files. Biome is able to sort imports inside the script block of Vue files. Contributed by - @nhedger - - ```diff - - - - ``` - -- Add partial for `.svelte` files. Biome is able to sort imports inside the script block of Svelte files. Contributed by - @ematipico - - ```diff - - -
- ``` - -- 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](https://biomejs.dev/linter/rules/no-unused-variables) ignores unused rest spread siblings. - - The following code is now valid: - - ```js - const { a, ...rest } = { a: 0, b: 1 }; - console.log(rest); - ``` - - Contributed by @ah-yu - -- Fix [#1931](https://github.com/biomejs/biome/issues/1931). Built-in React hooks such as - `useEffect()` can now be validated by the - [`useExhaustiveDependendies`](https://biomejs.dev/linter/rules/use-exhaustive-dependencies/), 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](https://github.com/biomejs/biome/issues/1128). User-provided React hooks can - now be configured to track stable results. For example: - - ```json - "useExhaustiveDependencies": { - "level": "error", - "options": { - "hooks": [{ - "name": "useMyState", - "stableResult": [ - 1 - ] - }] - } - } - ``` - - This will allow the following to be validated: - - ```js - const [myState, setMyState] = useMyState(); - const toggleMyState = useCallback(() => { - setMyState(!myState); - }, [myState]); // Only `myState` needs to be specified here. - ``` - - Contributed by @arendjr - -#### Bug fixes - -- Fix [#1748](https://github.com/biomejs/biome/issues/1748). Now for the following case we won't provide an unsafe fix - for the `noNonNullAssertion` rule: - - ```ts - 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 - - ```diff - 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](https://github.com/biomejs/biome/issues/1081). The `useAwait` rule does not report `for await...of`. - Contributed by @unvalley - -- Fix [#1827](https://github.com/biomejs/biome/issues/1827) by properly analyzing nested `try-finally` statements. Contributed by @ah-yu - -- Fix [#1924](https://github.com/biomejs/biome/issues/1924) Use the correct export name to sort in the import clause. Contributed by @ah-yu -- Fix [#1805](https://github.com/biomejs/biome/issues/1805) fix formatting arrow function which has conditional expression body Contributed by @mdm317 - -- Fix [#1781](https://github.com/biomejs/biome/issues/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 - Ctrl/ + 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`. - - ```json - { - "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`: - - ```json - { - "files": { - "include": ["src"], - "ignore": ["test"] - } - } - ``` - -- Fix [#1508](https://github.com/biomejs/biome/issues/1508) by excluding deleted files from being processed. Contributed - by @ematipico - -- Fix [#1173](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/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: - - ```json - { - "name": "@org/configs", - "exports": { - "./biome": "./biome.json" - } - } - ``` - - And the `biome.json` file that "imports" said configuration, will look like this: - ```json - { - "extends": "@org/configs/biome" - } - ``` - Read the [documentation](https://biomejs.dev/guides/how-biome-works#the-extends-option) 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](https://github.com/biomejs/biome/issues/1706). Contributed by @octoshikari -- Add partial for `.astro` files. Biome is able to format the frontmatter of the Astro files. Contributed by @ematipico - - ```diff - --- - - statement ( ); - + statement(); - --- - -
- ``` -- Add partial for `.vue` files. Biome is able to format the script block of Vue files. Contributed by @nhedger - - ```diff - - - - ``` - -- Add partial for `.svelte` files. Biome is able to format the script block of Svelte files. Contributed by @ematipico - - ```diff - - -
- ``` - -#### 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](https://biomejs.dev/reference/configuration/#filesignore) configuration: - - ```json - { - "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](https://github.com/biomejs/biome/issues/1039). Check unicode width instead of number of bytes when - checking if regex expression is a simple argument. - - This no longer breaks. - - ```js - s(/🚀🚀/).s().s(); - ``` - - Contributed by @kalleep - -- Fix [#1218](https://github.com/biomejs/biome/issues/1218), by correctly preserving empty lines in member chains. - Contributed by @ah-yu -- Fix [#1659](https://github.com/biomejs/biome/issues/1659) and [#1662](https://github.com/biomejs/biome/issues/1662), by correctly taking into account the leading comma inside the formatter options. Contributed by @ematipico - -- Fix [#1934](https://github.com/biomejs/biome/pull/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: - -- [complexity/noEmptyTypeParameters](https://biomejs.dev/linter/rules/no-empty-type-parameters) -- [complexity/noUselessLoneBlockStatements](https://biomejs.dev/linter/rules/no-useless-lone-block-statements) -- [correctness/noInvalidUseBeforeDeclaration](https://biomejs.dev/linter/rules/no-invalid-use-before-declaration) -- [correctness/noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports) -- [correctness/noUnusedPrivateClassMembers](https://biomejs.dev/linter/rules/no-unused-private-class-members) -- [security/noGlobalEval](https://biomejs.dev/linter/rules/no-global-eval) -- [style/useConsistentArrayType](https://biomejs.dev/linter/rules/use-consistent-array-type) -- [style/useExportType](https://biomejs.dev/linter/rules/use-export-type) -- [style/useFilenamingConvention](https://biomejs.dev/linter/rules/use-filenaming-convention) -- [style/useForOf](https://biomejs.dev/linter/rules/use-for-of) -- [style/useImportType](https://biomejs.dev/linter/rules/use-import-type) -- [style/useNodejsImportProtocol](https://biomejs.dev/linter/rules/use-nodejs-import-protocol) -- [style/useNumberNamespace](https://biomejs.dev/linter/rules/use-number-namespace) -- [style/useShorthandFunctionType](https://biomejs.dev/linter/rules/use-shorthand-function-type) -- [suspicious/noEmptyBlockStatements](https://biomejs.dev/linter/rules/no-empty-block-statements) -- [suspicious/noGlobalAssign](https://biomejs.dev/linter/rules/no-global-assign) -- [suspicious/noMisleadingCharacterClass](https://biomejs.dev/linter/rules/no-misleading-character-class) -- [suspicious/noThenProperty](https://biomejs.dev/linter/rules/no-then-property) -- [suspicious/useAwait](https://biomejs.dev/linter/rules/use-await) - -Additionally, the following rules are now recommended: - -- [suspicious/noApproximativeNumericConstant](https://biomejs.dev/linter/rules/no-approximative-numeric-constant) -- [suspicious/noMisrefactoredShorthandAssign](https://biomejs.dev/linter/rules/no-misrefactored-shorthand-assign) - -#### Removed rules - -- Remove `nursery/useGroupedTypeImport`. The rule [style/useImportType](https://biomejs.dev/linter/rules/use-import-type) covers the behavior of this rule. - - Note that removing a nursery rule is not considered a breaking change according to our [semantic versioning](https://biomejs.dev/internals/versioning). - - Contributed by @Conaclos - -#### New features - -- Add the rule [noSkippedTests](https://biomejs.dev/linter/rules/no-skipped-tests), to disallow skipped tests: - - ```js - describe.skip("test", () => {}); - it.skip("test", () => {}); - ``` - Contributed by @ematipico - -- Add the rule [noFocusedTests](https://biomejs.dev/linter/rules/no-focused-tests), to disallow skipped tests: - - ```js - describe.only("test", () => {}); - it.only("test", () => {}); - ``` - Contributed by @ematipico - -- Add rule [useSortedClasses](https://biomejs.dev/linter/rules/use-sorted-classes), to sort CSS utility classes: - - ```diff - -
- +
- ``` - Contributed by @DaniGuardiola - -- Add rule [noUndeclaredDependencies](https://biomejs.dev/linter/rules/no-undeclared-dependencies), 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](https://biomejs.dev/linter/rules/no-namespace-import), to report namespace imports: - - ```js - 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 - - ```diff - --- - - delete a.b - + a.b = undefined - --- - -
- ``` - -- Add partial support for `.vue` files. Biome is able to lint and fix the script block of the Vue files. - - ```diff - + ``` + + Contributed by @Conaclos + +- [useExportType](https://biomejs.dev/linter/rules/use-export-type/) no longer removes leading comments ([#2685](https://github.com/biomejs/biome/issues/2685)). + + Previously, `useExportType` removed leading comments when it factorized the `type` qualifier. + It now provides a code fix that preserves the leading comments: + + ```diff + - export { + + export type { + /**leading comment*/ + - type T + + T + } + ``` + + Contributed by @Conaclos + +- [useJsxKeyInIterable](https://biomejs.dev/linter/rules/use-jsx-key-in-iterable/) no longer reports false positive when iterating on non-jsx items ([#2590](https://github.com/biomejs/biome/issues/2590)). + + The following snipet of code no longer triggers the rule: + + ```jsx + <>{data.reduce((total, next) => total + next, 0)} + ``` + + Contributed by @dyc3 + +- Fix typo by renaming `useConsistentBuiltinInstatiation` to `useConsistentBuiltinInstantiation` + Contributed by @minht11 +- Fix the rule `useSingleCaseStatement` including `break` statements when counting the number of statements in a `switch` statement (#2696) + + +## 1.7.2 (2024-04-30) + +### Analyzer + +#### Bug fixes + +- Import sorting now ignores side effect imports ([#817](https://github.com/biomejs/biome/issues/817)). + + A side effect import consists now in its own group. + This ensures that side effect imports are not reordered. + + Here is an example of how imports are now sorted: + + ```diff + import "z" + - import { D } from "d"; + import { C } from "c"; + + import { D } from "d"; + import "y" + import "x" + - import { B } from "b"; + import { A } from "a"; + + import { B } from "b"; + import "w" + ``` + + Contributed by @Conaclos + +- Import sorting now adds spaces where needed ([#1665](https://github.com/biomejs/biome/issues/1665)) + Contributed by @Conaclos + +### CLI + +#### Bug fixes + +- `biome migrate eslint` now handles cyclic references. + + Some plugins and configurations export objects with cyclic references. + This causes `biome migrate eslint` to fail or ignore them. + These edge cases are now handled correctly. + + Contributed by @Conaclos + +### Formatter + +#### Bug fixes + +- Correctly handle placement of comments inside named import clauses. [#2566](https://github.com/biomejs/biome/pull/2566). Contributed by @ah-yu + +### Linter + +#### New features + +- Add [nursery/noReactSpecificProps](https://biomejs.dev/linter/rules/no-react-specific-props/). + Contributed by @marvin-j97 + +- Add [noUselessUndefinedInitialization](https://biomejs.dev/linter/rules/no-useless-undefined-initialization/). + Contributed by @lutaok + +- Add [nursery/useArrayLiterals](https://biomejs.dev/linter/rules/use-array-literals/). + Contributed by @Kazuhiro-Mimaki + +- Add [nursery/useConsistentBuiltinInstatiation](https://biomejs.dev/linter/rules/use-consistent-builtin-instantiation/). + Contributed by @minht11 + +- Add [nursery/useDefaultSwitchClause](https://biomejs.dev/linter/rules/use-default-switch-clause/). + Contributed by @michellocana + +#### Bug fixes + +- [noDuplicateJsonKeys](https://biomejs.dev/linter/rules/no-duplicate-json-keys/) no longer crashes when a JSON file contains an unterminated string ([#2357](https://github.com/biomejs/biome/issues/2357)). + Contributed by @Conaclos + +- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare/) now reports redeclarations of parameters in a functions body ([#2394](https://github.com/biomejs/biome/issues/2394)). + + The rule was unable to detect redeclarations of a parameter or a type parameter in the function body. + The following two redeclarations are now reported: + + ```ts + function f(a) { + type T = number; // redeclaration + const a = 0; // redeclaration + } + ``` + + Contributed by @Conaclos + +- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare/) no longer reports overloads in object types ([#2608](https://github.com/biomejs/biome/issues/2608)). + + The rule no longer report redeclarations in the following code: + + ```ts + type Overloads = { + ({ a }: { a: number }): number, + ({ a }: { a: string }): string, + }; + ``` + + Contributed by @Conaclos + +- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare/) now merge default function export declarations and types ([#2372](https://github.com/biomejs/biome/issues/2372)). + + The following code is no longer reported as a redeclaration: + + ```ts + interface Foo {} + export default function Foo() {} + ``` + + Contributed by @Conaclos + +- [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/) no longer reports variable-only and type-only exports ([#2637](https://github.com/biomejs/biome/issues/2637)). + Contributed by @Conaclos + +- [noUnusedVariables](https://biomejs.dev/linter/rules/no-unused-variables/) no longer crash Biome when encountering a malformed conditional type ([#1695](https://github.com/biomejs/biome/issues/1695)). + Contributed by @Conaclos + +- [useConst](https://biomejs.dev/linter/rules/use-const/) now ignores a variable that is read before its assignment. + + Previously, the rule reported the following example: + + ```js + let x; + x; // read + x = 0; // write + ``` + + It is now correctly ignored. + + Contributed by @Conaclos + +- [useShorthandFunctionType](https://biomejs.dev/linter/rules/use-shorthand-function-type/) now suggests correct code fixes when parentheses are required ([#2595](https://github.com/biomejs/biome/issues/2595)). + + Previously, the rule didn't add parentheses when they were needed. + It now adds parentheses when the function signature is inside an array, a union, or an intersection. + + ```diff + - type Union = { (): number } | string; + + type Union = (() => number) | string; + ``` + + Contributed by @Conaclos + +- [useTemplate](https://biomejs.dev/linter/rules/use-template/) now correctly escapes strings ([#2580](https://github.com/biomejs/biome/issues/2580)). + + Previously, the rule didn't correctly escape characters preceded by an escaped character. + + Contributed by @Conaclos + +- [noMisplacedAssertion](https://biomejs.dev/linter/rules/no-misplaced-assertion/) now allow these matchers + + - `expect.any()` + - `expect.anything()` + - `expect.closeTo` + - `expect.arrayContaining` + - `expect.objectContaining` + - `expect.stringContaining` + - `expect.stringMatching` + - `expect.extend` + - `expect.addEqualityTesters` + - `expect.addSnapshotSerializer` + + Contributed by @fujiyamaorange + +### Parser + +#### Bug fixes + +- The language parsers no longer panic on unterminated strings followed by a newline and a space ([#2606](https://github.com/biomejs/biome/issues/2606), [#2410](https://github.com/biomejs/biome/issues/2410)). + + The following example is now parsed without making Biome panics: + + ``` + " + " + ``` + + Contributed by @Conaclos + + +## 1.7.1 (2024-04-22) + +### Editors + +#### Bug fixes + +- Fix [#2403](https://github.com/biomejs/biome/issues/2403) by printing the errors in the client console. Contributed by @ematipico + +### Formatter + +#### Bug fixes + +- Add parentheses for the return expression that has leading multiline comments. [#2504](https://github.com/biomejs/biome/pull/2504). Contributed by @ah-yu + +- Correctly format dangling comments of continue statements. [#2555](https://github.com/biomejs/biome/pull/2555). Contributed by @ah-yu + +- Prevent comments from being eaten by the formatter [#2578](https://github.com/biomejs/biome/pull/2578). Now the comments won't be eaten for the following code: + ```js + console.log((a,b/* comment */)); + ``` + Contributed by @ah-yu + +- Correctly format nested union type to avoid reformatting issue. [#2628](https://github.com/biomejs/biome/pull/2628). Contributed by @ah-yu + +### Linter + +#### Bug fixes + +- Fix case where `jsxRuntime` wasn't being respected by `useImportType` rule ([#2473](https://github.com/biomejs/biome/issues/2473)).Contributed by @arendjr +- Fix [#2460](https://github.com/biomejs/biome/issues/2460), where the rule `noUselessFragments` was crashing the linter in some cases. Now cases like these are correctly handled: + ```jsx + callFunction(<>{bar}) + ``` + Contributed by @ematipico +- Fix [#2366](https://github.com/biomejs/biome/issues/2366), where `noDuplicateJsonKeys` incorrectly computed the kes to highlight. Contributed by @ematipico +#### Enhancements + +- The rule `noMisplacedAssertions` now considers valid calling `expect` inside `waitFor`: + ```js + import { waitFor } from '@testing-library/react'; + + await waitFor(() => { + expect(111).toBe(222); + }); + ``` + Contributed by @ematipico + + +## 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](https://github.com/biomejs/biome/issues/2245)). Contributed by @Sec-ant + +- `useExhaustiveDependencies` no longer reports recursive calls as missing + dependencies ([#2361](https://github.com/biomejs/biome/issues/2361)). + Contributed by @arendjr + +- `useExhaustiveDependencies` correctly reports missing dependencies declared + using function declarations ([#2362](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/2443)). Contributed by @unvalley. + +- Biome now can handle `.vue` files with [generic components](https://vuejs.org/api/sfc-script-setup#generics) ([#2456](https://github.com/biomejs/biome/issues/2456)). + ```vue + + ``` + 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](https://eslint.org/docs/latest/use/configure/configuration-files) and [new flat ESLint configurations](https://eslint.org/docs/latest/use/configure/configuration-files-new). + 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](https://biomejs.dev/linter/rules-sources/). + 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: + + ```json + { + "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: + + ```json + { + "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. + +
+ Example of output when running `biome format` command + ```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" + } + ``` +
+ +- 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](https://github.com/biomejs/biome/issues/2265)). + + ```shell + 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](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/1996). Contributed by @castarco + +- Biome now skips traversing `fifo` or `socket` files ([#2311](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/2279)). Contributed by @Sec-ant + +- Fixed the JSON schema for React hooks configuration ([#2396](https://github.com/biomejs/biome/issues/2396)). Contributed by @arendjr + +#### Enhancements + +- Biome now displays the location of a parsing error for its configuration file ([#1627](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/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: + + ```json + { + "linter": { + "rules": { + "style": { + "noDefaultExport": { + "level": "off" + } + } + } + } + } + ``` + + Contributed by @Conaclos + +### Editors + +#### Bug fixes + +- Biome extension is now able to parse the JSX syntax in files that associated with the `javascript` [language identifier](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem). This is an ad hoc fix, because [in the React world, `.js` files are allowed to include JSX syntax](https://github.com/facebook/create-react-app/issues/87#issuecomment-234627904), and these files are often associated with the `javascript` language identifier in most of the editors. Plus, [some editor extensions](https://github.com/michaelgmcd/vscode-language-babel/blob/8b3a472748ad07c99dc022b66795c9eb46be4ccb/package.json#L63-L80) will also associate `.jsx` files with the `javascript` language identifier. Relative links: [discussion](https://github.com/biomejs/biome/discussions/838#discussioncomment-9047539), [#2085](https://github.com/biomejs/biome/issues/2085). Contributed by @Sec-ant + +### Formatter + +#### Bug fixes + +- Fix [#2291](https://github.com/biomejs/biome/issues/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: + +- [complecity/noExcessiveNestedTestSuites](https://biomejs.dev/linter/rules/no-excessive-nested-test-suites) +- [complexity/noUselessTernary](https://biomejs.dev/linter/rules/no-useless-ternary) +- [correctness/useJsxKeyInIterable](https://biomejs.dev/linter/rules/use-jsx-key-in-iterable) +- [performance/noBarrelFile](https://biomejs.dev/linter/rules/no-barrel-file/) +- [performance/noReExportAll](https://biomejs.dev/linter/rules/no-re-export-all/) +- [style/noNamespaceImport](https://biomejs.dev/linter/rules/no-namespace-import/) +- [style/useNodeAssertStrict](https://biomejs.dev/linter/rules/use-node-assert-strict/) +- [suspicious/noDuplicateTestHooks](https://biomejs.dev/linter/rules/no-duplicate-test-hooks/) +- [suspicious/noExportsInTest](https://biomejs.dev/linter/rules/no-exports-in-test/) +- [suspicious/noFocusedTests](https://biomejs.dev/linter/rules/no-focused-tests/) +- [suspicious/noSkippedTests](https://biomejs.dev/linter/rules/no-skipped-tests/) +- [suspicious/noSuspiciousSemicolonInJsx](https://biomejs.dev/linter/rules/no-suspicious-semicolon-in-jsx) + +#### New features + +- Add a new option `jsxRuntime` to the `javascript` configuration. When set to `reactClassic`, the [noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports) and [useImportType](https://biomejs.dev/linter/rules/use-import-type) 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](https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html). + + Contributed by @Conaclos and @arendjr + +- Implement [#2043](https://github.com/biomejs/biome/issues/2043): The React rule [`useExhaustiveDependencies`](https://biomejs.dev/linter/rules/use-exhaustive-dependencies/) is now also compatible with Preact hooks imported from `preact/hooks` or `preact/compat`. Contributed by @arendjr + +- Add rule [noFlatMapIdentity](https://biomejs.dev/linter/rules/no-flat-map-identity) to disallow unnecessary callback use on `flatMap`. Contributed by @isnakode + +- Add rule [noConstantMathMinMaxClamp](https://biomejs.dev/linter/rules/no-constant-math-min-max-clamp), which disallows using `Math.min` and `Math.max` to clamp a value where the result itself is constant. Contributed by @mgomulak + +#### Enhancements + +- [style/useFilenamingConvention](https://biomejs.dev/linter/rules/use-filenaming-convention/) now allows prefixing a filename with `+` ([#2341](https://github.com/biomejs/biome/issues/2341)). + + This is a convention used by [Sveltekit](https://kit.svelte.dev/docs/routing#page) and [Vike](https://vike.dev/route). + + Contributed by @Conaclos + +- [style/useNamingConvention](https://biomejs.dev/linter/rules/use-naming-convention/) 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: + + ```tsx + function loadComponent() { + const Component = getComponent(); + return ; + } + ``` + + Contributed by @Conaclos + +- [complexity/useLiteralKeys](https://biomejs.dev/linter/rules/use-literal-keys/) no longer report computed properties named `__proto__` ([#2430](https://github.com/biomejs/biome/issues/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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto) 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](https://biomejs.dev/linter/rules/use-naming-convention/) now accepts any case for variables from object destructuring ([#2332](https://github.com/biomejs/biome/issues/2332)). + + The following name is now ignored: + + ```js + 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](https://github.com/biomejs/biome/issues/2384)). + Contributed by @arendjr + + +## 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](https://github.com/biomejs/biome/issues/2243)). Contributed by @Sec-ant + +### CLI + +#### Bug fixes + +- Fix the printed error count ([#2048](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/2222), [#688](https://github.com/biomejs/biome/issues/688), [#1015](https://github.com/biomejs/biome/issues/1015)). Contributed by @Sec-ant + +### Linter + +#### New features + +- Add [nursery/noMisplacedAssertion](https://biomejs.dev/linter/rules/no-misplaced-assertion/). COntributed by @ematipico + +#### Bug fixes + +- Fix [#2211](https://github.com/biomejs/biome/issues/2211). noChildrenProp should work fine when children pass as a prop in a new line. Contributed by @fireairforce + +- Fix [#2248](https://github.com/biomejs/biome/issues/2248). `lint/a11y/useButtonType` should not trigger when button element with spread attribute. Contributed by @fireairforce + +- Fix [#2216](https://github.com/biomejs/biome/issues/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: + + ```astro + --- + const condition = true; + if (condition) { + return "Something"; + } + --- +
+ ``` + Contributed by @ematipico + +## 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](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/2080), [#2109](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/2172) by breaking long object destructuring patterns. Contributed by @ah-yu + +### Linter + +#### New features + +- Add rule [noEvolvingTypes](https://biomejs.dev/linter/rules/no-evolving-any) 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](https://github.com/biomejs/biome/issues/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 + +## 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](https://github.com/biomejs/biome/issues/2108)). Contributed by @Sec-ant + +- Fix discrepancies on file source detection. Allow module syntax in `.cts` files ([#2114](https://github.com/biomejs/biome/issues/2114)). Contributed by @Sec-ant + +### CLI + +#### Bug fixes + +- Fixes [#2131](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/pull/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](https://github.com/biomejs/biome/pull/2072)) ([#2028](https://github.com/biomejs/biome/issues/2028)). Contributed by @Sec-ant + +### Formatter + +#### Bug fixes + +- Fix [#1661](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/pull/1956)). Contributed by @mnahkies + +### Linter + +#### New features + +- Add [nursery/noDuplicateElseIf](https://biomejs.dev/linter/rules/no-duplicate-else-if/). COntributed by @mdm317 + +#### Bug fixes + +- Rule `noUndeclaredDependencies` now also validates `peerDependencies` and `optionalDependencies` ([#2122](https://github.com/biomejs/biome/issues/2122)). Contributed by @Sec-ant + +- Rule `noUndeclaredDependencies` won't check `declare module` statements anymore ([#2123](https://github.com/biomejs/biome/issues/2123)). Contributed by @Sec-ant + +- Fix [#1925](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/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 + +## 1.6.1 (2024-03-12) + +### CLI + +#### Bug fixes + +- CLI is now able to automatically search and resolve `biome.jsonc` ([#2008](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/2009)). Contributed by @Sec-ant + +### Linter + +#### New features + +- Add rule [noDoneCallback](https://biomejs.dev/linter/rules/no-done-callback), this rule checks the function parameter of hooks & tests + for use of the done argument, suggesting you return a promise instead. Contributed by @vasucp1207 + + ```js + beforeEach(done => { + // ... + }); + ``` + +#### Bug fixes + +- [useJsxKeyInIterable](https://biomejs.dev/linter/rules/use-jsx-key-in-iterable) now recognizes function bodies wrapped in parentheses ([#2011](https://github.com/biomejs/biome/issues/2011)). Contributed by @Sec-ant + +- [useShorthandFunctionType](https://biomejs.dev/linter/rules/use-shorthand-function-type) now preserves type parameters of generic interfaces when applying fixes ([#2015](https://github.com/biomejs/biome/issues/2015)). Contributed by @Sec-ant + +- Code fixes of [useImportType](https://biomejs.dev/linter/rules/use-import-type) and [useExportType](https://biomejs.dev/linter/rules/use-export-type) now handle multiline statements ([#2041](https://github.com/biomejs/biome/issues/2041)). Contributed by @Conaclos + +- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare) no longer reports type parameter and parameter with identical names ([#1992](https://github.com/biomejs/biome/issues/1992)). + + The following code is no longer reported: + + ```ts + function f
(a: a) {} + ``` + + Contributed by @Conaclos + +- [noRedeclare](https://biomejs.dev/linter/rules/no-redeclare) now reports duplicate type parameters in a same declaration. + + The following type parameters are now reported as a redeclaration: + + ```ts + function f() {} + ``` + + Contributed by @Conaclos + +- [noUndeclaredDependencies](https://biomejs.dev/linter/rules/no-undeclared-dependencies/) 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: + + ```ts + 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](https://github.com/biomejs/biome/issues/1941)). + + Contributed by @Sec-ant + +## 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 + + ```diff + --- + - import { getLocale } from "astro:i18n"; + - import { Code } from "astro:components"; + + import { Code } from "astro:components"; + + import { getLocale } from "astro:i18n"; + --- + +
+ ``` +- Add partial for `.vue` files. Biome is able to sort imports inside the script block of Vue files. Contributed by + @nhedger + + ```diff + + + + ``` + +- Add partial for `.svelte` files. Biome is able to sort imports inside the script block of Svelte files. Contributed by + @ematipico + + ```diff + + +
+ ``` + +- 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](https://biomejs.dev/linter/rules/no-unused-variables) ignores unused rest spread siblings. + + The following code is now valid: + + ```js + const { a, ...rest } = { a: 0, b: 1 }; + console.log(rest); + ``` + + Contributed by @ah-yu + +- Fix [#1931](https://github.com/biomejs/biome/issues/1931). Built-in React hooks such as + `useEffect()` can now be validated by the + [`useExhaustiveDependendies`](https://biomejs.dev/linter/rules/use-exhaustive-dependencies/), 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](https://github.com/biomejs/biome/issues/1128). User-provided React hooks can + now be configured to track stable results. For example: + + ```json + "useExhaustiveDependencies": { + "level": "error", + "options": { + "hooks": [{ + "name": "useMyState", + "stableResult": [ + 1 + ] + }] + } + } + ``` + + This will allow the following to be validated: + + ```js + const [myState, setMyState] = useMyState(); + const toggleMyState = useCallback(() => { + setMyState(!myState); + }, [myState]); // Only `myState` needs to be specified here. + ``` + + Contributed by @arendjr + +#### Bug fixes + +- Fix [#1748](https://github.com/biomejs/biome/issues/1748). Now for the following case we won't provide an unsafe fix + for the `noNonNullAssertion` rule: + + ```ts + 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 + + ```diff + 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](https://github.com/biomejs/biome/issues/1081). The `useAwait` rule does not report `for await...of`. + Contributed by @unvalley + +- Fix [#1827](https://github.com/biomejs/biome/issues/1827) by properly analyzing nested `try-finally` statements. Contributed by @ah-yu + +- Fix [#1924](https://github.com/biomejs/biome/issues/1924) Use the correct export name to sort in the import clause. Contributed by @ah-yu +- Fix [#1805](https://github.com/biomejs/biome/issues/1805) fix formatting arrow function which has conditional expression body Contributed by @mdm317 + +- Fix [#1781](https://github.com/biomejs/biome/issues/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 + Ctrl/ + 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`. + + ```json + { + "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`: + + ```json + { + "files": { + "include": ["src"], + "ignore": ["test"] + } + } + ``` + +- Fix [#1508](https://github.com/biomejs/biome/issues/1508) by excluding deleted files from being processed. Contributed + by @ematipico + +- Fix [#1173](https://github.com/biomejs/biome/issues/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](https://github.com/biomejs/biome/issues/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: + + ```json + { + "name": "@org/configs", + "exports": { + "./biome": "./biome.json" + } + } + ``` + + And the `biome.json` file that "imports" said configuration, will look like this: + ```json + { + "extends": "@org/configs/biome" + } + ``` + Read the [documentation](https://biomejs.dev/guides/how-biome-works#the-extends-option) 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](https://github.com/biomejs/biome/issues/1706). Contributed by @octoshikari +- Add partial for `.astro` files. Biome is able to format the frontmatter of the Astro files. Contributed by @ematipico + + ```diff + --- + - statement ( ); + + statement(); + --- + +
+ ``` +- Add partial for `.vue` files. Biome is able to format the script block of Vue files. Contributed by @nhedger + + ```diff + + + + ``` + +- Add partial for `.svelte` files. Biome is able to format the script block of Svelte files. Contributed by @ematipico + + ```diff + + +
+ ``` + +#### 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](https://biomejs.dev/reference/configuration/#filesignore) configuration: + + ```json + { + "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](https://github.com/biomejs/biome/issues/1039). Check unicode width instead of number of bytes when + checking if regex expression is a simple argument. + + This no longer breaks. + + ```js + s(/🚀🚀/).s().s(); + ``` + + Contributed by @kalleep + +- Fix [#1218](https://github.com/biomejs/biome/issues/1218), by correctly preserving empty lines in member chains. + Contributed by @ah-yu +- Fix [#1659](https://github.com/biomejs/biome/issues/1659) and [#1662](https://github.com/biomejs/biome/issues/1662), by correctly taking into account the leading comma inside the formatter options. Contributed by @ematipico + +- Fix [#1934](https://github.com/biomejs/biome/pull/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: + +- [complexity/noEmptyTypeParameters](https://biomejs.dev/linter/rules/no-empty-type-parameters) +- [complexity/noUselessLoneBlockStatements](https://biomejs.dev/linter/rules/no-useless-lone-block-statements) +- [correctness/noInvalidUseBeforeDeclaration](https://biomejs.dev/linter/rules/no-invalid-use-before-declaration) +- [correctness/noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports) +- [correctness/noUnusedPrivateClassMembers](https://biomejs.dev/linter/rules/no-unused-private-class-members) +- [security/noGlobalEval](https://biomejs.dev/linter/rules/no-global-eval) +- [style/useConsistentArrayType](https://biomejs.dev/linter/rules/use-consistent-array-type) +- [style/useExportType](https://biomejs.dev/linter/rules/use-export-type) +- [style/useFilenamingConvention](https://biomejs.dev/linter/rules/use-filenaming-convention) +- [style/useForOf](https://biomejs.dev/linter/rules/use-for-of) +- [style/useImportType](https://biomejs.dev/linter/rules/use-import-type) +- [style/useNodejsImportProtocol](https://biomejs.dev/linter/rules/use-nodejs-import-protocol) +- [style/useNumberNamespace](https://biomejs.dev/linter/rules/use-number-namespace) +- [style/useShorthandFunctionType](https://biomejs.dev/linter/rules/use-shorthand-function-type) +- [suspicious/noEmptyBlockStatements](https://biomejs.dev/linter/rules/no-empty-block-statements) +- [suspicious/noGlobalAssign](https://biomejs.dev/linter/rules/no-global-assign) +- [suspicious/noMisleadingCharacterClass](https://biomejs.dev/linter/rules/no-misleading-character-class) +- [suspicious/noThenProperty](https://biomejs.dev/linter/rules/no-then-property) +- [suspicious/useAwait](https://biomejs.dev/linter/rules/use-await) + +Additionally, the following rules are now recommended: + +- [suspicious/noApproximativeNumericConstant](https://biomejs.dev/linter/rules/no-approximative-numeric-constant) +- [suspicious/noMisrefactoredShorthandAssign](https://biomejs.dev/linter/rules/no-misrefactored-shorthand-assign) + +#### Removed rules + +- Remove `nursery/useGroupedTypeImport`. The rule [style/useImportType](https://biomejs.dev/linter/rules/use-import-type) covers the behavior of this rule. + + Note that removing a nursery rule is not considered a breaking change according to our [semantic versioning](https://biomejs.dev/internals/versioning). + + Contributed by @Conaclos + +#### New features + +- Add the rule [noSkippedTests](https://biomejs.dev/linter/rules/no-skipped-tests), to disallow skipped tests: + + ```js + describe.skip("test", () => {}); + it.skip("test", () => {}); + ``` + Contributed by @ematipico + +- Add the rule [noFocusedTests](https://biomejs.dev/linter/rules/no-focused-tests), to disallow skipped tests: + + ```js + describe.only("test", () => {}); + it.only("test", () => {}); + ``` + Contributed by @ematipico + +- Add rule [useSortedClasses](https://biomejs.dev/linter/rules/use-sorted-classes), to sort CSS utility classes: + + ```diff + -
+ +
+ ``` + Contributed by @DaniGuardiola + +- Add rule [noUndeclaredDependencies](https://biomejs.dev/linter/rules/no-undeclared-dependencies), 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](https://biomejs.dev/linter/rules/no-namespace-import), to report namespace imports: + + ```js + 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 + + ```diff + --- + - delete a.b + + a.b = undefined + --- + +
+ ``` + +- Add partial support for `.vue` files. Biome is able to lint and fix the script block of the Vue files. + + ```diff +