Skip to content

Commit 60cbb7d

Browse files
committed
Ignore coverage warnings for deprecation fallbacks
1 parent fc7f321 commit 60cbb7d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/eslint-plugin/src/rules/jsx-import.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ export default createRule<RuleOptions, keyof typeof messages>({
6565
},
6666
defaultOptions: [],
6767
create(context) {
68-
const filename = context.filename ?? context.getFilename()
69-
const sourceCode = context.sourceCode ?? context.getSourceCode()
68+
const filename =
69+
context.filename ?? /* istanbul ignore next */ context.getFilename()
70+
const sourceCode =
71+
context.sourceCode ?? /* istanbul ignore next */ context.getSourceCode()
7072
const jsxRuntimeMode = context.options.find(
7173
(option): option is JSXConfig =>
7274
typeof option === 'object' && option.runtime === 'automatic'
@@ -272,9 +274,10 @@ export default createRule<RuleOptions, keyof typeof messages>({
272274
}
273275

274276
const lastSpecifier = specifiers[specifiers.length - 1]
275-
const scope = sourceCode.getScope
276-
? sourceCode.getScope(node)
277-
: context.getScope()
277+
const scope =
278+
typeof sourceCode.getScope === 'function'
279+
? sourceCode.getScope(node)
280+
: /* istanbul ignore next */ context.getScope()
278281

279282
if (scope.variables.some(x => x.name === 'css')) {
280283
return [

0 commit comments

Comments
 (0)