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

New rule: no-disallowed-property-values #1142

Merged
merged 8 commits into from
Nov 13, 2017

Conversation

agnoster
Copy link
Contributor

@agnoster agnoster commented Sep 21, 2017

NOTE: I haven't done the DCO/Emoji stuff yet because I'm not sure if this is a desirable addition. If it is, I'll be happy to make any additional changes necessary to merge.

What do the changes you have made achieve?

This should allow blacklisting certain property values, in contrast to no-disallowed-properties which blacklists the property names. For example, this allows banning text-transform: capitalize while allowing other uses of text-transform.

Are there any new warning messages?

Just the ones from the lint rule.

Have you written tests?

I have added tests based off the tests for no-disallowed-properties.

Have you included relevant documentation

I have added a new doc in docs/rules/no-disallowed-property-values.md

Which issues does this resolve?

No open issues that I found.

<DCO 1.1 Signed-off-by: Isaac Wolkerstorfer isaac@asana.com>

@coveralls
Copy link

coveralls commented Sep 21, 2017

Coverage Status

Coverage decreased (-0.1%) to 97.419% when pulling 18ff882 on Asana:no-disallowed-property-values into deabaf6 on sasstools:develop.

if (!disallowedPropertyValues) {
return;
}
if (typeof disallowedPropertyValues === 'string') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You allow property values to be specified as strings outside of arrays here, you don't have this in your tests, it would be good to add this case in. Maybe duplicate the display: ['inline'] as just display: 'inline' that would help.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Though I ended up just replacing the display: ['inline'] case with display: 'inline' which feels like it should be sufficient?

.foo {
text-transform: capitalize;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just add a quick example of multiple property values also, just to be complete in how we allow the property lists to be defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@DanPurdy
Copy link
Member

DanPurdy commented Sep 25, 2017

Hi @agnoster thanks for this, great stuff! Would you mind just having a look at the feedback I left, would be great to get this updated and ready for release soon. Also if you could just edit your initial comment to include your name/email for our contribution sign off <DCO 1.1 Signed-off-by: YOUR_FULL_NAME YOUR_EMAIL> that would be great. Thanks again for contributing! 👍

@DanPurdy
Copy link
Member

closes #1019

@coveralls
Copy link

coveralls commented Sep 27, 2017

Coverage Status

Coverage decreased (-0.06%) to 97.463% when pulling 116a4d0 on Asana:no-disallowed-property-values into 241e5a0 on sasstools:develop.

@agnoster
Copy link
Contributor Author

Great comments! Updated the docs and tests for those cases - I think we actually don't need the "array with one value" case if we're testing "array with two values" and "single string value"?

@DanPurdy
Copy link
Member

DanPurdy commented Sep 28, 2017

Hi @agnoster it would be good to include both. so single value as a string, single and multiple values in an array. It makes sense to test all the allowed cases like this just so we cover all cases. If you wouldn't mind just adding that case too then we could get this merged 👍 Its more so that in the future if we have to change something in the rule then we don't break compatibility for our users.

@agnoster
Copy link
Contributor Author

Ah, fair enough, good reasoning! Done :-D

@coveralls
Copy link

coveralls commented Sep 28, 2017

Coverage Status

Coverage decreased (-0.06%) to 97.463% when pulling cdce791 on Asana:no-disallowed-property-values into 241e5a0 on sasstools:develop.

@timothympace
Copy link

What's the status of this PR? I'm hoping to use this rule in a project.

Also, is there any plan to support blacklisting values that are strings? I noticed that if a property value is set to a string, ast.traverseByType('value', function (valueNode, idx, parent) { will not pick it up. String values have a node type of 'string'. And will there be any support for blacklisting values that are resolved through a variable?

@agnoster
Copy link
Contributor Author

agnoster commented Nov 4, 2017

Looks like it got approved but never merged?

@DanPurdy
Copy link
Member

DanPurdy commented Nov 6, 2017

Sorry, our develop branch is now work for v2 and I just haven't had time to go back through everything and merge it all. I will hopefully in the next few days and release this. It will be part of our v2 update though which just removed the eslint dependencies etc.

@coveralls
Copy link

coveralls commented Nov 13, 2017

Coverage Status

Coverage decreased (-0.06%) to 97.572% when pulling 16407a6 on Asana:no-disallowed-property-values into fad4e51 on sasstools:develop.

@DanPurdy DanPurdy merged commit 3043155 into sasstools:develop Nov 13, 2017
@srowhani
Copy link
Member

🎉 This PR is included in version 1.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

6 participants