pi-lens
Version:
Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo
21 lines (20 loc) • 597 B
YAML
id: no-shadow
language: TypeScript
message: "Variable '$NAME' shadows a variable from an outer scope"
severity: warning
note: |
Shadowing variables from outer scopes can cause confusion and bugs.
Rename the inner variable to avoid ambiguity.
rule:
all:
- any:
- pattern: let $NAME = $$$
- pattern: const $NAME = $$$
- pattern: var $NAME = $$$
- pattern: function $NAME($$$) { $$$ }
- inside:
any:
- kind: function_declaration
- kind: function_expression
- kind: arrow_function
- kind: method_definition