-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/max-line-length
- Loading branch information
Showing
34 changed files
with
609 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Max warnings | ||
|
||
An error will be thrown if the total number of warnings exceeds the `max-warnings` setting. | ||
|
||
## Examples | ||
|
||
This can be set as a command-line option: | ||
|
||
``` bash | ||
$ sass-lint --max-warnings 50 | ||
``` | ||
|
||
In `.sass-lint.yml`: | ||
|
||
``` yaml | ||
options: | ||
max-warnings: 50 | ||
``` | ||
Or inside a script: | ||
``` javascript | ||
var sassLint = require('sass-lint'), | ||
config = {options: {'max-warnings': 50}}; | ||
|
||
results = sassLint.lintFiles('sass/**/*.scss', config) | ||
sassLint.failOnError(results, config); | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# No Url Domains | ||
|
||
Rule `no-url-domains` will enforce that domains are not used within urls. | ||
|
||
## Examples | ||
|
||
When enabled, the following are allowed: | ||
|
||
```scss | ||
.foo { | ||
background-image: url('/img/bar.png'); | ||
} | ||
|
||
.foo { | ||
background-image: url('img/bar.png'); | ||
} | ||
|
||
.foo { | ||
background-image: url('bar.png'); | ||
} | ||
``` | ||
|
||
When enabled, the following are disallowed: | ||
|
||
```scss | ||
.foo { | ||
background-image: url('https://foo.com/img/bar.png'); | ||
} | ||
|
||
.foo { | ||
background-image: url('http://foo.com/img/bar.png'); | ||
} | ||
|
||
.foo { | ||
background-image: url('//foo.com/img/bar.png'); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
var util = require('util'); | ||
|
||
module.exports = { | ||
SassLintFailureError: function (message) { | ||
Error.captureStackTrace(this, this.constructor); | ||
this.name = 'SassLintFailureError'; | ||
this.message = message; | ||
}, | ||
MaxWarningsExceededError: function (message) { | ||
Error.captureStackTrace(this, this.constructor); | ||
this.name = 'MaxWarningsExceededError'; | ||
this.message = message; | ||
} | ||
}; | ||
|
||
util.inherits(module.exports.SassLintFailureError, Error); | ||
util.inherits(module.exports.MaxWarningsExceededError, Error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
var helpers = require('../helpers'), | ||
url = require('url'); | ||
|
||
module.exports = { | ||
'name': 'no-url-domains', | ||
'defaults': {}, | ||
'detect': function (ast, parser) { | ||
var result = []; | ||
|
||
ast.traverseByType('uri', function (uri) { | ||
uri.traverse(function (item) { | ||
if (item.is('string')) { | ||
var stripped = helpers.stripQuotes(item.content), | ||
parsedUrl = url.parse(stripped, false, true); | ||
|
||
if (parsedUrl.host && parsedUrl.protocol !== 'data:') { | ||
result = helpers.addUnique(result, { | ||
'ruleId': parser.rule.name, | ||
'severity': parser.severity, | ||
'line': item.end.line, | ||
'column': item.end.column, | ||
'message': 'Domains in URLs are disallowed' | ||
}); | ||
} | ||
} | ||
}); | ||
}); | ||
|
||
return result; | ||
} | ||
}; |
Oops, something went wrong.