Skip to content
This repository was archived by the owner on Sep 28, 2020. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: webpack-contrib/eslint-loader
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.0
Choose a base ref
...
head repository: webpack-contrib/eslint-loader
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.1
Choose a head ref
  • 5 commits
  • 30 files changed
  • 3 contributors

Commits on Sep 24, 2019

  1. Copy the full SHA
    360e69c View commit details

Commits on Sep 25, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0821e14 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c6b7c12 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    311399a View commit details
  4. Copy the full SHA
    f9b4628 View commit details
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [3.0.1](https://github.com/webpack-contrib/eslint-loader/compare/v3.0.0...v3.0.1) (2019-09-25)


### Bug Fixes

* module build failed error at Linter.parseResults ([#294](https://github.com/webpack-contrib/eslint-loader/issues/294)) ([360e69c](https://github.com/webpack-contrib/eslint-loader/commit/360e69c))

### [3.0.0](https://github.com/webpack-contrib/eslint-loader/compare/v2.2.1...v3.0.0) (2019-08-24)


147 changes: 115 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ module.exports = {
};
```

### Options
## Options

You can pass [eslint options](http://eslint.org/docs/developer-guide/nodejs-api#cliengine)
using standard webpack [loader options](https://webpack.js.org/configuration/module/#useentry).
@@ -103,14 +103,10 @@ Note that the config option you provide will be passed to the `CLIEngine`.
This is a different set of options than what you'd specify in `package.json` or `.eslintrc`.
See the [eslint docs](http://eslint.org/docs/developer-guide/nodejs-api#cliengine) for more detail.

#### `fix` (default: false)
### `cache`

This option will enable
[ESLint autofix feature](http://eslint.org/docs/user-guide/command-line-interface#fix).

**Be careful: this option will change source files.**

#### `cache` (default: false)
- Type: `Boolean|String`
- Default: `false`

This option will enable caching of the linting results into a file.
This is particularly useful in reducing linting time when doing a full build.
@@ -120,9 +116,57 @@ This can either be a `boolean` value or the cache directory path(ex: `'./.eslint
If `cache: true` is used, the cache file is written to the `./node_modules/.cache` directory.
This is the recommended usage.

#### `formatter` (default: 'stylish')
```js
module.exports = {
entry: '...',
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
cache: true,
},
},
],
},
};
```

### `eslintPath`

- Type: `String`
- Default: `eslint`

Path to `eslint` instance that will be used for linting.
If the `eslintPath` is a folder like a official eslint, or specify a `formatter` option.
now you dont have to install `eslint`.

Loader accepts a function that will have one argument: an array of eslint messages (object).
```js
module.exports = {
entry: '...',
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
eslintPath: path.join(__dirname, 'reusable-eslint'),
},
},
],
},
};
```

### `formatter`

- Type: `String|Function`
- Default: `stylish`

This option 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 formatters](https://eslint.org/docs/user-guide/formatters/).

@@ -160,11 +204,15 @@ module.exports = {
};
```

#### `eslintPath` (default: 'eslint')
### `fix`

Path to `eslint` instance that will be used for linting.
If the `eslintPath` is a folder like a official eslint, or specify a `formatter` option.
now you dont have to install `eslint`.
- Type: `Boolean`
- Default: `false`

This option will enable
[ESLint autofix feature](http://eslint.org/docs/user-guide/command-line-interface#fix).

**Be careful: this option will change source files.**

```js
module.exports = {
@@ -176,23 +224,26 @@ module.exports = {
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
eslintPath: path.join(__dirname, 'reusable-eslint'),
fix: true,
},
},
],
},
};
```

#### Errors and Warning
### Errors and Warning

**By default the loader will auto adjust error reporting depending
on eslint errors/warnings counts.**
You can still force this behavior by using `emitError` **or** `emitWarning` options:

##### `emitError` (default: `false`)
#### `emitError`

Loader will always return errors if this option is set to `true`.
- Type: `Boolean`
- Default: `false`

Will always return errors, if this option is set to `true`.

```js
module.exports = {
@@ -212,14 +263,37 @@ module.exports = {
};
```

##### `emitWarning` (default: `false`)
#### `emitWarning`

Loader will always return warnings if option is set to `true`. If you're using hot module replacement,
you may wish to enable this in development, or else updates will be skipped when there's an eslint error.
- Type: `Boolean`
- Default: `false`

##### `quiet` (default: `false`)
Will always return warnings, if option is set to `true`. **If you're using hot module replacement, you may wish to enable this in development, or else updates will be skipped when there's an eslint error.**

Loader will process and report errors only and ignore warnings if this option is set to true
```js
module.exports = {
entry: '...',
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
emitWarning: true,
},
},
],
},
};
```

#### `failOnError`

- Type: `Boolean`
- Default: `false`

Will cause the module build to fail if there are any errors, if option is set to `true`.

```js
module.exports = {
@@ -231,17 +305,20 @@ module.exports = {
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
quiet: true,
failOnError: true,
},
},
],
},
};
```

##### `failOnWarning` (default: `false`)
#### `failOnWarning`

Loader will cause the module build to fail if there are any eslint warnings.
- Type: `Boolean`
- Default: `false`

Will cause the module build to fail if there are any warnings, if option is set to `true`.

```js
module.exports = {
@@ -261,9 +338,12 @@ module.exports = {
};
```

##### `failOnError` (default: `false`)
#### `quiet`

- Type: `Boolean`
- Default: `false`

Loader will cause the module build to fail if there are any eslint errors.
Will process and report errors only and ignore warnings, if this option is set to `true`.

```js
module.exports = {
@@ -275,20 +355,23 @@ module.exports = {
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
failOnError: true,
quiet: true,
},
},
],
},
};
```

##### `outputReport` (default: `null`)
#### `outputReport`

- Type: `Boolean|Object`
- 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 an absolute path or relative to the webpack config: output.path
You can pass in a different formatter for the output file,
The `filePath` is an absolute path or 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
Loading