Skip to content

Commit 5921d9b

Browse files
committed
feat: remove snapshot processor and flat/snapshot config
BREAKING CHANGE: removed `snapshot` processor and `flat/snapshot` config
1 parent 4d6f79a commit 5921d9b

File tree

6 files changed

+1
-128
lines changed

6 files changed

+1
-128
lines changed

README.md

-29
Original file line numberDiff line numberDiff line change
@@ -275,35 +275,6 @@ While the `recommended` and `style` configurations only change in major versions
275275
the `all` configuration may change in any release and is thus unsuited for
276276
installations requiring long-term consistency.
277277

278-
## Snapshot processing
279-
280-
> [!NOTE]
281-
>
282-
> This is only relevant for `eslint.config.js`
283-
284-
This plugin provides a
285-
[custom processor](https://eslint.org/docs/latest/extend/custom-processors) to
286-
allow rules to "lint" snapshot files.
287-
288-
For `.eslintrc` based configs, this is automatically enabled out of the box but
289-
must be opted into for `eslint.config.js` using the `flat/snapshots` config:
290-
291-
```js
292-
const jest = require('eslint-plugin-jest');
293-
294-
module.exports = [
295-
{
296-
...jest.configs['flat/snapshots'],
297-
rules: {
298-
'jest/no-large-snapshots': ['error', { maxSize: 1 }],
299-
},
300-
},
301-
];
302-
```
303-
304-
Unlike other configs, this includes a `files` array that matches `.snap` files
305-
meaning you can use it directly
306-
307278
## Rules
308279

309280
<!-- begin auto-generated rules list -->

src/__tests__/__snapshots__/rules.test.ts.snap

-14
Original file line numberDiff line numberDiff line change
@@ -193,20 +193,6 @@ exports[`rules should export configs that refer to actual rules 1`] = `
193193
"jest/valid-title": "error",
194194
},
195195
},
196-
"flat/snapshots": {
197-
"files": [
198-
"**/*.snap",
199-
],
200-
"plugins": {
201-
"jest": ObjectContaining {
202-
"meta": {
203-
"name": "eslint-plugin-jest",
204-
"version": Any<String>,
205-
},
206-
},
207-
},
208-
"processor": "jest/snapshots",
209-
},
210196
"flat/style": {
211197
"languageOptions": {
212198
"globals": {

src/__tests__/rules.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ describe('rules', () => {
6161
'flat/recommended': { plugins: { jest: expectJestPlugin } },
6262
'flat/style': { plugins: { jest: expectJestPlugin } },
6363
'flat/all': { plugins: { jest: expectJestPlugin } },
64-
'flat/snapshots': { plugins: { jest: expectJestPlugin } },
6564
});
6665
expect(Object.keys(recommendedConfigs)).toEqual([
6766
'all',
@@ -70,7 +69,6 @@ describe('rules', () => {
7069
'flat/all',
7170
'flat/recommended',
7271
'flat/style',
73-
'flat/snapshots',
7472
]);
7573
expect(Object.keys(recommendedConfigs.all.rules)).toHaveLength(
7674
ruleNames.length - deprecatedRules.length,

src/index.ts

+1-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
version as packageVersion,
77
} from '../package.json';
88
import globals from './globals.json';
9-
import * as snapshotProcessor from './processors/snapshot-processor';
109

1110
type RuleModule = TSESLint.RuleModule<string, unknown[]> & {
1211
meta: Required<Pick<TSESLint.RuleMetaData<string>, 'docs'>>;
@@ -76,19 +75,14 @@ const plugin = {
7675
| 'style'
7776
| 'flat/all'
7877
| 'flat/recommended'
79-
| 'flat/style'
80-
| 'flat/snapshots',
78+
| 'flat/style',
8179
Pick<Required<TSESLint.Linter.Config>, 'rules'>
8280
>,
8381
environments: {
8482
globals: {
8583
globals,
8684
},
8785
},
88-
processors: {
89-
snapshots: snapshotProcessor,
90-
'.snap': snapshotProcessor,
91-
},
9286
rules,
9387
};
9488

@@ -113,12 +107,6 @@ plugin.configs = {
113107
'flat/all': createFlatConfig(allRules),
114108
'flat/recommended': createFlatConfig(recommendedRules),
115109
'flat/style': createFlatConfig(styleRules),
116-
'flat/snapshots': {
117-
// @ts-expect-error this is introduced in flat config
118-
files: ['**/*.snap'],
119-
plugins: { jest: plugin },
120-
processor: 'jest/snapshots',
121-
},
122110
};
123111

124112
export = plugin;

src/processors/__tests__/snapshot-processor.test.ts

-55
This file was deleted.

src/processors/snapshot-processor.ts

-15
This file was deleted.

0 commit comments

Comments
 (0)