biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
https://biomejs.dev
Apache License 2.0
14.95k stars 464 forks source link

💅 lint/style/useSelfClosingElements false positive error #3364

Open 7flash opened 3 months ago

7flash commented 3 months ago

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

Sec-ant commented 3 months ago

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?

ematipico commented 3 months ago

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