Skip to content
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

Merged
merged 2 commits into from
Sep 26, 2017

Conversation

DanPurdy
Copy link
Member

@DanPurdy DanPurdy commented Sep 2, 2017

Fixes #988

<DCO 1.1 Signed-off-by: Dan Purdy dan@dpurdy.me>

@DanPurdy DanPurdy force-pushed the feature/ignore-interpolation-class-names branch from 709d915 to 6c8f13f Compare September 2, 2017 15:25
@coveralls
Copy link

coveralls commented Sep 2, 2017

Coverage Status

Coverage increased (+0.002%) to 97.576% when pulling 6c8f13f on feature/ignore-interpolation-class-names into ca0690b on v1-dev.

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')) {
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

@bgriffith bgriffith Sep 8, 2017

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!

Copy link
Member Author

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.

Copy link
Member

@bgriffith bgriffith left a 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.

@coveralls
Copy link

coveralls commented Sep 25, 2017

Coverage Status

Coverage increased (+0.02%) to 97.591% when pulling 24ef9ba on feature/ignore-interpolation-class-names into ca0690b on v1-dev.

@DanPurdy
Copy link
Member Author

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.

@DanPurdy
Copy link
Member Author

Fixes #952

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants