Skip to content

Commit

Permalink
issue-813 -- Addresses PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
danwaz committed Aug 25, 2016
1 parent c995feb commit 56d3e4f
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions docs/rules/no-domains.md → docs/rules/no-url-domains.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# No Domains
# No Url Domains

Rule `no-domains` will enforce that domains are not used within urls.
Rule `no-url-domains` will enforce that domains are not used within urls.

## Examples

Expand Down
14 changes: 8 additions & 6 deletions docs/rules/no-url-protocols.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ Rule `no-url-protocols` will enforce that protocols and domains are not used wit

## Options

* `protocol-relative-urls`: `true`/`false` (defaults to `false`)
* `allow-protocol-relative-urls`: `true`/`false` (defaults to `false`)
> This option is scheduled to be deprecated in favour of the [no-url-domains](https://github.com/sasstools/sass-lint/blob/develop/docs/rules/no-url-domains.md) rule in sass-lint 2.0.
## Examples

### `protocol-relative-urls`
### `allow-protocol-relative-urls`

When `protocol-relative-urls: false`, the following are allowed:

When `allow-protocol-relative-urls: false`, the following are allowed:

```scss
.foo {
Expand All @@ -26,7 +28,7 @@ When `protocol-relative-urls: false`, the following are allowed:
}
```

When `protocol-relative-urls: false`, the following are disallowed:
When `allow-protocol-relative-urls: false`, the following are disallowed:

```scss
.foo {
Expand All @@ -42,7 +44,7 @@ When `protocol-relative-urls: false`, the following are disallowed:
}
```

When `protocol-relative-urls: true`, the following are allowed:
When `allow-protocol-relative-urls: true`, the following are allowed:

```scss
.foo {
Expand All @@ -62,7 +64,7 @@ When `protocol-relative-urls: true`, the following are allowed:
}
```

When `protocol-relative-urls: true`, the following are disallowed:
When `allow-protocol-relative-urls: true`, the following are disallowed:

```scss
.foo {
Expand Down
2 changes: 1 addition & 1 deletion lib/config/sass-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ rules:
no-css-comments: 1
no-debug: 1
no-disallowed-properties: 0
no-domains: 0
no-url-domains: 1
no-duplicate-properties: 1
no-empty-rulesets: 1
no-extends: 0
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-domains.js → lib/rules/no-url-domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var helpers = require('../helpers'),
url = require('url');

module.exports = {
'name': 'no-domains',
'name': 'no-url-domains',
'defaults': {},
'detect': function (ast, parser) {
var result = [];
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/no-url-protocols.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var isUrlRegex = /^(https?:)?\/\//,
module.exports = {
'name': 'no-url-protocols',
'defaults': {
'protocol-relative-urls': false
'allow-protocol-relative-urls': false
},
'detect': function (ast, parser) {
var result = [];
Expand All @@ -17,9 +17,9 @@ module.exports = {
uri.traverse(function (item) {
if (item.is('string')) {
var stripped = helpers.stripQuotes(item.content),
regexSelector = !parser.options['protocol-relative-urls'] ?
regexSelector = !parser.options['allow-protocol-relative-urls'] ?
isUrlRegex : protocolRelativeRegex,
message = !parser.options['protocol-relative-urls'] ?
message = !parser.options['allow-protocol-relative-urls'] ?
'Protocols and domains in URLs are disallowed' :
'Protocols in URLS are disallowed';

Expand Down
12 changes: 6 additions & 6 deletions tests/rules/no-domains.js → tests/rules/no-url-domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ var lint = require('./_lint');
//////////////////////////////
// SCSS syntax tests
//////////////////////////////
describe('no domains - scss', function () {
var file = lint.file('no-domains.scss');
describe('no url domains - scss', function () {
var file = lint.file('no-url-domains.scss');

it('enforce', function (done) {
lint.test(file, {
'no-domains': 1
'no-url-domains': 1
}, function (data) {
lint.assert.equal(3, data.warningCount);
done();
Expand All @@ -21,12 +21,12 @@ describe('no domains - scss', function () {
//////////////////////////////
// Sass syntax tests
//////////////////////////////
describe('no domains - sass', function () {
var file = lint.file('no-domains.sass');
describe('no url domains - sass', function () {
var file = lint.file('no-url-domains.sass');

it('enforce', function (done) {
lint.test(file, {
'no-domains': 1
'no-url-domains': 1
}, function (data) {
lint.assert.equal(3, data.warningCount);
done();
Expand Down
8 changes: 4 additions & 4 deletions tests/rules/no-url-protocols.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ describe('no url protocols - scss', function () {
});
});

it('allow protocol-relative-urls urls [protocol-relative-urls: true]', function (done) {
it('[allow-protocol-relative-urls: true]', function (done) {
lint.test(file, {
'no-url-protocols': [
1,
{
'protocol-relative-urls': true
'allow-protocol-relative-urls': true
}
]
}, function (data) {
Expand All @@ -48,12 +48,12 @@ describe('no url protocols - sass', function () {
});
});

it('allow protocol-relative-urls urls [protocol-relative-urls: true]', function (done) {
it('[allow-protocol-relative-urls: true]', function (done) {
lint.test(file, {
'no-url-protocols': [
1,
{
'protocol-relative-urls': true
'allow-protocol-relative-urls': true
}
]
}, function (data) {
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 56d3e4f

Please sign in to comment.