eslint-plugin-jest 26.6.0 → 26.8.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-jest",
3
- "version": "26.6.0",
3
+ "version": "26.8.1",
4
4
  "description": "ESLint rules for Jest",
5
5
  "keywords": [
6
6
  "eslint",
@@ -21,16 +21,16 @@
21
21
  ],
22
22
  "scripts": {
23
23
  "build": "babel --extensions .js,.ts src --out-dir lib --copy-files && rimraf lib/__tests__ 'lib/**/__tests__'",
24
+ "_postinstall": "is-ci || husky install",
24
25
  "lint": "eslint . --ignore-pattern '!.eslintrc.js' --ext js,ts",
25
26
  "prepack": "rimraf lib && yarn build",
27
+ "prepublishOnly": "pinst --disable",
26
28
  "prettier:check": "prettier --check 'docs/**/*.md' README.md '.github/**' package.json tsconfig.json src/globals.json .yarnrc.yml",
27
29
  "prettier:write": "prettier --write 'docs/**/*.md' README.md '.github/**' package.json tsconfig.json src/globals.json .yarnrc.yml",
30
+ "postpublish": "pinst --enable",
28
31
  "test": "jest",
29
32
  "tools:regenerate-docs": "ts-node -T tools/regenerate-docs",
30
- "typecheck": "tsc -p .",
31
- "_postinstall": "is-ci || husky install",
32
- "prepublishOnly": "pinst --disable",
33
- "postpublish": "pinst --enable"
33
+ "typecheck": "tsc -p ."
34
34
  },
35
35
  "commitlint": {
36
36
  "extends": [
@@ -48,6 +48,23 @@
48
48
  "singleQuote": true,
49
49
  "trailingComma": "all"
50
50
  },
51
+ "release": {
52
+ "branches": [
53
+ "main",
54
+ {
55
+ "name": "next",
56
+ "prerelease": true
57
+ }
58
+ ],
59
+ "plugins": [
60
+ "@semantic-release/commit-analyzer",
61
+ "@semantic-release/release-notes-generator",
62
+ "@semantic-release/changelog",
63
+ "@semantic-release/npm",
64
+ "@semantic-release/git",
65
+ "@semantic-release/github"
66
+ ]
67
+ },
51
68
  "jest": {
52
69
  "coverageThreshold": {
53
70
  "global": {
@@ -103,7 +120,6 @@
103
120
  "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0",
104
121
  "eslint-config-prettier": "^8.3.0",
105
122
  "eslint-plugin-eslint-comments": "^3.1.2",
106
- "eslint-plugin-eslint-config": "^2.0.0",
107
123
  "eslint-plugin-eslint-plugin": "^5.0.0",
108
124
  "eslint-plugin-import": "^2.25.1",
109
125
  "eslint-plugin-node": "^11.0.0",
@@ -135,28 +151,8 @@
135
151
  "optional": true
136
152
  }
137
153
  },
154
+ "packageManager": "yarn@3.2.2",
138
155
  "engines": {
139
156
  "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
140
- },
141
- "release": {
142
- "branches": [
143
- "main",
144
- {
145
- "name": "next",
146
- "prerelease": true
147
- }
148
- ],
149
- "plugins": [
150
- "@semantic-release/commit-analyzer",
151
- "@semantic-release/release-notes-generator",
152
- "@semantic-release/changelog",
153
- "@semantic-release/npm",
154
- "@semantic-release/git",
155
- "@semantic-release/github"
156
- ]
157
- },
158
- "resolutions": {
159
- "@typescript-eslint/experimental-utils": "^5.0.0"
160
- },
161
- "packageManager": "yarn@3.2.1"
157
+ }
162
158
  }
