File tree 2 files changed +12
-2
lines changed
packages/@vue/cli-plugin-eslint
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ module.exports = (api, { lintOnSave }) => {
25
25
options : {
26
26
'--format [formatter]' : 'specify formatter (default: codeframe)' ,
27
27
'--no-fix' : 'do not fix errors' ,
28
- '--max-warnings [limit]' : 'specify number of warnings to make build failed'
28
+ '--max-errors [limit]' : 'specify number of errors to make build failed (default: 0)' ,
29
+ '--max-warnings [limit]' : 'specify number of warnings to make build failed (default: Infinity)'
29
30
} ,
30
31
details : 'For more options, see https://eslint.org/docs/user-guide/command-line-interface#options'
31
32
} , args => {
Original file line number Diff line number Diff line change @@ -20,7 +20,10 @@ module.exports = function lint (args = {}, api) {
20
20
CLIEngine . outputFixes ( report )
21
21
}
22
22
23
- if ( report . errorCount <= ( argsConfig . maxWarnings || 0 ) ) {
23
+ const isErrorsExceed = report . errorCount > ( argsConfig . maxErrors || 0 )
24
+ const isWarningsExceed = report . warningCount > (
25
+ 'maxWarnings' in argsConfig ? argsConfig . maxWarnings : Infinity )
26
+ if ( ! isErrorsExceed && ! isWarningsExceed ) {
24
27
if ( ! args . silent ) {
25
28
const hasFixed = report . results . some ( f => f . output )
26
29
if ( hasFixed ) {
@@ -41,6 +44,12 @@ module.exports = function lint (args = {}, api) {
41
44
}
42
45
} else {
43
46
console . log ( formatter ( report . results ) )
47
+ if ( isErrorsExceed && typeof argsConfig . maxErrors === 'number' ) {
48
+ log ( `Eslint found too many errors (maximum: ${ argsConfig . maxErrors } ).` )
49
+ }
50
+ if ( isWarningsExceed ) {
51
+ log ( `Eslint found too many warnings (maximum: ${ argsConfig . maxWarnings } ).` )
52
+ }
44
53
process . exit ( 1 )
45
54
}
46
55
}
You can’t perform that action at this time.
0 commit comments