-
Notifications
You must be signed in to change notification settings - Fork 528
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
Feature/ignore interpolation class names #1131
Conversation
709d915
to
6c8f13f
Compare
lib/helpers.js
Outdated
@@ -309,7 +309,10 @@ helpers.attemptTraversal = function (node, traversalPath) { | |||
currentNodeList = [], | |||
processChildNode = function processChildNode (child) { | |||
child.forEach(traversalPath[i], function (n) { | |||
nextNodeList.push(n); | |||
if (n.content && n.content.some && n.contains('interpolation')) { |
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.
Are you using some
here to determine if the array has length? Normally Array.prototype.some
requires a callback function - if above suggest just using n.content.length
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.
Well content might be a string and a string still has a length property so that's not a good way to determine if it's an array. We're not invoking some
just checking if it's defined on the prototype of whatever is in content and stops the rule crashing if it then tries to use the contain method which doesn't exist on a content of type 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.
Maybe use Array.isArray then as checking the prototype to determine if it's array ain't too reliable!
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.
Yeah i'll be honest i dont really know why i did it this way. I think I was actually doing something else with a some
at the same time and decided to use it. odd.. will change it now anyways.
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.
Good to go once you bump that change.
So best we can do for now is to use typeof i think and check we aren't trying to use against a string. When we update to v2 we can go ahead and use Array.isArray as it's in Node 4.5 lts. It's not in 0.10 or 0.12 which technically our v1 library supports. Even though im sure we've merged in some node >4.5 dependencies 😄 oops... Either way lets get this in to fix the issue, maybe gonzales should look to check it's error throwing as it's a gonzales crash that this prevents. |
Fixes #952 |
Fixes #988
<DCO 1.1 Signed-off-by: Dan Purdy dan@dpurdy.me>