diff --git a/packages/@vue/cli-plugin-eslint/lint.js b/packages/@vue/cli-plugin-eslint/lint.js index 0f789cee8f..a8a21b2b24 100644 --- a/packages/@vue/cli-plugin-eslint/lint.js +++ b/packages/@vue/cli-plugin-eslint/lint.js @@ -1,8 +1,10 @@ module.exports = function lint (args = {}, api) { + const path = require('path') + const chalk = require('chalk') const cwd = api.resolve('.') const { CLIEngine } = require('eslint') const options = require('./eslintOptions')(api) - const { done } = require('@vue/cli-shared-utils') + const { log, done } = require('@vue/cli-shared-utils') const files = args._ && args._.length ? args._ : ['src', 'tests', '*.js'] if (args['no-fix']) { @@ -21,10 +23,24 @@ module.exports = function lint (args = {}, api) { CLIEngine.outputFixes(report) } - if (!report.errorCount && !report.warningCount) { + if (!report.errorCount) { if (!args.silent) { const hasFixed = report.results.some(f => f.output) - done(hasFixed ? `All lint errors auto-fixed.` : `No lint errors found!`) + if (hasFixed) { + log(`The following files have been auto-fixed:`) + log() + report.results.forEach(f => { + if (f.output) { + log(` ${chalk.blue(path.relative(cwd, f.filePath))}`) + } + }) + log() + } + if (report.warningCount) { + console.log(formatter(report.results)) + } else { + done(hasFixed ? `All lint errors auto-fixed.` : `No lint errors found!`) + } } } else { console.log(formatter(report.results))