-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle import aliases #445
Conversation
@@ -95,10 +95,12 @@ module.exports = { | |||
| [no-unnecessary-aliases](docs/rules/no-unnecessary-aliases.md) | Mark when an alias is unnecessary because its only an order permutation, not really a different name | ✈️ ✅ | | | 🔧 | | | |||
| [no-unnecessary-properties](docs/rules/no-unnecessary-properties.md) | Boolean properties are false by default, so they should not be set to false | | ✈️ ✅ | | 🔧 | | | |||
| [no-username-properties](docs/rules/no-username-properties.md) | Convert requiresUsername and supportusername to username flags | ✈️ | | | 🔧 | | | |||
| [only-extend-SfCommand](docs/rules/only-extend-SfCommand.md) | Only allow commands that directly extend SfCommand | | ✈️ ✅ | | | | |
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.
these are from Willie's PR
} | ||
} | ||
|
||
return node.superClass?.type === AST_NODE_TYPES.Identifier && (importedClasses.get(node.superClass.name) == 'SfCommand'); |
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.
this file contains the most relevant changes, the rest were tests/changes required due to changed funcs signatures.
// Handle import aliases | ||
else if (specifier.type === 'ImportSpecifier' && specifier.local.name !== specifier.imported.name) { | ||
importedClasses.set(specifier.local.name, specifier.imported.name); | ||
} |
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.
Fixes: #444
This PR updates the
extendsSfCommand
util to accountSfCommand
being imported with an alias.Before
commands extending SfCommand directly but using import aliases would get a warn from the new rules:
After:
rules are aware of how
SfCommand
is imported.@W-16300123@