Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💅 Regression: Disabling one nursery rule disables all nursery rules #2028

Closed
1 task done
chrisgrieser opened this issue Mar 10, 2024 · 4 comments · Fixed by #2072
Closed
1 task done

💅 Regression: Disabling one nursery rule disables all nursery rules #2028

chrisgrieser opened this issue Mar 10, 2024 · 4 comments · Fixed by #2072
Assignees
Labels
A-Project Area: project S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@chrisgrieser
Copy link
Contributor

chrisgrieser commented Mar 10, 2024

Environment information

CLI:
  Version:                      1.6.0
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v21.7.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.5.0"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Linter:
  Recommended:                  false
  All:                          true
  Rules:                        nursery/noConsole = "off"

Workspace:
  Open Documents:               0

Rule name

all nursery rules

Playground link

using CBS, since the playground does not allow modifying the biome config on a rule-level.
https://codesandbox.io/p/devbox/suspicious-hermann-cdnhdx?workspaceId=23165e9f-6758-4f08-8321-45be43925a49

Sidenote: Biome in the CBS is outdated, the installed version there is 1.1.2. Took me a moment to realize that that was why the nursery rules didn't exist.

Expected result

Disabling one nursery rule should not disable all nursery rules. (The following code can also be found in the CBS.)

const x = 5;
const a = x ? true : true; // violates "noUselessTernary" from the nursery

console.info(a); // violates "noConsole" from the nursery

// Running `biome lint src` will report no issue at all,
// even though only "noConsole" has been disabled in the biome.json.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico ematipico added A-Project Area: project S-Bug-confirmed Status: report has been confirmed as a valid bug labels Mar 11, 2024
@Sec-ant
Copy link
Member

Sec-ant commented Mar 12, 2024

I don't think this is a bug because as the schema says the lint.rules.all won't enable nursery rules:

image

If you want to enable all the rules in the nursery group, you should use lint.rules.nursery.all. And you can disable one single rule as expected:

{
  "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
  "formatter": {
    "enabled": true
  },
  "linter": {
    "rules": {
      "nursery": { "all": true, "noConsole": "off" }
    }
  }
}

However I agree this behavior should be properly documented here: https://biomejs.dev/reference/configuration/#linterrulesall

@chrisgrieser
Copy link
Contributor Author

@Sec-ant Ah, thanks for the tip. That helps indeed.

Nonetheless, this is still a bug, only a different kind of bug then, since lint.rules.all also enables all nursery rules for me

@Sec-ant
Copy link
Member

Sec-ant commented Mar 12, 2024

Nonetheless, this is still a bug, only a different kind of bug then, since lint.rules.all also enables all nursery rules for me

Yes you're right, I didn't notice that.

@Sec-ant
Copy link
Member

Sec-ant commented Mar 12, 2024

I'm working on this issue 🔨.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Project Area: project S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants