Content-Length: 8010 | pFad | http://github.com/typescript-eslint/typescript-eslint/pull/9992.patch
thub.com
From 1c0fb91c1b9f64c32e821a7da5b5857eebacfe20 Mon Sep 17 00:00:00 2001
From: auvred
Date: Sun, 15 Sep 2024 12:24:33 +0300
Subject: [PATCH 1/2] fix(utils): add missing entries to the RuleListener
selectors list
---
packages/utils/src/ts-eslint/Rule.ts | 11 +++++-
.../utils/tests/ts-eslint/Rule.type-test.ts | 37 +++++++++++++++++++
2 files changed, 47 insertions(+), 1 deletion(-)
create mode 100644 packages/utils/tests/ts-eslint/Rule.type-test.ts
diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts
index 0d409a83e3f5..5fdd4c6776ef 100644
--- a/packages/utils/src/ts-eslint/Rule.ts
+++ b/packages/utils/src/ts-eslint/Rule.ts
@@ -423,7 +423,6 @@ interface RuleListenerBaseSelectors {
AssignmentExpression?: RuleFunction;
AssignmentPattern?: RuleFunction;
AwaitExpression?: RuleFunction;
- BigIntLiteral?: RuleFunction;
BinaryExpression?: RuleFunction;
BlockStatement?: RuleFunction;
BreakStatement?: RuleFunction;
@@ -451,6 +450,7 @@ interface RuleListenerBaseSelectors {
FunctionExpression?: RuleFunction;
Identifier?: RuleFunction;
IfStatement?: RuleFunction;
+ ImportAttribute?: RuleFunction;
ImportDeclaration?: RuleFunction;
ImportDefaultSpecifier?: RuleFunction;
ImportExpression?: RuleFunction;
@@ -465,6 +465,7 @@ interface RuleListenerBaseSelectors {
JSXFragment?: RuleFunction;
JSXIdentifier?: RuleFunction;
JSXMemberExpression?: RuleFunction;
+ JSXNamespacedName?: RuleFunction;
JSXOpeningElement?: RuleFunction;
JSXOpeningFragment?: RuleFunction;
JSXSpreadAttribute?: RuleFunction;
@@ -479,6 +480,7 @@ interface RuleListenerBaseSelectors {
NewExpression?: RuleFunction;
ObjectExpression?: RuleFunction;
ObjectPattern?: RuleFunction;
+ PrivateIdentifier?: RuleFunction;
Program?: RuleFunction;
Property?: RuleFunction;
PropertyDefinition?: RuleFunction;
@@ -486,6 +488,7 @@ interface RuleListenerBaseSelectors {
ReturnStatement?: RuleFunction;
SequenceExpression?: RuleFunction;
SpreadElement?: RuleFunction;
+ StaticBlock?: RuleFunction;
Super?: RuleFunction;
SwitchCase?: RuleFunction;
SwitchStatement?: RuleFunction;
@@ -495,6 +498,7 @@ interface RuleListenerBaseSelectors {
ThisExpression?: RuleFunction;
ThrowStatement?: RuleFunction;
TryStatement?: RuleFunction;
+ TSAbstractAccessorProperty?: RuleFunction;
TSAbstractKeyword?: RuleFunction;
TSAbstractMethodDefinition?: RuleFunction;
TSAbstractPropertyDefinition?: RuleFunction;
@@ -512,6 +516,7 @@ interface RuleListenerBaseSelectors {
TSDeclareFunction?: RuleFunction;
TSDeclareKeyword?: RuleFunction;
TSEmptyBodyFunctionExpression?: RuleFunction;
+ TSEnumBody?: RuleFunction;
TSEnumDeclaration?: RuleFunction;
TSEnumMember?: RuleFunction;
TSExportAssignment?: RuleFunction;
@@ -523,15 +528,18 @@ interface RuleListenerBaseSelectors {
TSIndexedAccessType?: RuleFunction;
TSIndexSignature?: RuleFunction;
TSInferType?: RuleFunction;
+ TSInstantiationExpression?: RuleFunction;
TSInterfaceBody?: RuleFunction;
TSInterfaceDeclaration?: RuleFunction;
TSInterfaceHeritage?: RuleFunction;
TSIntersectionType?: RuleFunction;
+ TSIntrinsicKeyword?: RuleFunction;
TSLiteralType?: RuleFunction;
TSMappedType?: RuleFunction;
TSMethodSignature?: RuleFunction;
TSModuleBlock?: RuleFunction;
TSModuleDeclaration?: RuleFunction;
+ TSNamedTupleMember?: RuleFunction;
TSNamespaceExportDeclaration?: RuleFunction;
TSNeverKeyword?: RuleFunction;
TSNonNullExpression?: RuleFunction;
@@ -551,6 +559,7 @@ interface RuleListenerBaseSelectors {
TSStaticKeyword?: RuleFunction;
TSStringKeyword?: RuleFunction;
TSSymbolKeyword?: RuleFunction;
+ TSTemplateLiteralType?: RuleFunction;
TSThisType?: RuleFunction;
TSTupleType?: RuleFunction;
TSTypeAliasDeclaration?: RuleFunction;
diff --git a/packages/utils/tests/ts-eslint/Rule.type-test.ts b/packages/utils/tests/ts-eslint/Rule.type-test.ts
new file mode 100644
index 000000000000..5657208f80ff
--- /dev/null
+++ b/packages/utils/tests/ts-eslint/Rule.type-test.ts
@@ -0,0 +1,37 @@
+import type { TSESTree } from '@typescript-eslint/types';
+
+import type { RuleListener } from '../../src/ts-eslint';
+
+type RuleListenerKeysWithoutIndexSignature = {
+ [K in keyof RuleListener as string extends K ? never : K]: K;
+};
+
+type RuleListenerSelectors = NonNullable<
+ RuleListenerKeysWithoutIndexSignature[keyof RuleListenerKeysWithoutIndexSignature]
+>;
+
+type AllSelectors =
+ | `${TSESTree.AST_NODE_TYPES}`
+ | `${TSESTree.AST_NODE_TYPES}:exit`;
+
+type ExpectNever = T;
+
+type SelectorsWithWrongNodeType = {
+ [K in TSESTree.AST_NODE_TYPES]: Parameters<
+ NonNullable
+ >[0]['type'] extends K
+ ? K extends Parameters>[0]['type']
+ ? never
+ : K
+ : K;
+}[TSESTree.AST_NODE_TYPES];
+type _test_rule_listener_selectors_have_correct_node_types =
+ ExpectNever;
+
+type ExtraSelectors = Exclude;
+type _test_rule_listener_does_not_define_extra_selectors =
+ ExpectNever;
+
+type MissingSelectors = Exclude;
+type _test_rule_listener_has_selectors_for_all_node_types =
+ ExpectNever;
From 9604bc3eff928fab0bbd8768b4e10b26d99e77a8 Mon Sep 17 00:00:00 2001
From: auvred
Date: Sun, 15 Sep 2024 14:41:59 +0300
Subject: [PATCH 2/2] fix knip err
---
knip.ts | 3 +++
1 file changed, 3 insertions(+)
diff --git a/knip.ts b/knip.ts
index e1b4d2ced348..51e66b91a598 100644
--- a/knip.ts
+++ b/knip.ts
@@ -65,6 +65,9 @@ export default {
entry: ['src/use-at-your-own-risk.ts'],
ignore: ['tests/fixtures/**'],
},
+ 'packages/utils': {
+ ignore: ['tests/**/*.type-test.ts'],
+ },
'packages/website': {
entry: [
'docusaurus.config.mts',
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/typescript-eslint/typescript-eslint/pull/9992.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy