Skip to content

🐛 Rules past index 255 in a group map to the wrong rule: useWhileLoopCondition enables noDanglingUnderscore #12954

Description

@finnan444

Environment information

Details
CLI:
  Version:                      2.6.5
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_DISTRIBUTION:                npm
  BIOME_LOG_FILE:                    unset
  BIOME_LOG_PATH:                    unset
  BIOME_LOG_PREFIX_NAME:             unset
  BIOME_LOG_LEVEL:                   unset
  BIOME_LOG_KIND:                    unset
  BIOME_CONFIG_PATH:                 unset
  BIOME_THREADS:                     unset
  BIOME_WATCHER_KIND:                unset
  BIOME_WATCHER_POLLING_INTERVAL:    unset
  BIOME_BINARY:                      unset
  RUST_BACKTRACE:                    unset
  NO_COLOR:                     unset
  TERM:                         xterm-256color
  JS_RUNTIME_VERSION:           v26.11.1
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         unset

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

Files:
  Ignore Unknown:               unset
  Includes:                     unset

Workspace:
  Open Documents:               0

What happened?

In 2.6.5, enabling nursery/useWhileLoopCondition in the config enables nursery/noDanglingUnderscore instead. useWhileLoopCondition doesn't run at all.

  1. biome.json:

    {
      "linter": {
        "rules": {
          "nursery": {
            "useWhileLoopCondition": "error"
          }
        }
      }
    }
  2. index.js:

    while (true) {
      if (!hasMore()) {
        break;
      }
      processNext();
    }
    
    export const _private = 1;
  3. biome lint reports only this, at the default info severity:

    index.js:8:14 lint/nursery/noDanglingUnderscore

    biome rage --linter also lists nursery/noDanglingUnderscore as enabled and doesn't list nursery/useWhileLoopCondition. With 2.6.4 and the same files, biome lint reports lint/nursery/useWhileLoopCondition at index.js:2:3 as an error. biome lint --only=nursery/useWhileLoopCondition still works in 2.6.5, because it selects the rule by name.

I think the cause is the u8 cast of the rule index in group_struct.rs#L59:

let rule_position = Literal::u8_unsuffixed(index as u8);

That position is used as Self::GROUP_RULES[#rule_position] to build the RuleFilter for enabled and disabled rules. The nursery group has 269 rules in 2.6.5 (184 in 2.6.4), so indices 256 to 268 wrap around to 0 to 12. useWhileLoopCondition is index 268, which becomes 12, and index 12 is noDanglingUnderscore. The other 12 rules affected the same way are useVueVOnExact through useVueValidVSlot.

The cast is older than 2.6.5. It started to matter with af84fb4 (#12765, noChainedComparison), which was the 257th nursery rule. Its parent has exactly 256. It's still on main.

I haven't built a fix. Literal::usize_unsuffixed(index) looks like the obvious change. A test that each group's generated RuleFilter matches its rule name would catch this the next time a group grows.

Expected result

"useWhileLoopCondition": "error" enables useWhileLoopCondition and nothing else, as in 2.6.4.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Activity

  1. added
    S-Needs repro
    on Nov 5, 2026
  2. biome-cookie commented on Nov 5, 2026

    @biome-cookie

    Hello @finnan444, please provide a minimal reproduction. You MUST use one of the following options:

    • Provide a link to our playground, if it's applicable.
    • Provide a link to GitHub repository. To easily create a reproduction, you can use our interactive CLI via npm create @biomejs/biome-reproduction

    These formats help us triage and fix issues faster. Failing to use these formats may cause your issue to be ignored or closed.

    Issues marked with S-Needs repro will be closed if they have no activity within 3 days.

  3. finnan444 commented on Nov 5, 2026

    @finnan444
    Author

    Reproduction repo: https://github.com/finnan444/biome-repro-12954

    npm install && npx biome lint shows the noDanglingUnderscore diagnostic on 2.6.5 and the useWhileLoopCondition one on 2.6.4.

    The playground can't show this. With a single rule selected it also passes the rule as only, which selects it by name, the same as --only on the CLI, and that path isn't affected.

  4. ematipico commented on Nov 5, 2026

    @ematipico
    Member

    cc @dyc3

    This feels like a nasty bug we should fix ASAP

  5. added
    A-Core
    S-Bug-confirmed
    and removed
    S-Needs repro
    on Nov 5, 2026
  6. added theissue type on Nov 5, 2026
  7. self-assigned this
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-CoreS-Bug-confirmed

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions