@@ -26,47 +26,56 @@ function lint(input, config, webpack, callback) {
26
26
var res = engine . executeOnText ( input , resourcePath )
27
27
// executeOnText ensure we will have res.results[0] only
28
28
29
- // quiet filter done now
30
- // eslint allow rules to be specified in the input between comments
31
- // so we can found warnings defined in the input itself
32
- if ( res . warningCount && config . quiet ) {
33
- res . warningCount = 0
34
- res . results [ 0 ] . warningCount = 0
35
- res . results [ 0 ] . messages = res . results [ 0 ] . messages . filter ( function ( message ) {
36
- return message . severity !== 1
37
- } )
38
- }
29
+ // skip ignored file warning
30
+ if ( ! (
31
+ res . warningCount === 1 &&
32
+ res . results [ 0 ] . messages [ 0 ] &&
33
+ res . results [ 0 ] . messages [ 0 ] . message &&
34
+ res . results [ 0 ] . messages [ 0 ] . message . indexOf ( ".eslintignore" ) > - 1 &&
35
+ res . results [ 0 ] . messages [ 0 ] . message . indexOf ( "--no-ignore" ) > - 1
36
+ ) ) {
37
+ // quiet filter done now
38
+ // eslint allow rules to be specified in the input between comments
39
+ // so we can found warnings defined in the input itself
40
+ if ( res . warningCount && config . quiet ) {
41
+ res . warningCount = 0
42
+ res . results [ 0 ] . warningCount = 0
43
+ res . results [ 0 ] . messages = res . results [ 0 ] . messages . filter ( function ( message ) {
44
+ return message . severity !== 1
45
+ } )
46
+ }
39
47
40
- if ( res . errorCount || res . warningCount ) {
41
- // add filename for each results so formatter can have relevant filename
42
- res . results . forEach ( function ( r ) {
43
- r . filePath = webpack . resourcePath
44
- } )
45
- var messages = config . formatter ( res . results )
48
+ if ( res . errorCount || res . warningCount ) {
49
+ // add filename for each results so formatter can have relevant filename
50
+ res . results . forEach ( function ( r ) {
51
+ r . filePath = webpack . resourcePath
52
+ } )
53
+ var messages = config . formatter ( res . results )
46
54
47
- // default behavior: emit error only if we have errors
48
- var emitter = res . errorCount ? webpack . emitError : webpack . emitWarning
55
+ // default behavior: emit error only if we have errors
56
+ var emitter = res . errorCount ? webpack . emitError : webpack . emitWarning
49
57
50
- // force emitError or emitWarning if user want this
51
- if ( config . emitError ) {
52
- emitter = webpack . emitError
53
- }
54
- else if ( config . emitWarning ) {
55
- emitter = webpack . emitWarning
56
- }
58
+ // force emitError or emitWarning if user want this
59
+ if ( config . emitError ) {
60
+ emitter = webpack . emitError
61
+ }
62
+ else if ( config . emitWarning ) {
63
+ emitter = webpack . emitWarning
64
+ }
57
65
58
- if ( emitter ) {
59
- emitter ( messages )
60
- if ( config . failOnError && res . errorCount ) {
61
- throw new Error ( "Module failed because of a eslint error." )
66
+ if ( emitter ) {
67
+ emitter ( messages )
68
+ if ( config . failOnError && res . errorCount ) {
69
+ throw new Error ( "Module failed because of a eslint error." )
70
+ }
71
+ else if ( config . failOnWarning && res . warningCount ) {
72
+ throw new Error ( "Module failed because of a eslint warning." )
73
+ }
62
74
}
63
- else if ( config . failOnWarning && res . warningCount ) {
64
- throw new Error ( "Module failed because of a eslint warning." )
75
+ else {
76
+ throw new Error ( "Your module system doesn't support emitWarning. Update available? \n" + messages )
65
77
}
66
78
}
67
- else {
68
- throw new Error ( "Your module system doesn't support emitWarning. Update available? \n" + messages )
69
- }
70
79
}
71
80
72
81
if ( callback ) {
0 commit comments