Skip to content

Commit b162cab

Browse files
committedMar 6, 2018
fix: do not exit with 1 on lint warnings (fix #872)
1 parent 7cb01d0 commit b162cab

File tree

1 file changed

+19
-3
lines changed
  • packages/@vue/cli-plugin-eslint

1 file changed

+19
-3
lines changed
 

‎packages/@vue/cli-plugin-eslint/lint.js

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
module.exports = function lint (args = {}, api) {
2+
const path = require('path')
3+
const chalk = require('chalk')
24
const cwd = api.resolve('.')
35
const { CLIEngine } = require('eslint')
46
const options = require('./eslintOptions')(api)
5-
const { done } = require('@vue/cli-shared-utils')
7+
const { log, done } = require('@vue/cli-shared-utils')
68

79
const files = args._ && args._.length ? args._ : ['src', 'tests', '*.js']
810
if (args['no-fix']) {
@@ -21,10 +23,24 @@ module.exports = function lint (args = {}, api) {
2123
CLIEngine.outputFixes(report)
2224
}
2325

24-
if (!report.errorCount && !report.warningCount) {
26+
if (!report.errorCount) {
2527
if (!args.silent) {
2628
const hasFixed = report.results.some(f => f.output)
27-
done(hasFixed ? `All lint errors auto-fixed.` : `No lint errors found!`)
29+
if (hasFixed) {
30+
log(`The following files have been auto-fixed:`)
31+
log()
32+
report.results.forEach(f => {
33+
if (f.output) {
34+
log(` ${chalk.blue(path.relative(cwd, f.filePath))}`)
35+
}
36+
})
37+
log()
38+
}
39+
if (report.warningCount) {
40+
console.log(formatter(report.results))
41+
} else {
42+
done(hasFixed ? `All lint errors auto-fixed.` : `No lint errors found!`)
43+
}
2844
}
2945
} else {
3046
console.log(formatter(report.results))

0 commit comments

Comments
 (0)