From 09c768e6be3fd28e9b7729132080ad8f1e98ad3e Mon Sep 17 00:00:00 2001 From: bradzacher Date: Mon, 1 Apr 2024 22:45:25 +1030 Subject: [PATCH] fix(typescript-eslint): improve support for legacy configs --- packages/typescript-eslint/src/index.ts | 31 +++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/packages/typescript-eslint/src/index.ts b/packages/typescript-eslint/src/index.ts index 20074daf4b42..786645a24a2a 100644 --- a/packages/typescript-eslint/src/index.ts +++ b/packages/typescript-eslint/src/index.ts @@ -24,10 +24,33 @@ const parser: TSESLint.FlatConfig.Parser = { parseForESLint: parserBase.parseForESLint, }; -const plugin: TSESLint.FlatConfig.Plugin = { - meta: pluginBase.meta, - rules: pluginBase.rules, -}; +/* +we could build a plugin object here without the `configs` key - but if we do +that then we create a situation in which +``` +require('typescript-eslint').plugin !== require('@typescript-eslint/eslint-plugin') +``` + +This is bad because it means that 3rd party configs would be required to use +`typescript-eslint` or else they would break a user's config if the user either +used `tseslint.configs.recomended` et al or +``` +{ + plugins: { + '@typescript-eslint': tseslint.plugin, + }, +} +``` + +This might be something we could consider okay (eg 3rd party flat configs must +use our new package); however legacy configs consumed via `@eslint/eslintrc` +would never be able to satisfy this constraint and thus users would be blocked +from using them. +*/ +const plugin: TSESLint.FlatConfig.Plugin = pluginBase as Omit< + typeof pluginBase, + 'configs' +>; const configs = { all: allConfig(plugin, parser), pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy