From 86ffa58e94a58aa9c3be9593c7a85adeb237f6e1 Mon Sep 17 00:00:00 2001 From: Peter Belbin Date: Wed, 23 Oct 2019 16:59:48 -0500 Subject: [PATCH] Add eslint CLIEngine `resolvePluginsRelativeTo` constructor option (#39335) * Add the resolvePluginsRelativeTo option The documentation at https://eslint.org/docs/developer-guide/nodejs-api#cliengine shows this option * Add for later versions of TypeScript, and tests --- types/eslint/eslint-tests.ts | 1 + types/eslint/index.d.ts | 1 + types/eslint/ts3.1/eslint-tests.ts | 1 + types/eslint/ts3.1/index.d.ts | 1 + 4 files changed, 4 insertions(+) diff --git a/types/eslint/eslint-tests.ts b/types/eslint/eslint-tests.ts index fa444d84c7..769872ac4b 100644 --- a/types/eslint/eslint-tests.ts +++ b/types/eslint/eslint-tests.ts @@ -492,6 +492,7 @@ cli = new CLIEngine({ ignorePattern: ['foo', 'bar'] }); cli = new CLIEngine({ useEslintrc: false }); cli = new CLIEngine({ parserOptions: {} }); cli = new CLIEngine({ plugins: ['foo'] }); +cli = new CLIEngine({ resolvePluginsRelativeTo: 'test' }); cli = new CLIEngine({ rules: { 'test/example-rule': 1 } }); cli = new CLIEngine({ rulePaths: ['foo'] }); cli = new CLIEngine({ reportUnusedDisableDirectives: true }); diff --git a/types/eslint/index.d.ts b/types/eslint/index.d.ts index 7e547b3ae0..de026de3ef 100644 --- a/types/eslint/index.d.ts +++ b/types/eslint/index.d.ts @@ -519,6 +519,7 @@ export namespace CLIEngine { parser?: string; parserOptions?: Linter.ParserOptions; plugins?: string[]; + resolvePluginsRelativeTo?: string; rules?: { [name: string]: Linter.RuleLevel | Linter.RuleLevelAndOptions; }; diff --git a/types/eslint/ts3.1/eslint-tests.ts b/types/eslint/ts3.1/eslint-tests.ts index fa444d84c7..4489722049 100644 --- a/types/eslint/ts3.1/eslint-tests.ts +++ b/types/eslint/ts3.1/eslint-tests.ts @@ -491,6 +491,7 @@ cli = new CLIEngine({ ignorePattern: 'foo' }); cli = new CLIEngine({ ignorePattern: ['foo', 'bar'] }); cli = new CLIEngine({ useEslintrc: false }); cli = new CLIEngine({ parserOptions: {} }); +cli = new CLIEngine({ resolvePluginsRelativeTo: 'test' }); cli = new CLIEngine({ plugins: ['foo'] }); cli = new CLIEngine({ rules: { 'test/example-rule': 1 } }); cli = new CLIEngine({ rulePaths: ['foo'] }); diff --git a/types/eslint/ts3.1/index.d.ts b/types/eslint/ts3.1/index.d.ts index a8db6d6cf0..189cffb9ee 100644 --- a/types/eslint/ts3.1/index.d.ts +++ b/types/eslint/ts3.1/index.d.ts @@ -515,6 +515,7 @@ export namespace CLIEngine { parser?: string; parserOptions?: Linter.ParserOptions; plugins?: string[]; + resolvePluginsRelativeTo?: string; rules?: { [name: string]: Linter.RuleLevel | Linter.RuleLevelAndOptions; };