@@ -5,7 +5,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'
55
66import type { Options } from './types'
77
8- import { filterOptionsByAllNamesMatch } from '../../utils/context-matching/filter-options-by- all-names-match'
8+ import { passesAllNamesMatchPatternFilter } from '../../utils/context-matching/passes- all-names-match-pattern-filter '
99import { computeMethodOrPropertyNameDetails } from './node-info/compute-method-or-property-name-details'
1010import { passesAstSelectorFilter } from '../../utils/context-matching/passes-ast-selector-filter'
1111
@@ -38,27 +38,32 @@ export function computeMatchedContextOptions<MessageIds extends string>({
3838 computeMethodOrPropertyNameDetails ( element , context . sourceCode ) . name ,
3939 )
4040
41- let matchedContextOptions = filterOptionsByAllNamesMatch ( {
42- contextOptions : context . options ,
43- nodeNames,
44- } )
45-
46- return matchedContextOptions . find ( isContextOptionMatching )
47-
48- function isContextOptionMatching ( options : Options [ number ] ) : boolean {
49- if ( ! options . useConfigurationIf ) {
50- return true
51- }
52-
53- if (
54- ! passesAstSelectorFilter ( {
55- matchesAstSelector : options . useConfigurationIf . matchesAstSelector ,
56- matchedAstSelectors,
57- } )
58- ) {
59- return false
60- }
41+ return context . options . find ( options =>
42+ isContextOptionMatching ( { matchedAstSelectors, nodeNames, options } ) ,
43+ )
44+ }
6145
46+ function isContextOptionMatching ( {
47+ matchedAstSelectors,
48+ nodeNames,
49+ options,
50+ } : {
51+ matchedAstSelectors : ReadonlySet < string >
52+ options : Options [ number ]
53+ nodeNames : string [ ]
54+ } ) : boolean {
55+ if ( ! options . useConfigurationIf ) {
6256 return true
6357 }
58+
59+ return (
60+ passesAllNamesMatchPatternFilter ( {
61+ allNamesMatchPattern : options . useConfigurationIf . allNamesMatchPattern ,
62+ nodeNames,
63+ } ) &&
64+ passesAstSelectorFilter ( {
65+ matchesAstSelector : options . useConfigurationIf . matchesAstSelector ,
66+ matchedAstSelectors,
67+ } )
68+ )
6469}
0 commit comments