eslint-webpack-plugin
Advanced tools
Comparing version 2.5.4 to 3.0.0
declare const _exports: typeof plugin.default; | ||
export = _exports; | ||
import plugin = require('.'); | ||
import plugin = require('./'); |
export default ESLintError; | ||
declare class ESLintError extends Error { | ||
/** | ||
* @param {string=} messages | ||
*/ | ||
constructor(messages?: string | undefined); | ||
} | ||
declare class ESLintError extends Error {} |
@@ -35,4 +35,3 @@ /** @typedef {import('eslint').ESLint} ESLint */ | ||
export type LintResult = import('eslint').ESLint.LintResult; | ||
export type Options = import('./options').PluginOptions & | ||
import('eslint').ESLint.Options; | ||
export type Options = import('./options').Options; | ||
export type AsyncTask = () => Promise<void>; | ||
@@ -50,2 +49,2 @@ export type LintTask = (files: string | string[]) => Promise<LintResult[]>; | ||
}; | ||
import JestWorker from 'jest-worker'; | ||
import { Worker as JestWorker } from 'jest-worker'; |
export default ESLintWebpackPlugin; | ||
export type Compiler = import('webpack').Compiler; | ||
export type Options = import('./options').PluginOptions & | ||
import('eslint').ESLint.Options; | ||
export type Options = import('./options').Options; | ||
declare class ESLintWebpackPlugin { | ||
@@ -6,0 +5,0 @@ /** |
@@ -21,14 +21,9 @@ /** | ||
export type Compilation = import('webpack').Compilation; | ||
export type Source = import('webpack-sources/lib/Source'); | ||
export type Options = import('./options').PluginOptions & | ||
import('eslint').ESLint.Options; | ||
export type FormatterFunction = ( | ||
results: import('eslint').ESLint.LintResult[], | ||
data?: import('eslint').ESLint.LintResultData | undefined | ||
) => string; | ||
export type Options = import('./options').Options; | ||
export type FormatterFunction = import('./options').FormatterFunction; | ||
export type GenerateReport = (compilation: Compilation) => Promise<void>; | ||
export type Report = { | ||
errors?: ESLintError | undefined; | ||
warnings?: ESLintError | undefined; | ||
generateReportAsset?: GenerateReport | undefined; | ||
errors?: ESLintError; | ||
warnings?: ESLintError; | ||
generateReportAsset?: GenerateReport; | ||
}; | ||
@@ -35,0 +30,0 @@ export type Reporter = () => Promise<Report>; |
@@ -72,2 +72,2 @@ /** @typedef {import("eslint").ESLint.Options} ESLintOptions */ | ||
}; | ||
export type Options = PluginOptions & import('eslint').ESLint.Options; | ||
export type Options = PluginOptions & ESLintOptions; |
@@ -12,3 +12,3 @@ "use strict"; | ||
var _jestWorker = _interopRequireDefault(require("jest-worker")); | ||
var _jestWorker = require("jest-worker"); | ||
@@ -19,4 +19,2 @@ var _options = require("./options"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @type {{[key: string]: any}} */ | ||
@@ -101,3 +99,3 @@ const cache = {}; | ||
/** @type {Worker} */ | ||
new _jestWorker.default(source, workerOptions); | ||
new _jestWorker.Worker(source, workerOptions); | ||
/** @type {Linter} */ | ||
@@ -107,3 +105,3 @@ | ||
threads: poolSize, | ||
lintFiles: async (files) => worker && (await worker.lintFiles(files)) || | ||
lintFiles: async files => worker && (await worker.lintFiles(files)) || | ||
/* istanbul ignore next */ | ||
@@ -110,0 +108,0 @@ [], |
@@ -22,4 +22,2 @@ "use strict"; | ||
// @ts-ignore | ||
/** @typedef {import('webpack').Compiler} Compiler */ | ||
@@ -54,8 +52,4 @@ | ||
compiler.hooks.run.tapPromise(this.key, this.run); | ||
} // TODO: Figure out want `compiler.watching` is and how to use it in Webpack5. | ||
// From my testing of compiler.watch() ... compiler.watching is always | ||
// undefined (webpack 4 doesn't define it either) I'm leaving it out | ||
// for now. | ||
} | ||
let isFirstRun = this.options.lintDirtyModulesOnly; | ||
@@ -62,0 +56,0 @@ compiler.hooks.watchRun.tapPromise(this.key, c => { |
@@ -26,4 +26,2 @@ "use strict"; | ||
/** @typedef {import('webpack-sources').Source} Source */ | ||
/** @typedef {import('./options').Options} Options */ | ||
@@ -30,0 +28,0 @@ |
@@ -14,10 +14,9 @@ "use strict"; | ||
var _arrify = _interopRequireDefault(require("arrify")); | ||
var _normalizePath = _interopRequireDefault(require("normalize-path")); | ||
var _arrify = _interopRequireDefault(require("arrify")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// @ts-ignore | ||
// @ts-ignore | ||
@@ -30,5 +29,5 @@ /** | ||
function parseFiles(files, context) { | ||
return (0, _arrify.default)(files).map( | ||
return (0, _arrify.default)(files).map(( | ||
/** @type {string} */ | ||
file => (0, _normalizePath.default)((0, _path.resolve)(context, file))); | ||
file) => (0, _normalizePath.default)((0, _path.resolve)(context, file))); | ||
} | ||
@@ -45,8 +44,8 @@ /** | ||
const [prefix, postfix] = extensionsList.length > 1 ? ['{', '}'] : ['', '']; | ||
const extensionsGlob = extensionsList.map( | ||
const extensionsGlob = extensionsList.map(( | ||
/** @type {string} */ | ||
extension => extension.replace(/^\./u, '')).join(','); | ||
return (0, _arrify.default)(patterns).map( | ||
extension) => extension.replace(/^\./u, '')).join(','); | ||
return (0, _arrify.default)(patterns).map(( | ||
/** @type {string} */ | ||
pattern => { | ||
pattern) => { | ||
try { | ||
@@ -67,3 +66,2 @@ // The patterns are absolute because they are prepended with the context. | ||
/** | ||
* | ||
* @param {string} _ key, but unused | ||
@@ -70,0 +68,0 @@ * @param {any} value |
{ | ||
"name": "eslint-webpack-plugin", | ||
"version": "2.5.4", | ||
"version": "3.0.0", | ||
"description": "A ESLint plugin for webpack", | ||
@@ -17,3 +17,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">= 10.13.0" | ||
"node": ">= 12.13.0" | ||
}, | ||
@@ -47,41 +47,41 @@ "scripts": { | ||
"eslint": "^7.0.0", | ||
"webpack": "^4.0.0 || ^5.0.0" | ||
"webpack": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"@types/eslint": "^7.2.6", | ||
"arrify": "^2.0.1", | ||
"jest-worker": "^26.6.2", | ||
"micromatch": "^4.0.2", | ||
"@types/eslint": "^7.2.14", | ||
"arrify": "^3.0.0", | ||
"jest-worker": "^27.0.6", | ||
"micromatch": "^4.0.4", | ||
"normalize-path": "^3.0.0", | ||
"schema-utils": "^3.0.0" | ||
"schema-utils": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.12.10", | ||
"@babel/core": "^7.12.10", | ||
"@babel/preset-env": "^7.12.11", | ||
"@commitlint/cli": "^11.0.0", | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@types/fs-extra": "^9.0.6", | ||
"@types/micromatch": "^4.0.1", | ||
"@babel/cli": "^7.14.5", | ||
"@babel/core": "^7.14.6", | ||
"@babel/preset-env": "^7.14.7", | ||
"@commitlint/cli": "^12.1.4", | ||
"@commitlint/config-conventional": "^12.1.4", | ||
"@types/fs-extra": "^9.0.10", | ||
"@types/micromatch": "^4.0.2", | ||
"@types/normalize-path": "^3.0.0", | ||
"@types/webpack": "^4.41.26", | ||
"@types/webpack": "^5.28.0", | ||
"@webpack-contrib/eslint-config-webpack": "^3.0.0", | ||
"babel-eslint": "^10.1.0", | ||
"babel-jest": "^26.6.3", | ||
"chokidar": "^3.5.1", | ||
"babel-jest": "^27.0.6", | ||
"chokidar": "^3.5.2", | ||
"cross-env": "^7.0.3", | ||
"del": "^6.0.0", | ||
"del-cli": "^3.0.1", | ||
"eslint": "^7.19.0", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"fs-extra": "^9.1.0", | ||
"husky": "^4.3.8", | ||
"jest": "^26.6.3", | ||
"lint-staged": "^10.5.3", | ||
"del-cli": "^4.0.0", | ||
"eslint": "^7.30.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.23.4", | ||
"fs-extra": "^10.0.0", | ||
"husky": "^7.0.1", | ||
"jest": "^27.0.6", | ||
"lint-staged": "^11.0.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.2.1", | ||
"standard-version": "^9.1.0", | ||
"typescript": "^4.1.3", | ||
"webpack": "^5.19.0" | ||
"prettier": "^2.3.2", | ||
"standard-version": "^9.3.0", | ||
"typescript": "^4.3.5", | ||
"webpack": "^5.43.0" | ||
}, | ||
@@ -94,6 +94,3 @@ "keywords": [ | ||
"webpack" | ||
], | ||
"jest": { | ||
"testTimeout": 60000 | ||
} | ||
] | ||
} |
@@ -16,54 +16,8 @@ <div align="center"> | ||
> A ESLint plugin for webpack | ||
This plugin uses [`eslint`](https://eslint.org/) to find and fix problems in your JavaScript code | ||
## About plugin | ||
## Getting Started | ||
The plugin was born with the purpose of solving some problems of the [eslint-loader](https://github.com/webpack-contrib/eslint-loader). | ||
To begin, you'll need to install `eslint-webpack-plugin`: | ||
| | eslint-webpack-plugin | eslint-loader | | ||
| -------------------------------- | :-------------------: | :----------------------: | | ||
| Easy configuration | :heavy_check_mark: | :heavy_multiplication_x: | | ||
| Generate unique an output report | :heavy_check_mark: | :heavy_multiplication_x: | | ||
| Using cache directly from eslint | :heavy_check_mark: | :heavy_multiplication_x: | | ||
| Lint only changed files | :heavy_check_mark: | :heavy_multiplication_x: | | ||
## Migrate from `eslint-loader` | ||
The loader `eslint-loader` will be deprecated soon, please use this plugin instead. | ||
Before: | ||
```js | ||
module.exports = { | ||
// ... | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
loader: 'eslint-loader', | ||
options: { | ||
// eslint options (if necessary) | ||
}, | ||
}, | ||
], | ||
}, | ||
// ... | ||
}; | ||
``` | ||
After: | ||
```js | ||
const ESLintPlugin = require('eslint-webpack-plugin'); | ||
module.exports = { | ||
// ... | ||
plugins: [new ESLintPlugin(options)], | ||
// ... | ||
}; | ||
``` | ||
## Install | ||
```bash | ||
@@ -79,6 +33,4 @@ npm install eslint-webpack-plugin --save-dev | ||
## Usage | ||
Then add the plugin to your webpack config. For example: | ||
In your webpack configuration: | ||
```js | ||
@@ -85,0 +37,0 @@ const ESLintPlugin = require('eslint-webpack-plugin'); |
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
42400
20
1040
194
+ Addedarrify@3.0.0(transitive)
- Removedarrify@2.0.1(transitive)
- Removedjest-worker@26.6.2(transitive)
Updated@types/eslint@^7.2.14
Updatedarrify@^3.0.0
Updatedjest-worker@^27.0.6
Updatedmicromatch@^4.0.4
Updatedschema-utils@^3.1.0