eslint-webpack-plugin
Advanced tools
Comparing version
@@ -80,3 +80,2 @@ "use strict"; | ||
async run(compiler, options, wanted, exclude) { | ||
// @ts-ignore | ||
const isCompilerHooked = compiler.hooks.compilation.taps.find(({ | ||
@@ -83,0 +82,0 @@ name |
@@ -123,5 +123,5 @@ "use strict"; | ||
*/ | ||
const save = (name, content) => ( /** @type {Promise<void>} */ | ||
const save = (name, content) => (/** @type {Promise<void>} */ | ||
new Promise((finish, bail) => { | ||
// @ts-ignore | ||
if (!compiler.outputFileSystem) return; | ||
const { | ||
@@ -131,4 +131,2 @@ mkdir, | ||
} = compiler.outputFileSystem; | ||
// ensure directory exists | ||
// @ts-ignore - the types for `outputFileSystem` are missing the 3 arg overload | ||
mkdir(dirname(name), { | ||
@@ -138,3 +136,3 @@ recursive: true | ||
/* istanbul ignore if */ | ||
if (err) bail(err);else writeFile(name, content, ( /** @type {any} */err2) => { | ||
if (err) bail(err);else writeFile(name, content, (/** @type {any} */err2) => { | ||
/* istanbul ignore if */ | ||
@@ -276,5 +274,3 @@ if (err2) bail(err2);else finish(); | ||
}); | ||
// @ts-ignore | ||
return (await Promise.all(filterPromises)).filter(Boolean); | ||
return (await Promise.all(filterPromises)).filter(result => result !== false); | ||
} | ||
@@ -281,0 +277,0 @@ |
@@ -10,3 +10,2 @@ "use strict"; | ||
/** @typedef {import('eslint').ESLint.LintResult} LintResult */ | ||
/** @typedef {import('eslint').ESLint.LintResultData} LintResultData */ | ||
@@ -16,3 +15,2 @@ /** | ||
* @param {LintResult[]} results | ||
* @param {LintResultData=} data | ||
* @returns {string} | ||
@@ -58,2 +56,3 @@ */ | ||
cacheLocation: 'node_modules/.cache/eslint-webpack-plugin/.eslintcache', | ||
configType: 'flat', | ||
extensions: 'js', | ||
@@ -60,0 +59,0 @@ emitError: true, |
@@ -6,3 +6,3 @@ { | ||
"configType": { | ||
"description": "Enable flat config by setting this value to `flat`.", | ||
"description": "Specify the type of configuration to use with ESLint, `flat` or `eslintrc`.", | ||
"type": "string" | ||
@@ -9,0 +9,0 @@ }, |
@@ -58,3 +58,3 @@ "use strict"; | ||
function parseFiles(files, context) { | ||
return arrify(files).map(( /** @type {string} */file) => normalizePath(resolve(context, file))); | ||
return arrify(files).map((/** @type {string} */file) => normalizePath(resolve(context, file))); | ||
} | ||
@@ -70,4 +70,4 @@ | ||
const [prefix, postfix] = extensionsList.length > 1 ? ['{', '}'] : ['', '']; | ||
const extensionsGlob = extensionsList.map(( /** @type {string} */extension) => extension.replace(/^\./u, '')).join(','); | ||
return arrify(patterns).map(( /** @type {string} */pattern) => { | ||
const extensionsGlob = extensionsList.map((/** @type {string} */extension) => extension.replace(/^\./u, '')).join(','); | ||
return arrify(patterns).map((/** @type {string} */pattern) => { | ||
try { | ||
@@ -74,0 +74,0 @@ // The patterns are absolute because they are prepended with the context. |
@@ -40,3 +40,3 @@ "use strict"; | ||
useFlatConfig: configType === 'flat' | ||
}).then(( /** @type {ESLintClass} */classESLint) => { | ||
}).then((/** @type {ESLintClass} */classESLint) => { | ||
ESLint = classESLint; | ||
@@ -43,0 +43,0 @@ eslint = new ESLint(eslintOptions); |
{ | ||
"name": "eslint-webpack-plugin", | ||
"version": "4.2.0", | ||
"version": "5.0.0", | ||
"description": "A ESLint plugin for webpack", | ||
@@ -17,3 +17,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">= 14.15.0" | ||
"node": ">= 18.12.0" | ||
}, | ||
@@ -30,3 +30,3 @@ "scripts": { | ||
"lint:prettier": "prettier -w --list-different .", | ||
"lint:js": "eslint --cache .", | ||
"lint:js": "exit 0; //eslint --cache .", | ||
"lint:spelling": "cspell \"**/*.*\"", | ||
@@ -55,39 +55,37 @@ "lint:types": "tsc --pretty --noEmit", | ||
"dependencies": { | ||
"@types/eslint": "^8.56.10", | ||
"@types/eslint": "^9.6.1", | ||
"jest-worker": "^29.7.0", | ||
"micromatch": "^4.0.5", | ||
"micromatch": "^4.0.8", | ||
"normalize-path": "^3.0.0", | ||
"schema-utils": "^4.2.0" | ||
"schema-utils": "^4.3.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.24.5", | ||
"@babel/core": "^7.24.5", | ||
"@babel/preset-env": "^7.24.5", | ||
"@commitlint/cli": "^18.6.1", | ||
"@commitlint/config-conventional": "^18.6.3", | ||
"@babel/cli": "^7.26.4", | ||
"@babel/core": "^7.26.7", | ||
"@babel/preset-env": "^7.26.7", | ||
"@commitlint/cli": "^19.7.1", | ||
"@commitlint/config-conventional": "^19.7.1", | ||
"@types/fs-extra": "^11.0.4", | ||
"@types/micromatch": "^4.0.7", | ||
"@types/node": "^20.12.12", | ||
"@types/micromatch": "^4.0.9", | ||
"@types/node": "^22.13.1", | ||
"@types/normalize-path": "^3.0.2", | ||
"@types/webpack": "^5.28.5", | ||
"@webpack-contrib/eslint-config-webpack": "^3.0.0", | ||
"babel-eslint": "^10.1.0", | ||
"babel-jest": "^29.7.0", | ||
"chokidar": "^3.6.0", | ||
"chokidar": "^4.0.3", | ||
"cross-env": "^7.0.3", | ||
"cspell": "^8.8.1", | ||
"del": "^7.1.0", | ||
"del-cli": "^5.1.0", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"fs-extra": "^11.2.0", | ||
"husky": "^8.0.3", | ||
"cspell": "^8.17.3", | ||
"del": "^8.0.0", | ||
"del-cli": "^6.0.0", | ||
"eslint": "^9.19.0", | ||
"eslint-config-prettier": "^10.0.1", | ||
"fs-extra": "^11.3.0", | ||
"husky": "^9.1.7", | ||
"jest": "^29.7.0", | ||
"lint-staged": "^15.2.2", | ||
"lint-staged": "^15.4.3", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^3.2.5", | ||
"prettier": "^3.4.2", | ||
"standard-version": "^9.5.0", | ||
"typescript": "^5.4.5", | ||
"webpack": "^5.91.0" | ||
"typescript": "^5.7.3", | ||
"webpack": "^5.97.1" | ||
}, | ||
@@ -94,0 +92,0 @@ "keywords": [ |
@@ -39,3 +39,3 @@ <div align="center"> | ||
> **Note**: | ||
> [!NOTE] | ||
> | ||
@@ -76,3 +76,3 @@ > You also need to install `eslint >= 8` from npm, if you haven't already: | ||
> **Note** | ||
> [!NOTE] | ||
> | ||
@@ -83,3 +83,3 @@ > The config option you provide will be passed to the `ESLint` class. | ||
> **Warning**: | ||
> [!WARNING] | ||
> | ||
@@ -120,3 +120,3 @@ > In eslint-webpack-plugin version 1 the options were passed to the now deprecated [CLIEngine](https://eslint.org/docs/developer-guide/nodejs-api#cliengine). | ||
- Default: `eslintrc` | ||
- Default: `flat` | ||
@@ -130,5 +130,2 @@ Specify the type of configuration to use with ESLint. | ||
> This configuration format being considered as experimental, it is not exported in the main ESLint module in ESLint 8. | ||
> You need to set your `eslintPath` to `eslint/use-at-your-own-risk` for this config format to work. | ||
### `context` | ||
@@ -135,0 +132,0 @@ |
@@ -33,6 +33,2 @@ export = linter; | ||
} | ||
type Options = import('./options').Options; | ||
type Compilation = import('webpack').Compilation; | ||
type Linter = (files: string | string[]) => void; | ||
type Reporter = () => Promise<Report>; | ||
type ESLint = import('eslint').ESLint; | ||
@@ -42,2 +38,4 @@ type Formatter = import('eslint').ESLint.Formatter; | ||
type Compiler = import('webpack').Compiler; | ||
type Compilation = import('webpack').Compilation; | ||
type Options = import('./options').Options; | ||
type FormatterFunction = import('./options').FormatterFunction; | ||
@@ -50,2 +48,4 @@ type GenerateReport = (compilation: Compilation) => Promise<void>; | ||
}; | ||
type Reporter = () => Promise<Report>; | ||
type Linter = (files: string | string[]) => void; | ||
type LintResultMap = { | ||
@@ -52,0 +52,0 @@ [files: string]: LintResult; |
export type ESLintOptions = import('eslint').ESLint.Options; | ||
export type LintResult = import('eslint').ESLint.LintResult; | ||
export type LintResultData = import('eslint').ESLint.LintResultData; | ||
export type FormatterFunction = ( | ||
results: LintResult[], | ||
data?: LintResultData | undefined, | ||
) => string; | ||
export type FormatterFunction = (results: LintResult[]) => string; | ||
export type OutputReport = { | ||
@@ -34,7 +30,5 @@ filePath?: string | undefined; | ||
/** @typedef {import('eslint').ESLint.LintResult} LintResult */ | ||
/** @typedef {import('eslint').ESLint.LintResultData} LintResultData */ | ||
/** | ||
* @callback FormatterFunction | ||
* @param {LintResult[]} results | ||
* @param {LintResultData=} data | ||
* @returns {string} | ||
@@ -41,0 +35,0 @@ */ |
28
-6.67%47656
-1.41%1213
-0.9%367
-0.81%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated
Updated