eslint-loader
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -0,1 +1,6 @@ | ||
# 0.6.0 - 2015-02-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 worring to see lot of lines with `<text>` as filename :) | ||
# 0.5.0 - 2015-02-11 | ||
@@ -2,0 +7,0 @@ |
"use strict"; | ||
var eslint = require("eslint") | ||
var stylish = require("eslint/lib/formatters/stylish") | ||
@@ -33,4 +32,5 @@ // eslint empty filename | ||
if (res.errorCount || res.warningCount) { | ||
var reporter = webpack.options.eslint.reporter || function(results) { | ||
return stylish(results).split("\n").filter(function(line) { | ||
var messages = webpack.options.eslint.reporter(res.results) | ||
if (messages.indexOf(TEXT) > -1) { | ||
messages = messages.split("\n").filter(function(line) { | ||
// drop the line that should contains filepath we do not have | ||
@@ -40,3 +40,2 @@ return !line.match(TEXT) | ||
} | ||
var messages = reporter(res.results) | ||
@@ -71,2 +70,3 @@ // default behavior: emit error only if we have errors | ||
this.options.eslint = this.options.eslint || {} | ||
this.options.eslint.reporter = this.options.eslint.reporter || require("eslint/lib/formatters/stylish") | ||
this.cacheable() | ||
@@ -73,0 +73,0 @@ |
{ | ||
"name": "eslint-loader", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "eslint loader (for webpack)", | ||
@@ -34,2 +34,3 @@ "keywords": [ | ||
"eslint": "^0.16.0", | ||
"eslint-friendly-formatter": "^1.0.3", | ||
"tape": "^3.0.3", | ||
@@ -36,0 +37,0 @@ "webpack": "^1.4.13" |
@@ -39,7 +39,38 @@ # eslint-loader [![Build Status](http://img.shields.io/travis/MoOx/eslint-loader.svg)](https://travis-ci.org/MoOx/eslint-loader) | ||
#### `reporter` (default: wrapper eslint stylish reporter) | ||
#### `reporter` (default: eslint stylish reporter) | ||
Loader accepts a function that will have one argument: an array of eslint messages (object). | ||
The function must return the output as a string. | ||
You can use official eslint reporters. | ||
**Please note that every lines with the filename will be skipped from output** | ||
because of the way the loader use eslint (just with a string of text, not a file - so no filename available) | ||
```js | ||
module.exports = { | ||
entry: "...", | ||
module: { | ||
// ... | ||
} | ||
eslint: { | ||
// several examples ! | ||
// default value | ||
reporter: require("eslint/lib/formatters/stylish"), | ||
// community reporter | ||
reporter: require("eslint-friendly-formatter") | ||
// custom reporter | ||
reporter: function(results) { | ||
// `results` format is available here | ||
// http://eslint.org/docs/developer-guide/nodejs-api.html#executeonfiles() | ||
// you should return a string | ||
// DO NOT USE console.*() directly ! | ||
return "OUTPUT" | ||
} | ||
} | ||
} | ||
``` | ||
#### Errors and Warning | ||
@@ -46,0 +77,0 @@ |
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
7727
120
4