From 6c795d7d3d0c7b73e23e07af4dcf5acdd644ac28 Mon Sep 17 00:00:00 2001 From: Ulrich Stark Date: Sun, 26 Oct 2025 00:29:13 +0200 Subject: [PATCH] refactor(eslint-plugin): use correct type for return type of `createValidator` --- .../src/rules/naming-convention-utils/validator.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts index 83bf51a0ecf..669f44e12f8 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts @@ -4,7 +4,7 @@ import type * as ts from 'typescript'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import type { SelectorsString } from './enums'; -import type { Context, NormalizedSelector } from './types'; +import type { Context, NormalizedSelector, ValidatorFunction } from './types'; import { getParserServices } from '../../util'; import { @@ -26,9 +26,7 @@ export function createValidator( type: SelectorsString, context: Context, allConfigs: NormalizedSelector[], -): ( - node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier, -) => void { +): ValidatorFunction { // make sure the "highest priority" configs are checked first const selectorType = Selectors[type]; const configs = allConfigs @@ -72,10 +70,7 @@ export function createValidator( return b.selector - a.selector; }); - return ( - node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier, - modifiers: Set = new Set(), - ): void => { + return (node, modifiers = new Set()): void => { const originalName = node.type === AST_NODE_TYPES.Identifier || node.type === AST_NODE_TYPES.PrivateIdentifier