eslint-webpack-plugin
Advanced tools
Comparing version
@@ -21,2 +21,5 @@ "use strict"; | ||
} = require('./utils'); | ||
const { | ||
stringify | ||
} = require('flatted'); | ||
@@ -124,3 +127,3 @@ /** @type {{[key: string]: any}} */ | ||
function getCacheKey(key, options) { | ||
return JSON.stringify({ | ||
return stringify({ | ||
key, | ||
@@ -127,0 +130,0 @@ options |
@@ -99,3 +99,8 @@ "use strict"; | ||
}; | ||
return value instanceof Object && !(value instanceof Array) ? Object.keys(value).sort().reduce(insert, {}) : value; | ||
if (value instanceof Object && !(value instanceof Array)) { | ||
let sorted = Object.keys(value).sort().reduce(insert, {}); | ||
Object.keys(value).forEach(key => delete value[key]); | ||
Object.assign(value, sorted); | ||
} | ||
return value; | ||
}; | ||
@@ -102,0 +107,0 @@ module.exports = { |
{ | ||
"name": "eslint-webpack-plugin", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "A ESLint plugin for webpack", | ||
@@ -54,2 +54,3 @@ "license": "MIT", | ||
"@types/eslint": "^9.6.1", | ||
"flatted": "^3.3.3", | ||
"jest-worker": "^29.7.0", | ||
@@ -56,0 +57,0 @@ "micromatch": "^4.0.8", |
@@ -15,5 +15,5 @@ <div align="center"> | ||
> This version of eslint-webpack-plugin only works with webpack 5. For the webpack 4, see the [2.x branch](https://github.com/webpack-contrib/eslint-webpack-plugin/tree/2.x). | ||
> This version of eslint-webpack-plugin only supports webpack 5. For the webpack 4, see the [2.x branch](https://github.com/webpack-contrib/eslint-webpack-plugin/tree/2.x). | ||
This plugin uses [`eslint`](https://eslint.org/) to find and fix problems in your JavaScript code | ||
This plugin uses [`ESlint`](https://eslint.org/) to find and fix problems in your JavaScript code during the Webpack build process. | ||
@@ -60,3 +60,3 @@ ## Getting Started | ||
Then add the plugin to your webpack config. For example: | ||
Then add the plugin to your webpack configuration. For example: | ||
@@ -75,3 +75,3 @@ ```js | ||
You can pass [eslint options](https://eslint.org/docs/developer-guide/nodejs-api#-new-eslintoptions). | ||
You can pass [ESLint Node.js API options](https://eslint.org/docs/developer-guide/nodejs-api#-new-eslintoptions). | ||
@@ -82,7 +82,7 @@ > [!NOTE] | ||
> This is a different set of options than what you'd specify in `package.json` or `.eslintrc`. | ||
> See the [eslint docs](https://eslint.org/docs/developer-guide/nodejs-api#-new-eslintoptions) for more details. | ||
> See the [ESlint docs](https://eslint.org/docs/developer-guide/nodejs-api#-new-eslintoptions) for more details. | ||
> [!WARNING] | ||
> | ||
> In eslint-webpack-plugin version 1 the options were passed to the now deprecated [CLIEngine](https://eslint.org/docs/developer-guide/nodejs-api#cliengine). | ||
> In eslint-webpack-plugin version 1 the options were passed to the now-deprecated [CLIEngine](https://eslint.org/docs/developer-guide/nodejs-api#cliengine). | ||
@@ -140,3 +140,3 @@ ### `cache` | ||
A string indicating the root of your files. | ||
Base directory for linting. | ||
@@ -153,4 +153,6 @@ ### `eslintPath` | ||
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 don't have to install `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 don't have to install `eslint`. | ||
### `extensions` | ||
@@ -166,3 +168,3 @@ | ||
Specify extensions that should be checked. | ||
Specify file extensions that should be checked. | ||
@@ -179,3 +181,3 @@ ### `exclude` | ||
Specify the files and/or directories to exclude. Must be relative to `options.context`. | ||
Specify the files/directories to exclude. Must be relative to `options.context`. | ||
@@ -220,3 +222,3 @@ ### `resourceQueryExclude` | ||
**Be careful: this option will change source files.** | ||
**Be careful: this option will modify source files.** | ||
@@ -236,4 +238,6 @@ ### `formatter` | ||
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/). | ||
Accepts a function that receives an array of ESLint messages (object) as its argument and must return a string as output. | ||
You can use official [ESlint formatters](https://eslint.org/docs/user-guide/formatters/). | ||
### `lintDirtyModulesOnly` | ||
@@ -249,3 +253,3 @@ | ||
Lint only changed files, skip lint on start. | ||
Lint only changed files, skipping initial lint on build start. | ||
@@ -267,2 +271,3 @@ ### `threads` | ||
**By default the plugin will auto adjust error reporting depending on eslint errors/warnings counts.** | ||
You can still force this behavior by using `emitError` **or** `emitWarning` options: | ||
@@ -304,3 +309,3 @@ | ||
Will cause the module build to fail if there are any errors, to disable set to `false`. | ||
Will cause the module build to fail if any errors are found, to disable set to `false`. | ||
@@ -317,3 +322,3 @@ #### `failOnWarning` | ||
Will cause the module build to fail if there are any warnings, if set to `true`. | ||
Will cause the module build to fail if any warnings are found, if set to `true`. | ||
@@ -355,7 +360,7 @@ #### `quiet` | ||
Write the output of the errors to a file, for example a checkstyle xml file for use for reporting on Jenkins CI. | ||
Write ESLint results 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, | ||
if none is passed in the default/configured formatter will be used. | ||
- filePath: Path to output report file (relative to output.path or absolute). | ||
- formatter: You can pass in a different `formatter` for the output file. | ||
if none is passed in the default/configured formatter will be used. | ||
@@ -366,2 +371,10 @@ ## Changelog | ||
## Contributing | ||
We welcome all contributions! | ||
If you're new here, please take a moment to review our contributing guidelines. | ||
[CONTRIBUTING](./.github/CONTRIBUTING.md) | ||
## License | ||
@@ -368,0 +381,0 @@ |
48004
0.83%1223
0.66%380
3.54%8
14.29%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed