Skip to content
This repository was archived by the owner on Sep 18, 2023. It is now read-only.

relax extends-correct-class rule for imports #53

Merged
merged 2 commits into from
Jan 3, 2023

Conversation

keithamus
Copy link
Contributor

When using the extends-correct-class rule with an imported class, it is not possible to determine the superclass from the import statement alone.

Currently, we fail the check because the classRefTracker will track the Import Specifier, which will not have a superClass property (as its an Identifier not a ClassDefinition). This means that the rule, when turned on, fails on imported classes.

This PR changes this to guard against linting identifiers which come from an ImportDefaultSpecifier or ImportSpecifier. The guard returns early, so the check is skipped. This means that the rule, when turned on, will no longer fail on imported classes.

@keithamus keithamus requested a review from a team as a code owner November 30, 2022 18:27
@keithamus keithamus requested a review from srt32 November 30, 2022 18:27
@keithamus keithamus merged commit bc5734f into main Jan 3, 2023
@keithamus keithamus deleted the relax-extends-correct-class-rule-for-imports branch January 3, 2023 11:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants