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

🐛 noLabelWithoutControl false positives when labels are expressions #3875

Closed
1 task done
wojtekmaj opened this issue Sep 13, 2024 · 10 comments · Fixed by #3980
Closed
1 task done

🐛 noLabelWithoutControl false positives when labels are expressions #3875

wojtekmaj opened this issue Sep 13, 2024 · 10 comments · Fixed by #3980
Assignees
Labels
A-Analyzer Area: analyzer L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@wojtekmaj
Copy link

Environment information

CLI:
  Version:                      1.9.0
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v22.7.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "yarn/4.3.1"

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

Workspace:
  Open Documents:               0

What happened?

https://biomejs.dev/playground/?code=YwBvAG4AcwB0ACAAbABhAGIAZQBsACAAPQAgACIAVABoAGkAcwAgAGkAcwAgAG4AbwB0ACAAbwBrAGEAeQAiADsACgAKADwAPgAKACAAIAA8AGkAbgBwAHUAdAAgAGkAZAA9ACIAbwBuAGUAIgAgAC8APgAKACAAIAB7AC8AKgAgAFUAbgBkAGUAcgBzAHQAYQBuAGQAYQBiAGwAeQAgAG4AbwB0ACAAbwBrAGEAeQAgACoALwB9AAoAIAAgADwAbABhAGIAZQBsACAAaAB0AG0AbABGAG8AcgA9ACIAbwBuAGUAIgA%2BADwALwBsAGEAYgBlAGwAPgAKACAAIAAKACAAIAA8AGkAbgBwAHUAdAAgAGkAZAA9ACIAdAB3AG8AIgAgAC8APgAKACAAIAA8AGwAYQBiAGUAbAAgAGgAdABtAGwARgBvAHIAPQAiAHQAdwBvACIAPgBUAGgAaQBzACAAaQBzACAAbwBrAGEAeQA8AC8AbABhAGIAZQBsAD4ACgAgACAACgAgACAAPABpAG4AcAB1AHQAIABpAGQAPQAiAHQAaAByAGUAZQAiACAALwA%2BAAoAIAAgADwAbABhAGIAZQBsACAAaAB0AG0AbABGAG8AcgA9ACIAdABoAHIAZQBlACIAPgB7AGwAYQBiAGUAbAB9ADwALwBsAGEAYgBlAGwAPgAKACAAIAAKACAAIAA8AGkAbgBwAHUAdAAgAGkAZAA9ACIAZgBvAHUAcgAiACAALwA%2BAAoAIAAgADwAbABhAGIAZQBsACAAaAB0AG0AbABGAG8AcgA9ACIAZgBvAHUAcgAiAD4AewAnAEEAcABwAGEAcgBlAG4AdABsAHkAIAB0AGgAaQBzACAAaQBzACAAYQBsAHMAbwAgAG4AbwB0ACAAbwBrAGEAeQAnAH0APAAvAGwAYQBiAGUAbAA%2BAAoAIAAgAAoAIAAgADwAaQBuAHAAdQB0ACAAaQBkAD0AIgBmAGkAdgBlACIAIAAvAD4ACgAgACAAPABsAGEAYgBlAGwAIABoAHQAbQBsAEYAbwByAD0AIgBmAGkAdgBlACIAPgBUAGgAYQBuAGsAZgB1AGwAbAB5ACAAewAnAGEAdAAgAGwAZQBhAHMAdAAgAHQAaABpAHMAIABpAHMAIABvAGsAYQB5ACcAfQA8AC8AbABhAGIAZQBsAD4ACgA8AC8APgA%3D

Expected result

Labels that are statically analyzable to confirm they will result in a non-empty string should not be reported as errors.

This was not happening in 1.8.3, started showing up in 1.9.0.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@dyc3 dyc3 added L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug A-Analyzer Area: analyzer labels Sep 13, 2024
@lifeiscontent
Copy link

defining a label as a component also has issues:

https://biomejs.dev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ZgBvAHUAcgAiAD4AewAnAEEAcABwAGEAcgBlAG4AdABsAHkAIAB0AGgAaQBzACAAaQBzACAAYQBsAHMAbwAgAG4AbwB0ACAAbwBrAGEAeQAnAH0APAAvAGwAYQBiAGUAbAA%2BAAoAIAAgAAoAIAAgADwAaQBuAHAAdQB0ACAAaQBkAD0AIgBmAGkAdgBlACIAIAAvAD4ACgAgACAAPABsAGEAYgBlAGwAIABoAHQAbQBsAEYAbwByAD0AIgBmAGkAdgBlACIAPgBUAGgAYQBuAGsAZgB1AGwAbAB5ACAAewAnAGEAdAAgAGwAZQBhAHMAdAAgAHQAaABpAHMAIABpAHMAIABvAGsAYQB5ACcAfQA8AC8AbABhAGIAZQBsAD4ACgAKACAAIAA8AGkAbgBwAHUAdAAgAGkAZAA9ACIAcwBpAHgAIgAgAC8APgAKACAAIAA8AEwAYQBiAGUAbAAgAGgAdABtAGwARgBvAHIAPQAiAHMAaQB4ACIAPgBUAGgAaQBzACAAaQBzACAAYQBsAHMAbwAgAGEAbgAgAGkAcwBzAHUAZQA8AC8ATABhAGIAZQBsAD4ACgA8AC8APgA%3D

@wojtekmaj
Copy link
Author

@lifeiscontent Have you tried configuring the rule? Specifically I'm talking about labelComponents.

https://biomejs.dev/linter/rules/no-label-without-control/

@signalkuppe
Copy link

same here, this fails noLabelWithoutControl

<label htmlFor="lang-switcher">{t("Language")}</label>

@lifeiscontent
Copy link

@wojtekmaj yes, I would have in the playground, but no option to change the config from what I can tell

@othegagan
Copy link

othegagan commented Sep 30, 2024

@Conaclos how can i config or disable this rule noLabelWithoutControl in biome.js file.

Thank You, for your support

@Conaclos
Copy link
Member

@othegagan

{
  "linter": {
    "rules": {
      "a11y": {
        "noLabelWithoutControl": "off"
      }
    }
  }
}

@othegagan
Copy link

image

I am getting this warning, (I have biome 1.9.2 installed )

@ematipico
Copy link
Member

You're probably using an old version of the schema

@othegagan
Copy link

Yep, i just saw the $schema, in the config it was 1.8.3 but i had installed 1.9.2, after changing it to latest one it is working fine, i am able to disable this rule..

Thank You 😎👍

@ematipico
Copy link
Member

@othegagan

We always recommend running biome migrate --write after a version bump, the command will update the configuration for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Analyzer Area: analyzer L-JavaScript Language: JavaScript and super languages 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.

7 participants