Skip to content

Commit 2b6dba3

Browse files
authoredJan 21, 2019
feat: add --no-fix-warnings option (#3307)
1 parent d047aca commit 2b6dba3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ module.exports = (api, options) => {
6161
usage: 'vue-cli-service lint [options] [...files]',
6262
options: {
6363
'--format [formatter]': 'specify formatter (default: codeframe)',
64-
'--no-fix': 'do not fix errors',
64+
'--no-fix': 'do not fix errors or warnings',
65+
'--no-fix-warnings': 'fix errors, but do not fix warnings',
6566
'--max-errors [limit]': 'specify number of errors to make build failed (default: 0)',
6667
'--max-warnings [limit]': 'specify number of warnings to make build failed (default: Infinity)'
6768
},

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

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ module.exports = function lint (args = {}, api) {
3232
cwd
3333
}, argsConfig)
3434

35+
const noFixWarnings = (argsConfig.fixWarnings === false)
36+
const noFixWarningsPredicate = (lintResult) => lintResult.severity === 2
37+
config.fix = config.fix && (noFixWarnings ? noFixWarningsPredicate : true)
38+
3539
if (!fs.existsSync(api.resolve('.eslintignore'))) {
3640
// .eslintrc.js files (ignored by default)
3741
// However, we need to lint & fix them so as to make the default generated project's

0 commit comments

Comments
 (0)
Please sign in to comment.