Skip to content

Commit

Permalink
fix: allow ignore files to be read (#100)
Browse files Browse the repository at this point in the history
* fix: allow ignore files to be read

* fix: skip general messages reported without line numbers
  • Loading branch information
varl authored Jul 17, 2019
1 parent 21d323c commit a89faab
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/tools/js/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ module.exports = (file, text, apply = false) => {
const options = {
baseConfig: require(eslintConfig),
fix: apply,
ignore: false,
ignore: true,
reportUnusedDisableDirectives: true,
}
try {
const engine = new eslint.CLIEngine({
Expand Down Expand Up @@ -72,10 +73,16 @@ module.exports = (file, text, apply = false) => {
if (message.ruleId) {
rule = `(${message.ruleId})`
}
response.messages.push({
checker: 'eslint',
message: `Line ${message.line}: ${message.message} ${rule}`,
})
if (message.line) {
response.messages.push({
checker: 'eslint',
message: `Line ${message.line}: ${message.message} ${rule}`,
})
} else {
log.debug(
`No line number, assuming general message: ${message.message}`
)
}
}
} catch (error) {
log.error(`ESLint format failed with error:\n${error}`)
Expand Down

0 comments on commit a89faab

Please sign in to comment.