-
Notifications
You must be signed in to change notification settings - Fork 660
fix(rome_js_semantic): correct the export determination when a variable and an interface
had the same name
#4468
Conversation
✅ Deploy Preview for docs-rometools canceled.Built without sensitive environment variables
|
feat: make value of bindings_by_name vector feat: export exportable declration fix: export order refactor: restore bindings change test: update snapshot chore: add comment chore: fix test
interface
had the same name
@@ -7,6 +7,9 @@ | |||
### Editors | |||
### Formatter | |||
### Linter | |||
|
|||
- Fix an issue that [`noUnusedVariables`](https://docs.rome.tools/lint/rules/nounusedvariables/) rule did not correctly detect exports when a variable and an `interface` had the same name [#4468](https://github.com/rome/tools/pull/4468) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add the #### Other changes
heading
} | ||
|
||
#[derive(Debug)] | ||
struct DeclaredBinding { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a brief documentation of the struct, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simply renamed DeclaredBinding
to BindingInfo
. And I added some comment to it but the confusion is might be resolved by naming.
name.clone(), | ||
DeclaredBinding { | ||
text_range: declaration_range, | ||
syntax_kind: *parent_syntax_kind, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name syntax_kind
is a bit misleading because I thought we were saving the syntax kind of the node, but instead, we are passing the parent syntax kind. Should we change the name and document it a bit why we save the parent syntax kind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I also updated the property name from syntax_kind
to declaration_kind
. I think this change can resolve why the property is needed. How do you feel about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me!
Summary
Closes #4353
Test Plan
cargo test -p rome_js_analyze -- no_unused_variables
Changelog
Documentation
[ ] The PR requires documentation[ ] I will create a new PR to update the documentation