-
-
Notifications
You must be signed in to change notification settings - Fork 650
Closed
Copy link
Labels
A-LinterArea: linterArea: linterL-JavaScriptLanguage: JavaScript and super languagesLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bugStatus: report has been confirmed as a valid bug
Description
Environment information
playground
Rule name
lint/nursery/noShadow
Playground link
Expected result
In the playground, noShadow
flags the function argument in a type definition as shadowing a variable in the upper scope. This shouldn't matter, because the argument names in type definitions don't actually matter for the type definition.
Since the playground is kinda noisy for this, this is the diagnostic in question.
This variable shadows another variable with the same name in the outer scope.
1 │ type Props = {
2 │ contact: ContantData;
> 3 │ onChange?: (contact: ContantData) => void;
│ ^^^^^^^
4 │ onDelete?: (contact: ContantData) => void;
5 │ };
ℹ This is the shadowed variable, which is now inaccessible in the inner scope.
4 │ onDelete?: (contact: ContantData) => void;
5 │ };
> 6 │ const { contact = {}, onChange = () => {}, onDelete = () => {} }: Props = {};
│ ^^^^^^^
7 │
ℹ Consider renaming this variable. It's easy to confuse the origin of variables if they share the same name.
Code of Conduct
- I agree to follow Biome's Code of Conduct
Metadata
Metadata
Assignees
Labels
A-LinterArea: linterArea: linterL-JavaScriptLanguage: JavaScript and super languagesLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bugStatus: report has been confirmed as a valid bug