eslint-loader
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -0,1 +1,6 @@ | ||
# 1.6.0 - 2016-10-17 | ||
- Added: Option to generate report file | ||
([#118](https://github.com/MoOx/eslint-loader/pull/118) - @vidhill) | ||
# 1.5.0 - 2016-07-28 | ||
@@ -2,0 +7,0 @@ |
12
index.js
@@ -87,2 +87,14 @@ var eslint = require("eslint") | ||
if (config.outputReport) { | ||
var reportOutput | ||
// if a different formatter is passed in as an option use that | ||
if (config.outputReport.formatter) { | ||
reportOutput = config.outputReport.formatter(res.results) | ||
} | ||
else { | ||
reportOutput = messages | ||
} | ||
webpack.emitFile(config.outputReport.filePath, reportOutput) | ||
} | ||
// default behavior: emit error only if we have errors | ||
@@ -89,0 +101,0 @@ var emitter = res.errorCount ? webpack.emitError : webpack.emitWarning |
{ | ||
"name": "eslint-loader", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "eslint loader (for webpack)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -8,3 +8,3 @@ # eslint-loader [![Build Status](http://img.shields.io/travis/MoOx/eslint-loader.svg)](https://travis-ci.org/MoOx/eslint-loader) | ||
```console | ||
$ npm install eslint-loader | ||
$ npm install eslint-loader --save-dev | ||
``` | ||
@@ -16,3 +16,3 @@ | ||
```javascript | ||
```js | ||
module.exports = { | ||
@@ -32,3 +32,3 @@ // ... | ||
```javascript | ||
```js | ||
module.exports = { | ||
@@ -60,2 +60,18 @@ // ... | ||
[webpack@2.1.0-beta.23 has breaking changes](https://github.com/webpack/webpack/releases). | ||
`preLoaders` is removed from the webpack^2.1.0-beta.23. so move it to `loaders` and using [enforce: "pre"] instead. | ||
```js | ||
module.exports = { | ||
// ... | ||
module: { | ||
loaders: [ | ||
{enforce: "pre", test: /\.js$/, loader: "eslint-loader", exclude: /node_modules/} | ||
// ... other loader | ||
] | ||
} | ||
// ... | ||
} | ||
``` | ||
### Options | ||
@@ -104,5 +120,5 @@ | ||
This option will enable caching of the linting results into a file. | ||
This is particullarly usefull to reduce linting time when doing full build. | ||
This is particularly useful in reducing linting time when doing a full build. | ||
The cache is writting inside the `./node_modules/.cache` directory, thanks to the usage | ||
The cache file is written to the `./node_modules/.cache` directory, thanks to the usage | ||
of the [find-cache-dir](https://www.npmjs.com/package/find-cache-dir) module. | ||
@@ -218,2 +234,24 @@ | ||
##### `outputReport` (default: `false`) | ||
Write the output of the errors to a file, for example a checkstyle xml file for use for reporting on Jenkins CI | ||
The `filePath` is relative to the webpack config: output.path | ||
You can pass in a different formatter for the output file, if none is passed in the default/configured formatter will be used | ||
```js | ||
module.exports = { | ||
entry: "...", | ||
module: { | ||
// ... | ||
}, | ||
eslint: { | ||
outputReport: { | ||
filePath: 'checkstyle.xml', | ||
formatter: require('eslint/lib/formatters/checkstyle') | ||
} | ||
} | ||
} | ||
``` | ||
## Gotchas | ||
@@ -220,0 +258,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
16022
162
264