From fe554b917ec857f821a1214d9c82629916be2341 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sun, 4 Aug 2024 17:37:26 +1200 Subject: [PATCH 1/3] fix: add plugin name and version metadata for ESLint v9 --- lib/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/index.ts b/lib/index.ts index c270f91d..94c797c3 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,7 +1,16 @@ +import { + name as packageName, + version as packageVersion, +} from '../package.json'; + import configs from './configs'; import rules from './rules'; export = { + meta: { + name: packageName, + version: packageVersion, + }, configs, rules, }; From 273cea2713f5924887023cd3f3ea58eab3ebdaf0 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Thu, 8 Aug 2024 06:26:18 +1200 Subject: [PATCH 2/3] fix: correct types --- tools/generate-configs/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/generate-configs/index.ts b/tools/generate-configs/index.ts index 87c773c2..ef5f1abc 100644 --- a/tools/generate-configs/index.ts +++ b/tools/generate-configs/index.ts @@ -1,4 +1,5 @@ -import { type LinterConfigRules } from '../../lib/configs'; +import { type TSESLint } from '@typescript-eslint/utils'; + import rules from '../../lib/rules'; import { SUPPORTED_TESTING_FRAMEWORKS, @@ -11,7 +12,7 @@ const RULE_NAME_PREFIX = 'testing-library/'; const getRecommendedRulesForTestingFramework = ( framework: SupportedTestingFramework -): LinterConfigRules => +): Record => Object.entries(rules) .filter( ([ From 3b766d16c3266e750a3be4f1812c85f711f0b34b Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Thu, 8 Aug 2024 07:17:50 +1200 Subject: [PATCH 3/3] fix: don't "import" `package.json` --- lib/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 94c797c3..00c8bc85 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,11 +1,13 @@ -import { - name as packageName, - version as packageVersion, -} from '../package.json'; - import configs from './configs'; import rules from './rules'; +// we can't natively import package.json as tsc will copy it into dist/ +const { + name: packageName, + version: packageVersion, + // eslint-disable-next-line @typescript-eslint/no-var-requires +} = require('../package.json') as { name: string; version: string }; + export = { meta: { name: packageName,