From 79500fede6a8e71de4f08bf0aba812c1cb44d85f Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Wed, 15 Nov 2023 12:05:39 +1030 Subject: [PATCH] fix(utils): add missing fields to flat config types --- .cspell.json | 1 + packages/utils/src/ts-eslint/Config.ts | 24 +++++++++++++++++++++++- packages/utils/src/ts-eslint/Linter.ts | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.cspell.json b/.cspell.json index 811ef9e62dd7..ec11ebf5018d 100644 --- a/.cspell.json +++ b/.cspell.json @@ -119,6 +119,7 @@ "serializers", "Sourcegraph", "stringification", + "stringly", "superset", "thenables", "transpiled", diff --git a/packages/utils/src/ts-eslint/Config.ts b/packages/utils/src/ts-eslint/Config.ts index 6a94d7655412..7db8139d28d3 100644 --- a/packages/utils/src/ts-eslint/Config.ts +++ b/packages/utils/src/ts-eslint/Config.ts @@ -131,14 +131,36 @@ export namespace FlatConfig { export type SeverityString = SharedConfig.SeverityString; export type SourceType = ParserOptionsTypes.SourceType | 'commonjs'; + export interface PluginMeta { + /** + * The meta.name property should match the npm package name for your plugin. + */ + name: string; + /** + * The meta.version property should match the npm package version for your plugin. + */ + version: string; + } export interface Plugin { + /** + * Shared configurations bundled with the plugin. + * Users will reference these directly in their config (i.e. `plugin.configs.recommended`). + */ + configs?: Record; + /** + * Metadata about your plugin for easier debugging and more effective caching of plugins. + */ + meta?: PluginMeta; /** * The definition of plugin processors. - * Can be referenced by string in the config (i.e., `"pluginName/processorName"`). + * Users can stringly reference the processor using the key in their config (i.e., `"pluginName/processorName"`). */ processors?: Record; /** * The definition of plugin rules. + * The key must be the name of the rule that users will use + * Users can stringly reference the rule using the key they registered the plugin under combined with the rule name. + * i.e. for the user config `plugins: { foo: pluginReference }` - the reference would be `"foo/ruleName"`. */ rules?: Record; } diff --git a/packages/utils/src/ts-eslint/Linter.ts b/packages/utils/src/ts-eslint/Linter.ts index f1f645d82eb3..f48ae9c32b0a 100644 --- a/packages/utils/src/ts-eslint/Linter.ts +++ b/packages/utils/src/ts-eslint/Linter.ts @@ -125,7 +125,7 @@ namespace Linter { export type Severity = SharedConfig.Severity; export type SeverityString = SharedConfig.SeverityString; - /** @deprecated use ClassicConfig.ConfigType instead */ + /** @deprecated use Linter.ConfigType instead */ export type Config = ClassicConfig.Config; export type ConfigType = ClassicConfig.Config | FlatConfig.ConfigArray; /** @deprecated use ClassicConfig.ConfigOverride instead */