-
Notifications
You must be signed in to change notification settings - Fork 887
Conversation
|
||
class NoInternalModuleWalker extends Lint.RuleWalker { | ||
public visitModuleDeclaration(node: ts.ModuleDeclaration) { | ||
let name = node.name.getText(); |
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 don't think you should look at the raw text here. The type of node.name
is Identifier | LiteralExpression
. So you should be able to simplify this to:
if (Lint.isNodeFlagSet(node, ts.NodeFlags.Namespace)) {
// ok namespace
} else if (node.name.syntaxKind === ts.SyntaxKind.Identifier) {
// for external modules, node.name will be a LiteralExpression instead of Identifier
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
}
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.
cool! I added a commit.
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 name
variable is no longer used. Linting should've picked that up, maybe it's a bug... Regardless, let's remove the let 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.
oops, sorry!
efc3458
to
39c3e92
Compare
sweet, thanks! |
implement #513