biome icon indicating copy to clipboard operation
biome copied to clipboard

💅 lint/style/useSelfClosingElements false positive error

Open 7flash opened this issue 1 year ago • 2 comments

Environment information

CLI:
  Version:                      1.8.3
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.9.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.1.0"

Rule name

lint/style/useSelfClosingElements

Playground link

N/A

Expected result

When I run

npx @biomejs/biome lint ./src/index.tsx

its offering this fix which is wrong because script tag cannot be self-enclosing

Screenshot 2024-07-07 at 16 06 37

318 │ - ········<script·src="/filepond/filepond.js"> 318 │ + ········<script·src="/filepond/filepond.js"·/>

Code of Conduct

  • [X] I agree to follow Biome's Code of Conduct

7flash avatar Jul 07 '24 08:07 7flash

script tag cannot be self-enclosing

I think this is only true in HTML?

But this rule is only enabled in JSX, and JSX transpiler should transpile them into the same code, whether you use self-closing elements or not. You can check it in the babel playground.

Did I miss something? Or what kind of issues did you actually run into after you applied the fixes?

Sec-ant avatar Jul 08 '24 17:07 Sec-ant

Good call, @Sec-ant; you're right.

ematipico avatar Jul 08 '24 17:07 ematipico