ember-template-lint
Advanced tools
Comparing version 0.8.0 to 0.8.1
Changelog | ||
========= | ||
## 0.8.1 | ||
- Fix issue with console output formatting to avoid noisy console output when no errors are present. | ||
## 0.8.0 | ||
@@ -5,0 +9,0 @@ |
@@ -152,4 +152,18 @@ 'use strict'; | ||
static errorsToMessages(filePath, errors, options) { | ||
options = options || {}; | ||
errors = errors || []; | ||
options = options || { | ||
verbose: false | ||
}; | ||
if (errors.length === 0) { | ||
return ''; | ||
} | ||
let errorsMessages = errors.map((error) => this._formatError(error, options)).join('\n'); | ||
return `${chalk.underline(filePath)}\n${errorsMessages}\n`; | ||
} | ||
static _formatError(error, options) { | ||
let message = ''; | ||
let severities = { | ||
@@ -160,22 +174,16 @@ 1: 'warrning', | ||
let errorsMessages = errors.map(error => { | ||
let message = ''; | ||
if (error.line && error.column) { | ||
message += chalk.dim(` ${error.line}:${error.column}`); | ||
} else { | ||
message += chalk.dim(' -:-'); | ||
} | ||
if (error.line && error.column) { | ||
message += chalk.dim(` ${error.line}:${error.column}`); | ||
} else { | ||
message += chalk.dim(' -:-'); | ||
} | ||
message += ` ${chalk.red(severities[error.severity] || 'error')}`; | ||
message += ` ${error.message} ${chalk.dim(error.rule)}`; | ||
message += ` ${chalk.red(severities[error.severity] || 'error')}`; | ||
message += ` ${error.message} ${chalk.dim(error.rule)}`; | ||
if (options.verbose) { | ||
message += `\n${error.source}`; | ||
} | ||
if (options.verbose) { | ||
message += `\n${error.source}`; | ||
} | ||
return message; | ||
}).join('\n'); | ||
return `${chalk.underline(filePath)}\n${errorsMessages}\n`; | ||
return message; | ||
} | ||
@@ -182,0 +190,0 @@ } |
{ | ||
"name": "ember-template-lint", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "Lint your templates.", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -571,3 +571,9 @@ 'use strict'; | ||
}); | ||
it('formats empty errors', function() { | ||
let result = Linter.errorsToMessages('file/path', []); | ||
expect(result).to.equal(''); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
326884
7031