зеркало из https://github.com/twbs/bootlint.git
Add wiki URLs to console output; fixes #342
Note this will only work in the browser. Also adds a `url` property to LintError & LintWarning. Closes #353
This commit is contained in:
Родитель
494ff55f30
Коммит
6630a83a79
|
@ -60,6 +60,7 @@ var LocationIndex = _location.LocationIndex;
|
|||
'script[src$="/bootstrap.min.js"]',
|
||||
'script[src="bootstrap.min.js"]'
|
||||
].join(',');
|
||||
var WIKI_URL = 'https://github.com/twbs/bootlint/wiki/';
|
||||
|
||||
function compareNums(a, b) {
|
||||
return a - b;
|
||||
|
@ -269,6 +270,7 @@ var LocationIndex = _location.LocationIndex;
|
|||
*/
|
||||
function LintError(id, message, elements) {
|
||||
this.id = id;
|
||||
this.url = WIKI_URL + id;
|
||||
this.message = message;
|
||||
this.elements = elements || cheerio('');
|
||||
}
|
||||
|
@ -282,6 +284,7 @@ var LocationIndex = _location.LocationIndex;
|
|||
*/
|
||||
function LintWarning(id, message, elements) {
|
||||
this.id = id;
|
||||
this.url = WIKI_URL + id;
|
||||
this.message = message;
|
||||
this.elements = elements || cheerio('');
|
||||
}
|
||||
|
@ -1189,10 +1192,10 @@ var LocationIndex = _location.LocationIndex;
|
|||
}
|
||||
|
||||
if (!lint.elements.length) {
|
||||
console.warn("bootlint: %c " + lint.id + " ", background, lint.message);
|
||||
console.warn("bootlint: %c " + lint.id + " ", background, lint.message + " Documentation: " + lint.url);
|
||||
}
|
||||
else {
|
||||
console.warn("bootlint: %c " + lint.id + " ", background, lint.message + '\n', lint.elements);
|
||||
console.warn("bootlint: %c " + lint.id + " ", background, lint.message + " Documentation: " + lint.url, lint.elements);
|
||||
}
|
||||
errorCount++;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче