eslint-loader
Advanced tools
Comparing version 0.12.0 to 0.13.0
@@ -0,5 +1,11 @@ | ||
# 0.13.0 - 2015-06-14 | ||
- Changed: a file that should be ignored doesn't trigger a warning | ||
([#44](https://github.com/MoOx/eslint-loader/issues/44)) | ||
# 0.12.0 - 2015-06-04 | ||
- Changed: upgrade to eslint 0.22.x | ||
- Fixed: respect .eslintrc files in directory tree ([#21](https://github.com/MoOx/eslint-loader/issues/21)) | ||
- Fixed: respect .eslintrc/eslintignore files in directory tree | ||
([#21](https://github.com/MoOx/eslint-loader/issues/21)) | ||
@@ -40,4 +46,6 @@ # 0.11.2 - 2015-05-11 | ||
- Changed: `reporter` now automatically drop lines that contains the filename in the reporter output. | ||
That mean you can use official or community reporters without worrying to see lot of lines with `<text>` as filename :) | ||
- Changed: `reporter` now automatically drop lines that contains the filename in | ||
the reporter output. | ||
That mean you can use official or community reporters without worrying to see | ||
lot of lines with `<text>` as filename :) | ||
@@ -48,5 +56,8 @@ # 0.5.0 - 2015-03-11 | ||
- Changed: `emitErrors` is now `emitError` | ||
- Changed: loader now use `webpack.emitError` or `webpack.emitWarning` automatically (according to eslint configuration). | ||
You can still override by using `emitError` or `emitWarning` options to override this behavior | ||
- Added: `emitWarning` can force eslint to report warning instead of the default behavior (see above) | ||
- Changed: loader now use `webpack.emitError` or `webpack.emitWarning` | ||
automatically (according to eslint configuration). | ||
You can still override by using `emitError` or `emitWarning` options to override | ||
this behavior | ||
- Added: `emitWarning` can force eslint to report warning instead of the default | ||
behavior (see above) | ||
- Added: `quiet` option to hide warnings | ||
@@ -72,3 +83,4 @@ | ||
- Changed: upgrade to eslint 0.12.x | ||
- Added: enable loading of eslint config from webpack config, `.eslintrc`, or `package.json` | ||
- Added: enable loading of eslint config from webpack config, `.eslintrc`, or | ||
`package.json` | ||
@@ -75,0 +87,0 @@ # 0.1.0 - 2014-12-05 |
77
index.js
@@ -29,43 +29,52 @@ var eslint = require("eslint") | ||
// quiet filter done now | ||
// eslint allow rules to be specified in the input between comments | ||
// so we can found warnings defined in the input itself | ||
if (res.warningCount && config.quiet) { | ||
res.warningCount = 0 | ||
res.results[0].warningCount = 0 | ||
res.results[0].messages = res.results[0].messages.filter(function(message) { | ||
return message.severity !== 1 | ||
}) | ||
} | ||
// skip ignored file warning | ||
if (!( | ||
res.warningCount === 1 && | ||
res.results[0].messages[0] && | ||
res.results[0].messages[0].message && | ||
res.results[0].messages[0].message.indexOf(".eslintignore") > -1 && | ||
res.results[0].messages[0].message.indexOf("--no-ignore") > -1 | ||
)) { | ||
// quiet filter done now | ||
// eslint allow rules to be specified in the input between comments | ||
// so we can found warnings defined in the input itself | ||
if (res.warningCount && config.quiet) { | ||
res.warningCount = 0 | ||
res.results[0].warningCount = 0 | ||
res.results[0].messages = res.results[0].messages.filter(function(message) { | ||
return message.severity !== 1 | ||
}) | ||
} | ||
if (res.errorCount || res.warningCount) { | ||
// add filename for each results so formatter can have relevant filename | ||
res.results.forEach(function(r) { | ||
r.filePath = webpack.resourcePath | ||
}) | ||
var messages = config.formatter(res.results) | ||
if (res.errorCount || res.warningCount) { | ||
// add filename for each results so formatter can have relevant filename | ||
res.results.forEach(function(r) { | ||
r.filePath = webpack.resourcePath | ||
}) | ||
var messages = config.formatter(res.results) | ||
// default behavior: emit error only if we have errors | ||
var emitter = res.errorCount ? webpack.emitError : webpack.emitWarning | ||
// default behavior: emit error only if we have errors | ||
var emitter = res.errorCount ? webpack.emitError : webpack.emitWarning | ||
// force emitError or emitWarning if user want this | ||
if (config.emitError) { | ||
emitter = webpack.emitError | ||
} | ||
else if (config.emitWarning) { | ||
emitter = webpack.emitWarning | ||
} | ||
// force emitError or emitWarning if user want this | ||
if (config.emitError) { | ||
emitter = webpack.emitError | ||
} | ||
else if (config.emitWarning) { | ||
emitter = webpack.emitWarning | ||
} | ||
if (emitter) { | ||
emitter(messages) | ||
if (config.failOnError && res.errorCount) { | ||
throw new Error("Module failed because of a eslint error.") | ||
if (emitter) { | ||
emitter(messages) | ||
if (config.failOnError && res.errorCount) { | ||
throw new Error("Module failed because of a eslint error.") | ||
} | ||
else if (config.failOnWarning && res.warningCount) { | ||
throw new Error("Module failed because of a eslint warning.") | ||
} | ||
} | ||
else if (config.failOnWarning && res.warningCount) { | ||
throw new Error("Module failed because of a eslint warning.") | ||
else { | ||
throw new Error("Your module system doesn't support emitWarning. Update available? \n" + messages) | ||
} | ||
} | ||
else { | ||
throw new Error("Your module system doesn't support emitWarning. Update available? \n" + messages) | ||
} | ||
} | ||
@@ -72,0 +81,0 @@ |
{ | ||
"name": "eslint-loader", | ||
"version": "0.12.0", | ||
"version": "0.13.0", | ||
"description": "eslint loader (for webpack)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11690
108