diff --git a/src/rules/__tests__/no-large-snapshots.test.ts b/src/rules/__tests__/no-large-snapshots.test.ts index 4bb1e538c..93cfc5468 100644 --- a/src/rules/__tests__/no-large-snapshots.test.ts +++ b/src/rules/__tests__/no-large-snapshots.test.ts @@ -41,11 +41,6 @@ ruleTester.run('no-large-snapshots', rule, { 'toThrowErrorMatchingInlineSnapshot', ), }, - { - // "it should return an empty object for non snapshot files" - filename: 'mock.jsx', - code: generateExpectInlineSnapsCode(50, 'toMatchInlineSnapshot'), - }, { filename: 'mock.jsx', code: generateExpectInlineSnapsCode(20, 'toMatchInlineSnapshot'), diff --git a/src/rules/no-large-snapshots.ts b/src/rules/no-large-snapshots.ts index d4f364b1f..9659ea3c2 100644 --- a/src/rules/no-large-snapshots.ts +++ b/src/rules/no-large-snapshots.ts @@ -115,29 +115,24 @@ export default createRule<[RuleOptions], MessageId>({ reportOnViolation(context, node, options); }, }; - } else if (context.getFilename().endsWith('.js')) { - return { - CallExpression(node) { - if ( - 'property' in node.callee && - (isSupportedAccessor( - node.callee.property, - 'toMatchInlineSnapshot', - ) || - isSupportedAccessor( - node.callee.property, - 'toThrowErrorMatchingInlineSnapshot', - )) - ) { - reportOnViolation(context, node, { - ...options, - maxSize: options.inlineMaxSize ?? options.maxSize, - }); - } - }, - }; } - return {}; + return { + CallExpression(node) { + if ( + 'property' in node.callee && + (isSupportedAccessor(node.callee.property, 'toMatchInlineSnapshot') || + isSupportedAccessor( + node.callee.property, + 'toThrowErrorMatchingInlineSnapshot', + )) + ) { + reportOnViolation(context, node, { + ...options, + maxSize: options.inlineMaxSize ?? options.maxSize, + }); + } + }, + }; }, });