File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ const rule: Rule.RuleModule = {
56
56
contextIdentifiers = getContextIdentifiers ( scopeManager , ast ) ;
57
57
} ,
58
58
59
- 'Program:exit' ( ast ) {
59
+ 'Program:exit' ( ) {
60
60
if ( hasSeenUnknownMessageId || ! hasSeenViolationReport ) {
61
61
/*
62
62
Bail out when the rule is likely to have false positives.
@@ -107,21 +107,23 @@ const rule: Rule.RuleModule = {
107
107
const values =
108
108
messageId . type === 'Literal'
109
109
? [ messageId ]
110
- : findPossibleVariableValues (
111
- messageId as Identifier ,
110
+ : messageId . type === 'Identifier'
111
+ ? findPossibleVariableValues (
112
+ messageId ,
112
113
scopeManager ,
113
- ) ;
114
+ ) : [ ] ;
114
115
if (
115
116
values . length === 0 ||
116
117
values . some ( ( val ) => val . type !== 'Literal' )
117
118
) {
118
119
// When a dynamic messageId is used and we can't detect its value, disable the rule to avoid false positives.
119
120
hasSeenUnknownMessageId = true ;
120
121
}
121
- values . forEach (
122
- ( val ) =>
123
- 'value' in val && messageIdsUsed . add ( val . value as string ) ,
124
- ) ;
122
+ values
123
+ . filter ( value => value . type === 'Literal' )
124
+ . map ( value => value . value )
125
+ . filter ( value => typeof value === 'string' )
126
+ . forEach ( value => messageIdsUsed . add ( value ) ) ;
125
127
}
126
128
}
127
129
} ,
You can’t perform that action at this time.
0 commit comments