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.26k stars 442 forks source link

💅 [useNamingConvention] Interfaces from lib.dom.ts are not always in PascalCase in TypeScript #2171

Closed motss closed 5 months ago

motss commented 6 months ago

Environment information

❯ ppm biome rage --linter  
CLI:
  Version:                      1.6.2
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v21.0.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/8.15.4"

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

Linter:
  Recommended:                  true
  All:                          false
  Rules:                        a11y/all = true
                                complexity/all = true
                                complexity/noExcessiveCognitiveComplexity = "off"
                                complexity/noStaticOnlyClass = "off"
                                complexity/noUselessSwitchCase = "off"
                                complexity/useSimplifiedLogicExpression = "off"
                                correctness/all = true
                                nursery/all = true
                                nursery/noConsole = "off"
                                nursery/useImportRestrictions = "off"
                                performance/all = true
                                security/all = true
                                style/all = true
                                suspicious/all = true
                                suspicious/useAwait = "off"

Workspace:
  Open Documents:               0

Rule name

useNamingConvention

Playground link

https://biomejs.dev/playground/?lintRules=all&code=YwBsAGEAcwBzACAAQQBiAGMAIAB7AH0ACgAKAGQAZQBjAGwAYQByAGUAIABnAGwAbwBiAGEAbAAgAHsACgAgACAAaQBuAHQAZQByAGYAYQBjAGUAIABIAFQATQBMAEUAbABlAG0AZQBuAHQAVABhAGcATgBhAG0AZQBNAGEAcAAgAHsACgAgACAAIAAgACcAdABlAHMAdAAtAGEAYgBjACcAOgAgAEEAYgBjADsACgAgACAAfQAKAH0ACgA%3D

Expected result

Actual behavior

After running biome check --apply, it auto-fixes HTMLElementTagNameMap into HtmlElementTagNameMap.

class Abc {}

declare global {
  interface HtmlElementTagNameMap {
    'test-abc': Abc;
  }
}

Expected behavior

After running biome check --apply, it should not auto-fix HTMLElementTagNameMap and HTMLElementTagNameMap is a valid interface name that does not have to follow the naming convention defined by the useNamingConvention rule.

class Abc {}

declare global {
  interface HTMLElementTagNameMap {
    'test-abc': Abc;
  }
}

Code of Conduct

Conaclos commented 6 months ago

We provide the strictCase option to allow such names.

motss commented 5 months ago

@Conaclos Thanks for pointing that out.