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

Updates no-url-protocols rule and adds additional no-domains rule #846

Merged

Conversation

danwaz
Copy link
Contributor

@danwaz danwaz commented Aug 25, 2016

Addresses issue #813

This pull request addresses the conflation of the no-url-protocols and no-domains rules. In addition, it also adds a configuration option to allow for protocol-relative-urls (i.e. //some-domain.com/foo.png) within the no-url-protocols rule.

As discussed in issue #813, this new configuration should not add any breaking changes if users decide to update to this version. All additional configurations are set to false by default. Also to keep in mind, when the project updates to v2, all legacy no-domain logic should be removed from the no-url-protocols rule.

Unit tests and documentation have been updated to reflect the new rule and additional configuration.

<DCO 1.1 Signed-off-by: Dan Wasilewski heydanwaz@gmail.com>

@danwaz danwaz changed the title Updates no-url-protocols rule and adds additional no-domains rule #813 Updates no-url-protocols rule and adds additional no-domains rule Aug 25, 2016
@coveralls
Copy link

coveralls commented Aug 25, 2016

Coverage Status

Coverage increased (+0.01%) to 97.266% when pulling 453bac4 on danwaz:feature/issue-813-no-url-protocol-fix into 69efff8 on sasstools:develop.

@coveralls
Copy link

coveralls commented Aug 25, 2016

Coverage Status

Coverage increased (+0.01%) to 97.266% when pulling 453bac4 on danwaz:feature/issue-813-no-url-protocol-fix into 69efff8 on sasstools:develop.

@DanPurdy
Copy link
Member

Hey @danwaz would you mind updating the branch again I just had to finish merging the release branch in. I can review it for you after that.

Thanks for the PR! 👍

@danwaz
Copy link
Contributor Author

danwaz commented Aug 25, 2016

@DanPurdy No problem! Updating now.

@coveralls
Copy link

coveralls commented Aug 25, 2016

Coverage Status

Coverage increased (+0.01%) to 97.266% when pulling c995feb on danwaz:feature/issue-813-no-url-protocol-fix into c3a0260 on sasstools:develop.


module.exports = {
'name': 'no-url-protocols',
'defaults': {},
'defaults': {
'protocol-relative-urls': false
Copy link
Member

@DanPurdy DanPurdy Aug 25, 2016

Choose a reason for hiding this comment

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

I think this needs a positive or negative prefix, such as allow-protocol-relative(-urls)? This would reverse the logic slightly and mean you could remove the logical operators when assigning regexSelector and message below.

Overall i feel it's more declarative and less ambiguous about its intentions when a user comes across it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added allow-protocol-relative-urls here. I agree, much less ambiguous.

@DanPurdy
Copy link
Member

Hey @danwaz, I've left a few comments for discussion, looking forward to hearing your thoughts. Appreciate the contribution 👍

@coveralls
Copy link

coveralls commented Aug 25, 2016

Coverage Status

Coverage increased (+0.01%) to 97.266% when pulling 56d3e4f on danwaz:feature/issue-813-no-url-protocol-fix into c3a0260 on sasstools:develop.

@DanPurdy
Copy link
Member

DanPurdy commented Aug 26, 2016

Awesome, looking good! I'll give it a once over again in the morning (it's late here!) and merge it in if all is good. You may want to add your 'Huge' email address as a secondary to your github account too for proper attribution of those commits! 😉

Resolves #813

@DanPurdy DanPurdy added this to the 1.10 milestone Aug 26, 2016
@danwaz
Copy link
Contributor Author

danwaz commented Aug 26, 2016

Thanks @DanPurdy! H/t for the email suggestion.

@@ -25,6 +25,7 @@ rules:
no-css-comments: 1
no-debug: 1
no-disallowed-properties: 0
no-url-domains: 1
Copy link
Member

Choose a reason for hiding this comment

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

Could you add this in alphabetical order within this block please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@DanPurdy
Copy link
Member

Just one more change and then this is good to go!

@coveralls
Copy link

coveralls commented Aug 26, 2016

Coverage Status

Coverage increased (+0.01%) to 97.266% when pulling 21f836e on danwaz:feature/issue-813-no-url-protocol-fix into c3a0260 on sasstools:develop.

@DanPurdy DanPurdy merged commit 01eb696 into sasstools:develop Aug 26, 2016
@DanPurdy
Copy link
Member

🎉 🎉 Thanks @danwaz !

var stripped = helpers.stripQuotes(item.content),
parsedUrl = url.parse(stripped, false, true);

if (parsedUrl.host && parsedUrl.protocol !== 'data:') {

Choose a reason for hiding this comment

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

What about //assets.example.com/some-font.ttf ? It fails on this and I think it shouldn't.

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

4 participants