-
Notifications
You must be signed in to change notification settings - Fork 889
Add JSX text nodes into skip list of walker (fixes #2007) #2009
Conversation
|
Still there is a question: if there is need to support text nodes that consist of whitespaces and text that matches comment format? |
@@ -41,6 +41,11 @@ export class Rule extends Lint.Rules.AbstractRule { | |||
} | |||
|
|||
class NoTrailingWhitespaceWalker extends Lint.SkippableTokenAwareRuleWalker { | |||
// prevents skipping of JsxText nodes | |||
protected visitJsxText(node: ts.JsxText) { | |||
this.walkChildren(node); |
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.
Is there other way to restore super.super.visitJsxText
functionality?
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.
how about adding a constructor to SkippableTokenAwareRuleWalker
with a parameter skipJsx
?
Maybe it would be sufficient to just pass the correct |
@ajafff Thanks for suggestion. I'll try to dive deep into TS scanner difference between language variants and other ways to handle text nodes that has only comment text. |
Fixed in #2036. |
superseded by #2036 |
PR checklist
New feature,bugfix,or enhancementWhat changes did you make?
This PR adds
JsxText
nodes into skip map inSkippableTokenAwareRuleWalker
.Is there anything you'd like reviewers to focus on?
This change should definitely skip
JsxText
nodes inEnableDisableRulesWalker
,CommentWalker
andJsdocWalker
, but I'm unsure aboutWhitespaceWalker
andNoTrailingWhitespaceWalker
.If
JsxText
node consist of whitespace and "comment" it isn't added to skip map sincegetStart()
andgetEnd()
return same value. See test case