eslint-plugin-jest 28.0.0-next.3 → 28.0.0-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -275,35 +275,6 @@ While the `recommended` and `style` configurations only change in major versions
275
275
  the `all` configuration may change in any release and is thus unsuited for
276
276
  installations requiring long-term consistency.
277
277
 
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
-
307
278
  ## Rules
308
279
 
309
280
  <!-- begin auto-generated rules list -->
package/lib/index.js CHANGED
@@ -4,9 +4,6 @@ var _fs = require("fs");
4
4
  var _path = require("path");
5
5
  var _package = require("../package.json");
6
6
  var _globals = _interopRequireDefault(require("./globals.json"));
7
- var snapshotProcessor = _interopRequireWildcard(require("./processors/snapshot-processor"));
8
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
8
  // copied from https://github.com/babel/babel/blob/d8da63c929f2d28c401571e2a43166678c555bc4/packages/babel-helpers/src/helpers.js#L602-L606
12
9
  /* istanbul ignore next */
@@ -60,10 +57,6 @@ const plugin = {
60
57
  globals: _globals.default
61
58
  }
62
59
  },
63
- processors: {
64
- snapshots: snapshotProcessor,
65
- '.snap': snapshotProcessor
66
- },
67
60
  rules
68
61
  };
69
62
  const createRCConfig = rules => ({
@@ -88,14 +81,6 @@ plugin.configs = {
88
81
  style: createRCConfig(styleRules),
89
82
  'flat/all': createFlatConfig(allRules),
90
83
  'flat/recommended': createFlatConfig(recommendedRules),
91
- 'flat/style': createFlatConfig(styleRules),
92
- 'flat/snapshots': {
93
- // @ts-expect-error this is introduced in flat config
94
- files: ['**/*.snap'],
95
- plugins: {
96
- jest: plugin
97
- },
98
- processor: 'jest/snapshots'
99
- }
84
+ 'flat/style': createFlatConfig(styleRules)
100
85
  };
101
86
  module.exports = plugin;
@@ -92,7 +92,7 @@ var _default = exports.default = (0, _utils2.createRule)({
92
92
 
93
93
  /* istanbul ignore if */
94
94
  if (!firstBodyToken || !lastBodyToken || !tokenBeforeFirstParam || !tokenAfterLastParam) {
95
- throw new Error(`Unexpected null when attempting to fix ${context.getFilename()} - please file a github issue at https://github.com/jest-community/eslint-plugin-jest`);
95
+ throw new Error(`Unexpected null when attempting to fix ${(0, _utils2.getFilename)(context)} - please file a github issue at https://github.com/jest-community/eslint-plugin-jest`);
96
96
  }
97
97
  let argumentFix = fixer.replaceText(firstParam, '()');
98
98
  if (tokenBeforeFirstParam.value === '(' && tokenAfterLastParam.value === ')') {
@@ -75,7 +75,7 @@ var _default = exports.default = (0, _utils2.createRule)({
75
75
  },
76
76
  defaultOptions: [{}],
77
77
  create(context, [options]) {
78
- if (context.getFilename().endsWith('.snap')) {
78
+ if ((0, _utils2.getFilename)(context).endsWith('.snap')) {
79
79
  return {
80
80
  ExpressionStatement(node) {
81
81
  reportOnViolation(context, node, options);
@@ -29,15 +29,10 @@ var _default = exports.default = (0, _utils2.createRule)({
29
29
  create(context) {
30
30
  return {
31
31
  CallExpression(node) {
32
- let {
32
+ const {
33
33
  callee,
34
34
  typeArguments
35
35
  } = node;
36
-
37
- /* istanbul ignore next */
38
- if (!('typeArguments' in node)) {
39
- typeArguments = node.typeParameters;
40
- }
41
36
  if (callee.type !== _utils.AST_NODE_TYPES.MemberExpression) {
42
37
  return;
43
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-jest",
3
- "version": "28.0.0-next.3",
3
+ "version": "28.0.0-next.5",
4
4
  "description": "ESLint rules for Jest",
5
5
  "keywords": [
6
6
  "eslint",
@@ -111,8 +111,8 @@
111
111
  "@types/eslint": "^8.4.6",
112
112
  "@types/jest": "^29.0.0",
113
113
  "@types/node": "^14.18.26",
114
- "@typescript-eslint/eslint-plugin": "^5.0.0",
115
- "@typescript-eslint/parser": "^5.0.0",
114
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
115
+ "@typescript-eslint/parser": "^6.0.0",
116
116
  "babel-jest": "^29.0.0",
117
117
  "babel-plugin-replace-ts-export-assignment": "^0.0.2",
118
118
  "dedent": "^1.5.0",
@@ -142,7 +142,7 @@
142
142
  "typescript": "^5.0.4"
143
143
  },
144
144
  "peerDependencies": {
145
- "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0 || ^7.0.0",
145
+ "@typescript-eslint/eslint-plugin": "^6.0.0 || ^7.0.0",
146
146
  "eslint": "^7.0.0 || ^8.0.0",
147
147
  "jest": "*"
148
148
  },
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.preprocess = exports.postprocess = exports.meta = void 0;
7
- var _package = require("../../package.json");
8
- // https://eslint.org/docs/developer-guide/working-with-plugins#processors-in-plugins
9
- // https://github.com/typescript-eslint/typescript-eslint/issues/808
10
-
11
- const meta = exports.meta = {
12
- name: _package.name,
13
- version: _package.version
14
- };
15
- const preprocess = source => [source];
16
- exports.preprocess = preprocess;
17
- const postprocess = messages =>
18
- // snapshot files should only be linted with snapshot specific rules
19
- messages[0].filter(message => message.ruleId === 'jest/no-large-snapshots');
20
- exports.postprocess = postprocess;