eslint-plugin-jest-dom
Advanced tools
Comparing version 3.8.0 to 3.8.1
@@ -17,3 +17,3 @@ "use strict"; | ||
const isBannedArg = node => attributes.some(attr => attr === node.arguments[0].value); //expect(el).not.toBeEnabled() => expect(el).toBeDisabled() | ||
const isBannedArg = node => node.arguments.length && attributes.some(attr => attr === node.arguments[0].value); //expect(el).not.toBeEnabled() => expect(el).toBeDisabled() | ||
@@ -38,2 +38,6 @@ | ||
"CallExpression[callee.property.name=/toBe(Truthy|Falsy)?|toEqual/][callee.object.callee.name='expect']"(node) { | ||
if (!node.callee.object.arguments.length) { | ||
return; | ||
} | ||
const { | ||
@@ -69,4 +73,2 @@ arguments: [{ | ||
"CallExpression[callee.property.name=/toHaveProperty|toHaveAttribute/][callee.object.property.name='not'][callee.object.object.callee.name='expect']"(node) { | ||
const arg = node.arguments[0].value; | ||
if (!isBannedArg(node)) { | ||
@@ -76,2 +78,3 @@ return; | ||
const arg = node.arguments[0].value; | ||
const correctFunction = getCorrectFunctionFor(node, true); | ||
@@ -78,0 +81,0 @@ const incorrectFunction = node.callee.property.name; |
@@ -76,3 +76,3 @@ "use strict"; | ||
if (matcherNode.name === "toHaveLength") { | ||
if (matcherNode.name === "toHaveLength" && matcherArguments.length) { | ||
const lengthValue = getLengthValue(matcherArguments); // isNotToHaveLengthZero represents .not.toHaveLength(0) which is a valid use of toHaveLength | ||
@@ -90,3 +90,3 @@ | ||
if (matcherNode.name === "toBe" || matcherNode.name === "toEqual") { | ||
if (!usesToBeOrToEqualWithNull(matcherNode, matcherArguments)) { | ||
if (!matcherArguments.length || !usesToBeOrToEqualWithNull(matcherNode, matcherArguments)) { | ||
return; | ||
@@ -135,2 +135,6 @@ } | ||
[`CallExpression[callee.object.object.callee.name='expect'][callee.object.property.name='not'][callee.property.name=${alternativeMatchers}], CallExpression[callee.object.callee.name='expect'][callee.object.property.name='not'][callee.object.arguments.0.argument.callee.name=${alternativeMatchers}]`](node) { | ||
if (!node.callee.object.object.arguments.length) { | ||
return; | ||
} | ||
const arg = node.callee.object.object.arguments[0]; | ||
@@ -137,0 +141,0 @@ const queryNode = arg.type === "AwaitExpression" ? arg.argument.callee : arg.callee; |
{ | ||
"name": "eslint-plugin-jest-dom", | ||
"version": "3.8.0", | ||
"version": "3.8.1", | ||
"description": "ESLint plugin to follow best practices and anticipate common mistakes when writing tests with jest-dom", | ||
@@ -49,3 +49,3 @@ "main": "dist/index.js", | ||
"@typescript-eslint/parser": "^4.8.2", | ||
"eslint": "7.23", | ||
"eslint": "7.24", | ||
"eslint-remote-tester": "^0.3.3", | ||
@@ -52,0 +52,0 @@ "jest-extended": "^0.11.5", |
@@ -17,3 +17,3 @@ <div align="center"> | ||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-14-orange.svg?style=flat-square)](#contributors-) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-15-orange.svg?style=flat-square)](#contributors-) | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
@@ -165,2 +165,5 @@ [![PRs Welcome][prs-badge]][prs] | ||
</tr> | ||
<tr> | ||
<td align="center"><a href="https://github.com/G-Rath"><img src="https://avatars.githubusercontent.com/u/3151613?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gareth Jones</b></sub></a><br /><a href="https://github.com/testing-library/eslint-plugin-jest-dom/commits?author=G-Rath" title="Tests">β οΈ</a> <a href="https://github.com/testing-library/eslint-plugin-jest-dom/commits?author=G-Rath" title="Code">π»</a> <a href="https://github.com/testing-library/eslint-plugin-jest-dom/issues?q=author%3AG-Rath" title="Bug reports">π</a></td> | ||
</tr> | ||
</table> | ||
@@ -167,0 +170,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78154
1212
204