Skip to content

💅 nursery/noShadow: implement ignoreTypeValueShadow option from source rule #7812

@GabeDuarteM

Description

@GabeDuarteM

Environment information

npx biome rage --linter
CLI:
  Version:                      2.2.6
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  BIOME_THREADS:                unset
  NO_COLOR:                     unset
  TERM:                         tmux-256color
  JS_RUNTIME_VERSION:           v22.20.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         npm/10.9.3

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         biome.json
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  true

Linter:
  JavaScript enabled:           unset
  JSON enabled:                 unset
  CSS enabled:                  unset
  GraphQL enabled:              unset
  Recommended:                  false
  Enabled rules:
    complexity/noArguments
    correctness/useExhaustiveDependencies
    correctness/useHookAtTopLevel
    nursery/noImportCycles
    nursery/noShadow
    style/useConst
    suspicious/noVar

Workspace:
  Open Documents:               0

Rule name

lint/nursery/noShadow

Playground link

https://biomejs.dev/playground/?indentStyle=space&lintRules=noShadow&code=dAB5AHAAZQAgAFMAdABvAHIAeQAgAD0AIAB1AG4AawBuAG8AdwBuAAoACgAvAC8AIABBAGwAcwBvACAAaABhAHAAcABlAG4AcwAgAHcAaQB0AGgAIABpAG4AdABlAHIAZgBhAGMAZQBzADoACgAvAC8AIABpAG4AdABlAHIAZgBhAGMAZQAgAFMAdABvAHIAeQAgAHsACgAvAC8AIAAgACAAZABlAGMAbwByAGEAdABvAHIAcwA6ACAAYQBuAHkAWwBdAAoALwAvACAAfQAKAAoAZQB4AHAAbwByAHQAIABjAG8AbgBzAHQAIABTAG8AbQBlAEQAbwBjAHUAbQBlAG4AdABhAHQAaQBvAG4AOgAgAFMAdABvAHIAeQAgAD0AIAB7AAoACQBkAGUAYwBvAHIAYQB0AG8AcgBzADoAIABbAAoACQAJACgAUwB0AG8AcgB5ACkAIAA9AD4AIAAoAAoACQAJAAkAPABkAGkAdgA%2BAAoACQAJAAkACQA8AFMAdABvAHIAeQAgAC8APgAKAAkACQAJADwALwBkAGkAdgA%2BAAoACQAJACkALAAKAAkAXQAsAAoAfQA7AAoA

Expected result

On the playground example there are two things sharing the name Story: one is a TypeScript type, the other is an argument inside a React component. In this scenario I expected biome check to pass without reporting a shadowing error, since ESLint’s no-shadow rule behaves that way today.

When a function parameter shares a name with a TypeScript type alias or interface, I would expect Biome not to treat it as a collision because the alias exists only in the type space.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-LinterArea: linterL-JavaScriptLanguage: JavaScript and super languagesS-EnhancementStatus: Improve an existing feature
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions