11/** @typedef {import('eslint').ESLint } ESLint */
2+ /** @typedef {import('eslint').ESLint.LintResult } LintResult */
23/** @typedef {import('./options').Options } Options */
4+ /** @typedef {() => Promise<void> } AsyncTask */
5+ /** @typedef {(files: string|string[]) => Promise<LintResult[]> } LintTask */
6+ /** @typedef {JestWorker & {lintFiles: LintTask} } Worker */
7+ /** @typedef {{threads: number, ESLint: ESLint, eslint: ESLint, lintFiles: LintTask, cleanup: AsyncTask} } Linter */
38/**
49 * @param {Options } options
5- * @returns {{ESLint: ESLint, eslint: ESLint} }
10+ * @returns {Linter }
611 */
7- export default function getESLint (
8- options : Options
9- ) : {
10- ESLint : import ( 'eslint' ) . ESLint ;
11- eslint : import ( 'eslint' ) . ESLint ;
12- } ;
12+ export function loadESLint ( options : Options ) : Linter ;
13+ /**
14+ * @param {number } poolSize
15+ * @param {Options } options
16+ * @returns {Linter }
17+ */
18+ export function loadESLintThreaded ( poolSize : number , options : Options ) : Linter ;
19+ /**
20+ * @param {Options } options
21+ * @returns {Linter }
22+ */
23+ export default function getESLint ( { threads, ...options } : Options ) : Linter ;
1324export type ESLint = import ( 'eslint' ) . ESLint ;
25+ export type LintResult = import ( 'eslint' ) . ESLint . LintResult ;
1426export type Options = {
1527 context ?: string | undefined ;
1628 emitError ?: boolean | undefined ;
@@ -26,4 +38,18 @@ export type Options = {
2638 lintDirtyModulesOnly ?: boolean | undefined ;
2739 quiet ?: boolean | undefined ;
2840 outputReport ?: import ( './options' ) . OutputReport | undefined ;
41+ threads ?: number | boolean | undefined ;
42+ } ;
43+ export type AsyncTask = ( ) => Promise < void > ;
44+ export type LintTask = ( files : string | string [ ] ) => Promise < LintResult [ ] > ;
45+ export type Worker = JestWorker & {
46+ lintFiles : LintTask ;
47+ } ;
48+ export type Linter = {
49+ threads : number ;
50+ ESLint : ESLint ;
51+ eslint : ESLint ;
52+ lintFiles : LintTask ;
53+ cleanup : AsyncTask ;
2954} ;
55+ import JestWorker from 'jest-worker' ;
0 commit comments