@@ -1,145 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.parseExpectCall = exports.isParsedEqualityMatcherCall = exports.isExpectMember = exports.isExpectCall = exports.ModifierName = exports.EqualityMatcher = void 0;
7
-
8
- var _utils = require("@typescript-eslint/utils");
9
-
10
- var _utils2 = require("../utils");
11
-
12
- /**
13
- * Checks if the given `node` is a valid `ExpectCall`.
14
- *
15
- * In order to be an `ExpectCall`, the `node` must:
16
- * * be a `CallExpression`,
17
- * * have an accessor named 'expect',
18
- * * have a `parent`.
19
- *
20
- * @param {Node} node
21
- *
22
- * @return {node is ExpectCall}
23
- */
24
- const isExpectCall = node => node.type === _utils.AST_NODE_TYPES.CallExpression && (0, _utils2.isSupportedAccessor)(node.callee, 'expect') && node.parent !== undefined;
25
-
26
- exports.isExpectCall = isExpectCall;
27
-
28
- const isExpectMember = (node, name) => node.type === _utils.AST_NODE_TYPES.MemberExpression && (0, _utils2.isSupportedAccessor)(node.property, name);
29
- /**
30
- * Represents all the jest matchers.
31
- */
32
-
33
-
34
- exports.isExpectMember = isExpectMember;
35
- let ModifierName;
36
- exports.ModifierName = ModifierName;
37
-
38
- (function (ModifierName) {
39
- ModifierName["not"] = "not";
40
- ModifierName["rejects"] = "rejects";
41
- ModifierName["resolves"] = "resolves";
42
- })(ModifierName || (exports.ModifierName = ModifierName = {}));
43
-
44
- let EqualityMatcher;
45
- exports.EqualityMatcher = EqualityMatcher;
46
-
47
- (function (EqualityMatcher) {
48
- EqualityMatcher["toBe"] = "toBe";
49
- EqualityMatcher["toEqual"] = "toEqual";
50
- EqualityMatcher["toStrictEqual"] = "toStrictEqual";
51
- })(EqualityMatcher || (exports.EqualityMatcher = EqualityMatcher = {}));
52
-
53
- const isParsedEqualityMatcherCall = (matcher, name) => (name ? matcher.name === name : EqualityMatcher.hasOwnProperty(matcher.name)) && matcher.arguments !== null && matcher.arguments.length === 1;
54
- /**
55
- * Represents a parsed expect matcher, such as `toBe`, `toContain`, and so on.
56
- */
57
-
58
-
59
- exports.isParsedEqualityMatcherCall = isParsedEqualityMatcherCall;
60
-
61
- const parseExpectMember = expectMember => ({
62
- name: (0, _utils2.getAccessorValue)(expectMember.property),
63
- node: expectMember
64
- });
65
-
66
- const reparseAsMatcher = parsedMember => ({ ...parsedMember,
67
-
68
- /**
69
- * The arguments being passed to this `Matcher`, if any.
70
- *
71
- * If this matcher isn't called, this will be `null`.
72
- */
73
- arguments: parsedMember.node.parent.type === _utils.AST_NODE_TYPES.CallExpression ? parsedMember.node.parent.arguments : null
74
- });
75
- /**
76
- * Re-parses the given `parsedMember` as a `ParsedExpectModifier`.
77
- *
78
- * If the given `parsedMember` does not have a `name` of a valid `Modifier`,
79
- * an exception will be thrown.
80
- *
81
- * @param {ParsedExpectMember<ModifierName>} parsedMember
82
- *
83
- * @return {ParsedExpectModifier}
84
- */
85
-
86
-
87
- const reparseMemberAsModifier = parsedMember => {
88
- if (isSpecificMember(parsedMember, ModifierName.not)) {
89
- return parsedMember;
90
- }
91
- /* istanbul ignore if */
92
-
93
-
94
- if (!isSpecificMember(parsedMember, ModifierName.resolves) && !isSpecificMember(parsedMember, ModifierName.rejects)) {
95
- // ts doesn't think that the ModifierName.not check is the direct inverse as the above two checks
96
- // todo: impossible at runtime, but can't be typed w/o negation support
97
- throw new Error(`modifier name must be either "${ModifierName.resolves}" or "${ModifierName.rejects}" (got "${parsedMember.name}")`);
98
- }
99
-
100
- const negation = isExpectMember(parsedMember.node.parent, ModifierName.not) ? parsedMember.node.parent : undefined;
101
- return { ...parsedMember,
102
- negation
103
- };
104
- };
105
-
106
- const isSpecificMember = (member, specific) => member.name === specific;
107
- /**
108
- * Checks if the given `ParsedExpectMember` should be re-parsed as an `ParsedExpectModifier`.
109
- *
110
- * @param {ParsedExpectMember} member
111
- *
112
- * @return {member is ParsedExpectMember<ModifierName>}
113
- */
114
-
115
-
116
- const shouldBeParsedExpectModifier = member => ModifierName.hasOwnProperty(member.name);
117
-
118
- const parseExpectCall = expect => {
119
- const expectation = {
120
- expect
121
- };
122
-
123
- if (!isExpectMember(expect.parent)) {
124
- return expectation;
125
- }
126
-
127
- const parsedMember = parseExpectMember(expect.parent);
128
-
129
- if (!shouldBeParsedExpectModifier(parsedMember)) {
130
- expectation.matcher = reparseAsMatcher(parsedMember);
131
- return expectation;
132
- }
133
-
134
- const modifier = expectation.modifier = reparseMemberAsModifier(parsedMember);
135
- const memberNode = modifier.negation || modifier.node;
136
-
137
- if (!isExpectMember(memberNode.parent)) {
138
- return expectation;
139
- }
140
-
141
- expectation.matcher = reparseAsMatcher(parseExpectMember(memberNode.parent));
142
- return expectation;
143
- };
144
-
145
- exports.parseExpectCall = parseExpectCall;