Skip to content

💅 Nursery rules are leaking into default configs #6482

@elawad

Description

@elawad

Environment information

> biome rage --linter

CLI:
  Version:                      2.0.4
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  BIOME_THREADS:                unset
  NO_COLOR:                     unset
  TERM:                         xterm-256color
  JS_RUNTIME_VERSION:           v22.14.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         yarn/1.22.22

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         biome.json
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  false

Linter:
  JavaScript enabled:           unset
  JSON enabled:                 unset
  CSS enabled:                  unset
  GraphQL enabled:              unset
  Recommended:                  unset
  Enabled rules:
    ...

Workspace:
  Open Documents:               0

Rule name

useUniqueElementIds

Playground link

https://biomejs.dev/playground/?lintRules=useUniqueElementIds&code=ZgB1AG4AYwB0AGkAbwBuACAAQQBwAHAAKAApACAAewAKACAAIAByAGUAdAB1AHIAbgAgADwAZABpAHYAIABpAGQAPQAiAGYAbwBvACIAIAAvAD4ACgB9AAoACgBlAHgAcABvAHIAdAAgAHsAIABBAHAAcAAgAH0A

Expected result

In the playground link, toggle Lint Rules from useUniqueElementIds to recommended. The error still remains.

I presume the React nursery rules should not be on by default, only the "recommended" ones.
https://biomejs.dev/linter/domains/#react-rules

// biome.json
{
  "$schema": "https://biomejs.dev/schemas/2.0.4/schema.json"
}

Nursery error using default configs.

> biome lint index.jsx

index.jsx:2:9 lint/nursery/useUniqueElementIds

✖ id attribute should not be a static string literal. Generate unique IDs using useId().

  1 │ function App() {
> 2 │   return <div id="foo" />
    │          ^^^^^^^^^^^^^^^^
  3 │ }

To fix, manually set:

  1. React domains to "recommended"
  2. Or nursery rules to "off"
// biome.json
{
  "$schema": "https://biomejs.dev/schemas/2.0.4/schema.json",
  "linter": {
    "domains": { "react": "recommended" }, // Fix 1
    "rules"  : { "nursery": "off" }        // Fix 2
  }
}

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-CoreArea: coreS-Bug-confirmedStatus: report has been confirmed as a valid bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy