@nuxtjs/eslint-module
Advanced tools
Comparing version
@@ -5,2 +5,11 @@ # Changelog | ||
### [0.2.1](https://github.com/nuxt-community/eslint-module/compare/v0.2.0...v0.2.1) (2019-07-01) | ||
### Bug Fixes | ||
* add `eslint` in `peerDependencies` ([a17990d](https://github.com/nuxt-community/eslint-module/commit/a17990d)) | ||
## [0.2.0](https://github.com/nuxt-community/eslint-module/compare/v0.1.0...v0.2.0) (2019-06-27) | ||
@@ -7,0 +16,0 @@ |
{ | ||
"name": "@nuxtjs/eslint-module", | ||
"version": "0.2.0", | ||
"description": "ESLint will run on saving", | ||
"version": "0.2.1", | ||
"description": "ESLint module for Nuxt.js", | ||
"license": "MIT", | ||
@@ -51,3 +51,6 @@ "contributors": [ | ||
"standard-version": "latest" | ||
}, | ||
"peerDependencies": { | ||
"eslint": ">=1.6.0 <7.0.0" | ||
} | ||
} |
@@ -10,11 +10,23 @@ # ESLint Module | ||
> ESLint will run on saving | ||
> [ESLint](https://eslint.org) module for [Nuxt.js](https://nuxtjs.org) | ||
[📖 **Release Notes**](./CHANGELOG.md) | ||
## Requirements | ||
You need to ensure that you have `eslint` installed | ||
```bash | ||
yarn add --dev eslint # or npm install --save-dev eslint | ||
``` | ||
## Setup | ||
1. Add the `@nuxtjs/eslint-module` dependency with `yarn` or `npm` to your project | ||
1. Add `@nuxtjs/eslint-module` dependency to your project | ||
```bash | ||
yarn add --dev @nuxtjs/eslint-module # or npm install --save-dev @nuxtjs/eslint-module | ||
``` | ||
2. Add `@nuxtjs/eslint-module` to the `devModules` section of `nuxt.config.js` | ||
3. Configure it: | ||
@@ -24,3 +36,7 @@ ```js | ||
devModules: [ | ||
'@nuxtjs/eslint-module' | ||
// Simple usage | ||
'@nuxtjs/eslint-module', | ||
// With options | ||
['@nuxtjs/eslint-module', { /* module options */ }] | ||
] | ||
@@ -30,12 +46,29 @@ } | ||
### Using top level options | ||
```js | ||
{ | ||
devModules: [ | ||
'@nuxtjs/eslint-module' | ||
], | ||
eslint: { | ||
/* module options */ | ||
} | ||
} | ||
``` | ||
## Options | ||
### `fix` | ||
### `cache` | ||
- Default: `false` | ||
This option will enable [ESLint autofix feature](http://eslint.org/docs/user-guide/command-line-interface#fix). | ||
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. | ||
**Be careful: this option will change source files.** | ||
This can either be a `boolean` value or the cache directory path(ex: `'./.eslint-loader-cache'`). | ||
If `cache: true` is used, the cache file is written to the `./node_modules/.cache` directory. | ||
This is the recommended usage. | ||
### `emitError` | ||
@@ -53,7 +86,14 @@ | ||
### `quiet` | ||
### `eslintPath` | ||
- 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`. | ||
### `failOnError` | ||
- Default: `false` | ||
Loader will process and report errors only and ignore warnings if this option is set to true | ||
Loader will cause the module build to fail if there are any eslint errors. | ||
@@ -66,8 +106,33 @@ ### `failOnWarning` | ||
#### `failOnError` | ||
#### `fix` | ||
- Default: `false` | ||
Loader will cause the module build to fail if there are any eslint errors. | ||
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.** | ||
### `formatter` | ||
- Default: `eslint stylish formatter` | ||
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 formatters. | ||
### `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. | ||
### `quiet` | ||
- Default: `false` | ||
Loader will process and report errors only and ignore warnings if this option is set to true. | ||
> See all options in [eslint-loader](https://github.com/webpack-contrib/eslint-loader#options). | ||
@@ -74,0 +139,0 @@ |
9773
25.46%165
65%3
50%