diff --git a/src/rules/__tests__/no-large-snapshots.test.ts b/src/rules/__tests__/no-large-snapshots.test.ts index d939a9075..8a38bb524 100644 --- a/src/rules/__tests__/no-large-snapshots.test.ts +++ b/src/rules/__tests__/no-large-snapshots.test.ts @@ -210,27 +210,6 @@ ruleTester.run('no-large-snapshots', rule, { }, ], }, - { - // "should not report whitelisted large snapshots based on regexp" - filename: '/mock-component.jsx.snap', - code: [ - generateExportsSnapshotString(58, 'a big component w/ text'), - generateExportsSnapshotString(58, 'a big component 2'), - ].join('\n\n'), - options: [ - { - whitelistedSnapshots: { - '/mock-component.jsx.snap': [/a big component \d+/u], - }, - }, - ], - errors: [ - { - messageId: 'tooLongSnapshots', - data: { lineLimit: 50, lineCount: 58 }, - }, - ], - }, { filename: '/mock-component.jsx.snap', code: [ @@ -251,26 +230,6 @@ ruleTester.run('no-large-snapshots', rule, { }, ], }, - { - filename: '/mock-component.jsx.snap', - code: [ - generateExportsSnapshotString(58, 'a big component w/ text'), - generateExportsSnapshotString(58, 'a big component 2'), - ].join('\n\n'), - options: [ - { - whitelistedSnapshots: { - '/mock-component.jsx.snap': ['a big component 2'], - }, - }, - ], - errors: [ - { - messageId: 'tooLongSnapshots', - data: { lineLimit: 50, lineCount: 58 }, - }, - ], - }, ], }); diff --git a/src/rules/no-large-snapshots.ts b/src/rules/no-large-snapshots.ts index 33dba29e6..712bdc8b7 100644 --- a/src/rules/no-large-snapshots.ts +++ b/src/rules/no-large-snapshots.ts @@ -15,7 +15,6 @@ interface RuleOptions { maxSize?: number; inlineMaxSize?: number; allowedSnapshots?: Record>; - whitelistedSnapshots?: Record>; } type MessageId = 'noSnapshot' | 'tooLongSnapshots'; @@ -25,11 +24,7 @@ type RuleContext = TSESLint.RuleContext; const reportOnViolation = ( context: RuleContext, node: TSESTree.CallExpression | TSESTree.ExpressionStatement, - { - maxSize: lineLimit = 50, - whitelistedSnapshots = {}, - allowedSnapshots = whitelistedSnapshots, - }: RuleOptions, + { maxSize: lineLimit = 50, allowedSnapshots = {} }: RuleOptions, ) => { const startLine = node.loc.start.line; const endLine = node.loc.end.line; @@ -103,12 +98,6 @@ export default createRule<[RuleOptions], MessageId>({ type: 'object', additionalProperties: { type: 'array' }, }, - whitelistedSnapshots: { - type: 'object', - patternProperties: { - '.*': { type: 'array' }, - }, - }, }, additionalProperties: false, }, @@ -116,12 +105,6 @@ export default createRule<[RuleOptions], MessageId>({ }, defaultOptions: [{}], create(context, [options]) { - if ('whitelistedSnapshots' in options) { - console.warn( - 'jest/no-large-snapshots: the "whitelistedSnapshots" option has been renamed to "allowedSnapshots"', - ); - } - if (context.getFilename().endsWith('.snap')) { return { ExpressionStatement(node) {