@@ -45,9 +45,15 @@ type OptionsItemWithPatternProperty = {
45
45
pattern : ModifierByFileExtension
46
46
}
47
47
48
+ type OptionsItemWithoutPatternProperty = {
49
+ ignorePackages ?: boolean
50
+ checkTypeImports ?: boolean
51
+ }
52
+
48
53
type Options =
49
54
| [ ]
50
55
| [ Modifier ]
56
+ | [ Modifier , OptionsItemWithoutPatternProperty ]
51
57
| [ Modifier , OptionsItemWithPatternProperty ]
52
58
| [ Modifier , ModifierByFileExtension ]
53
59
| [ ModifierByFileExtension ]
@@ -59,7 +65,7 @@ type NormalizedOptions = {
59
65
checkTypeImports ?: boolean
60
66
}
61
67
62
- type MessageId = 'missing' | 'unexpected'
68
+ type MessageId = 'missing' | 'missingKnown' | ' unexpected'
63
69
64
70
function buildProperties ( context : RuleContext < MessageId , Options > ) {
65
71
const result : Required < NormalizedOptions > = {
@@ -167,7 +173,9 @@ export = createRule<Options, MessageId>({
167
173
] ,
168
174
} ,
169
175
messages : {
170
- missing : 'Missing file extension {{extension}}for "{{importPath}}"' ,
176
+ missing : 'Missing file extension for "{{importPath}}"' ,
177
+ missingKnown :
178
+ 'Missing file extension "{{extension}}" for "{{importPath}}"' ,
171
179
unexpected :
172
180
'Unexpected use of file extension "{{extension}}" for "{{importPath}}"' ,
173
181
} ,
@@ -259,9 +267,9 @@ export = createRule<Options, MessageId>({
259
267
if ( extensionRequired && ! extensionForbidden ) {
260
268
context . report ( {
261
269
node : source ,
262
- messageId : 'missing' ,
270
+ messageId : extension ? 'missingKnown' : 'missing' ,
263
271
data : {
264
- extension : extension ? `" ${ extension } " ` : '' ,
272
+ extension,
265
273
importPath : importPathWithQueryString ,
266
274
} ,
267
275
} )
0 commit comments