Skip to content

Commit

Permalink
Merge branch 'master' into fix-emit-warning-error-quiet
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelangeliu authored Jan 22, 2021
2 parents 45ede2e + f819203 commit 69858fb
Show file tree
Hide file tree
Showing 24 changed files with 4,887 additions and 5,364 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@

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.

### [2.4.3](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.4.2...v2.4.3) (2021-01-19)


### Bug Fixes

* crash on `split` ([#62](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/62)) ([db38f61](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/db38f611965cfdec83984364e0b982bbd7a678e0))

### [2.4.2](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.4.1...v2.4.2) (2021-01-19)


### Bug Fixes

* strip resource query ([#58](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/58)) ([f0a2d81](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/f0a2d81a4feecf87e13649f2930f773c04fa3814))

### [2.4.1](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.4.0...v2.4.1) (2020-11-30)


### Bug Fixes

* [#43](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/43), [#44](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/44), [#45](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/45) ([#47](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/47)) ([4b8d4de](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/4b8d4def970381126f70c8407eb708c1c975bbf5))
* recompile speedups ([#55](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/55)) ([d862d92](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/d862d9291853c6b7430a0dbdc965b16db0723925))

## [2.4.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.3.0...v2.4.0) (2020-11-20)


### Features

* threads ([#39](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/39)) ([1e38fc7](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/1e38fc77fd575d9e56be0da6a206ded54a8f7c34))

## [2.3.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.2.1...v2.3.0) (2020-11-13)


Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ Accepts a function that will have one argument: an array of eslint messages (obj

Lint only changed files, skip lint on start.

#### `threads`

- Type: `Boolean | Number`
- Default: `false`

Will run lint tasks across a thread pool. The pool size is automatic unless you specify a number.

### Errors and Warning

**By default the plugin will auto adjust error reporting depending on eslint errors/warnings counts.**
Expand Down
55 changes: 33 additions & 22 deletions declarations/getESLint.d.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
/** @typedef {import('eslint').ESLint} ESLint */
/** @typedef {import('eslint').ESLint.LintResult} LintResult */
/** @typedef {import('./options').Options} Options */
/** @typedef {() => Promise<void>} AsyncTask */
/** @typedef {(files: string|string[]) => Promise<LintResult[]>} LintTask */
/** @typedef {JestWorker & {lintFiles: LintTask}} Worker */
/** @typedef {{threads: number, ESLint: ESLint, eslint: ESLint, lintFiles: LintTask, cleanup: AsyncTask}} Linter */
/**
* @param {Options} options
* @returns {{ESLint: ESLint, eslint: ESLint}}
* @returns {Linter}
*/
export default function getESLint(
options: Options
): {
ESLint: import('eslint').ESLint;
eslint: import('eslint').ESLint;
};
export function loadESLint(options: Options): Linter;
/**
* @param {number} poolSize
* @param {Options} options
* @returns {Linter}
*/
export function loadESLintThreaded(poolSize: number, options: Options): Linter;
/**
* @param {Options} options
* @returns {Linter}
*/
export default function getESLint({ threads, ...options }: Options): Linter;
export type ESLint = import('eslint').ESLint;
export type Options = {
context?: string | undefined;
emitError?: boolean | undefined;
emitWarning?: boolean | undefined;
eslintPath?: string | undefined;
exclude?: string | string[] | undefined;
extensions?: string | string[] | undefined;
failOnError?: boolean | undefined;
failOnWarning?: boolean | undefined;
files?: string | string[] | undefined;
fix?: boolean | undefined;
formatter?: string | import('./options').FormatterFunction | undefined;
lintDirtyModulesOnly?: boolean | undefined;
quiet?: boolean | undefined;
outputReport?: import('./options').OutputReport | undefined;
export type LintResult = import('eslint').ESLint.LintResult;
export type Options = import('./options').PluginOptions &
import('eslint').ESLint.Options;
export type AsyncTask = () => Promise<void>;
export type LintTask = (files: string | string[]) => Promise<LintResult[]>;
export type Worker = JestWorker & {
lintFiles: LintTask;
};
export type Linter = {
threads: number;
ESLint: ESLint;
eslint: ESLint;
lintFiles: LintTask;
cleanup: AsyncTask;
};
import JestWorker from 'jest-worker';
20 changes: 3 additions & 17 deletions declarations/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export class ESLintWebpackPlugin {
* @param {Options} options
*/
constructor(options?: Options);
options: import('./options').Options;
options: import('./options').PluginOptions;
/**
* @param {Compiler} compiler
*/
Expand All @@ -22,19 +22,5 @@ export class ESLintWebpackPlugin {
}
export default ESLintWebpackPlugin;
export type Compiler = import('webpack').Compiler;
export type Options = {
context?: string | undefined;
emitError?: boolean | undefined;
emitWarning?: boolean | undefined;
eslintPath?: string | undefined;
exclude?: string | string[] | undefined;
extensions?: string | string[] | undefined;
failOnError?: boolean | undefined;
failOnWarning?: boolean | undefined;
files?: string | string[] | undefined;
fix?: boolean | undefined;
formatter?: string | import('./options').FormatterFunction | undefined;
lintDirtyModulesOnly?: boolean | undefined;
quiet?: boolean | undefined;
outputReport?: import('./options').OutputReport | undefined;
};
export type Options = import('./options').PluginOptions &
import('eslint').ESLint.Options;
37 changes: 8 additions & 29 deletions declarations/linter.d.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
/** @typedef {import('eslint').ESLint} ESLint */
/** @typedef {import('eslint').ESLint.Formatter} Formatter */
/** @typedef {import('eslint').ESLint.LintResult} LintResult */
/** @typedef {import('webpack').Compiler} Compiler */
/** @typedef {import('webpack').Compilation} Compilation */
/** @typedef {import('webpack-sources').Source} Source */
/** @typedef {import('./options').Options} Options */
/** @typedef {import('./options').FormatterFunction} FormatterFunction */
/** @typedef {(compilation: Compilation) => Promise<void>} GenerateReport */
/** @typedef {{errors?: ESLintError, warnings?: ESLintError, generateReportAsset?: GenerateReport}} Report */
/** @typedef {() => Promise<Report>} Reporter */
/** @typedef {(files: string|string[]) => void} Linter */
/**
* @param {Options} options
* @param {Compilation} compilation
* @returns {{lint: Linter, report: Reporter}}
*/
export default function linter(
options: Options
options: Options,
compilation: Compilation
): {
lint: Linter;
report: Reporter;
Expand All @@ -26,22 +16,8 @@ export type LintResult = import('eslint').ESLint.LintResult;
export type Compiler = import('webpack').Compiler;
export type Compilation = import('webpack').Compilation;
export type Source = import('webpack-sources/lib/Source');
export type Options = {
context?: string | undefined;
emitError?: boolean | undefined;
emitWarning?: boolean | undefined;
eslintPath?: string | undefined;
exclude?: string | string[] | undefined;
extensions?: string | string[] | undefined;
failOnError?: boolean | undefined;
failOnWarning?: boolean | undefined;
files?: string | string[] | undefined;
fix?: boolean | undefined;
formatter?: string | import('./options').FormatterFunction | undefined;
lintDirtyModulesOnly?: boolean | undefined;
quiet?: boolean | undefined;
outputReport?: import('./options').OutputReport | undefined;
};
export type Options = import('./options').PluginOptions &
import('eslint').ESLint.Options;
export type FormatterFunction = (
results: import('eslint').ESLint.LintResult[],
data?: import('eslint').ESLint.LintResultData | undefined
Expand All @@ -56,4 +32,7 @@ export type Report = {
};
export type Reporter = () => Promise<Report>;
export type Linter = (files: string | string[]) => void;
export type LintResultMap = {
[files: string]: import('eslint').ESLint.LintResult;
};
import ESLintError from './ESLintError';
12 changes: 8 additions & 4 deletions declarations/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @property {string|FormatterFunction=} formatter
*/
/**
* @typedef {Object} Options
* @typedef {Object} PluginOptions
* @property {string=} context
* @property {boolean=} emitError
* @property {boolean=} emitWarning
Expand All @@ -28,12 +28,14 @@
* @property {boolean=} lintDirtyModulesOnly
* @property {boolean=} quiet
* @property {OutputReport=} outputReport
* @property {number|boolean=} threads
*/
/** @typedef {PluginOptions & ESLintOptions} Options */
/**
* @param {Options} pluginOptions
* @returns {Options}
* @returns {PluginOptions}
*/
export function getOptions(pluginOptions: Options): Options;
export function getOptions(pluginOptions: Options): PluginOptions;
/**
* @param {Options} loaderOptions
* @returns {ESLintOptions}
Expand All @@ -50,7 +52,7 @@ export type OutputReport = {
filePath?: string | undefined;
formatter?: (string | FormatterFunction) | undefined;
};
export type Options = {
export type PluginOptions = {
context?: string | undefined;
emitError?: boolean | undefined;
emitWarning?: boolean | undefined;
Expand All @@ -65,4 +67,6 @@ export type Options = {
lintDirtyModulesOnly?: boolean | undefined;
quiet?: boolean | undefined;
outputReport?: OutputReport | undefined;
threads?: (number | boolean) | undefined;
};
export type Options = PluginOptions & import('eslint').ESLint.Options;
1 change: 1 addition & 0 deletions declarations/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ export function parseFoldersToGlobs(
patterns: string | string[],
extensions?: string | string[]
): string[];
export function jsonStringifyReplacerSortKeys(_: string, value: any): any;
12 changes: 12 additions & 0 deletions declarations/worker.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export type setupOptions = {
/**
* - import path of eslint
*/
eslintPath?: string | undefined;
/**
* - linter options
*/
eslintOptions?: ESLintOptions | undefined;
};
export type ESLint = import('eslint').ESLint;
export type ESLintOptions = import('eslint').ESLint.Options;
Loading

0 comments on commit 69858fb

Please sign in to comment.