Fix: Make max-len ignoreStrings ignore JSXText (fixes #9954)#9985
Fix: Make max-len ignoreStrings ignore JSXText (fixes #9954)#9985not-an-aardvark merged 2 commits intoeslint:masterfrom
Conversation
kaicataldo
left a comment
There was a problem hiding this comment.
Thanks for contributing to ESLint! This looks good to me, but I do have one question.
This change will make it so that text in between tags will also be ignored. Is this the desired behavior? The issue only mentions props, so I just wanted to double check.
Example:
var foo = <div className="this is a very long string">this is another very long string</div>;|
I am not sure if it is desired behavior but I think var foo = <div className="this is a very long string"> short </div>;should be ignored but var foo = <div>this is another very long string</div>;should not be ignored (since this case is more avoidable and we usually expect strings to be in quotes) How about an additional check if the token is surrounded by quotes? |
|
Looked into this a little more, and given the description of the option (
I think we might be able to just check if the |
|
Updated to check if |
|
I agree with #9985 (comment); a child node is not a string, even tho it's also text. |
kaicataldo
left a comment
There was a problem hiding this comment.
LGTM. Thanks for contributing to ESLint!
|
Thanks for contributing! |
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
Fixes #9954.
What changes did you make? (Give an overview)
Previously,
getAllStringsonly filter for tokens with typeString. The filter should check if the token type isJSXTextas well.Is there anything you'd like reviewers to focus on?
Nothing in particular.