eslint-plugin-jest 25.3.0 → 25.3.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/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/lib/rules/prefer-to-be.js +10 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [25.3.1](https://github.com/jest-community/eslint-plugin-jest/compare/v25.3.0...v25.3.1) (2021-12-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **prefer-to-be:** support template literals ([#1006](https://github.com/jest-community/eslint-plugin-jest/issues/1006)) ([aa428e6](https://github.com/jest-community/eslint-plugin-jest/commit/aa428e6598d5f7b259d3cec1bc505989a0fe9885))
|
|
7
|
+
|
|
1
8
|
# [25.3.0](https://github.com/jest-community/eslint-plugin-jest/compare/v25.2.4...v25.3.0) (2021-11-23)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -128,7 +128,7 @@ config file:
|
|
|
128
128
|
```
|
|
129
129
|
|
|
130
130
|
See
|
|
131
|
-
[ESLint documentation](
|
|
131
|
+
[ESLint documentation](https://eslint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files)
|
|
132
132
|
for more information about extending configuration files.
|
|
133
133
|
|
|
134
134
|
### All
|
|
@@ -20,9 +20,16 @@ const isNullEqualityMatcher = matcher => isNullLiteral(getFirstArgument(matcher)
|
|
|
20
20
|
|
|
21
21
|
const isFirstArgumentIdentifier = (matcher, name) => (0, _utils.isIdentifier)(getFirstArgument(matcher), name);
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const shouldUseToBe = matcher => {
|
|
24
24
|
const firstArg = getFirstArgument(matcher);
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
if (firstArg.type === _experimentalUtils.AST_NODE_TYPES.Literal) {
|
|
27
|
+
// regex literals are classed as literals, but they're actually objects
|
|
28
|
+
// which means "toBe" will give different results than other matchers
|
|
29
|
+
return !('regex' in firstArg);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return firstArg.type === _experimentalUtils.AST_NODE_TYPES.TemplateLiteral;
|
|
26
33
|
};
|
|
27
34
|
|
|
28
35
|
const getFirstArgument = matcher => {
|
|
@@ -116,7 +123,7 @@ var _default = (0, _utils.createRule)({
|
|
|
116
123
|
return;
|
|
117
124
|
}
|
|
118
125
|
|
|
119
|
-
if (
|
|
126
|
+
if (shouldUseToBe(matcher) && matcher.name !== _utils.EqualityMatcher.toBe) {
|
|
120
127
|
reportPreferToBe(context, '', matcher);
|
|
121
128
|
}
|
|
122
129
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-jest",
|
|
3
|
-
"version": "25.3.
|
|
3
|
+
"version": "25.3.1",
|
|
4
4
|
"description": "Eslint rules for Jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -159,5 +159,5 @@
|
|
|
159
159
|
"resolutions": {
|
|
160
160
|
"@typescript-eslint/experimental-utils": "^5.0.0"
|
|
161
161
|
},
|
|
162
|
-
"packageManager": "yarn@3.1.
|
|
162
|
+
"packageManager": "yarn@3.1.1"
|
|
163
163
|
}
|