eslint-plugin-jest-dom
Advanced tools
Comparing version 3.2.4 to 3.3.0
@@ -148,2 +148,6 @@ "use strict"; | ||
fix(fixer) { | ||
if (!styleValue) { | ||
return null; | ||
} | ||
return [fixer.removeRange([node.object.range[1], node.property.range[1]]), fixer.replaceText(matcher, "toHaveStyle"), fixer.replaceTextRange([styleName.range[0], styleValue.range[1]], `{${camelCase(styleName.value)}: ${context.getSourceCode().getText(styleValue)}}`)]; | ||
@@ -150,0 +154,0 @@ } |
{ | ||
"name": "eslint-plugin-jest-dom", | ||
"version": "3.2.4", | ||
"version": "3.3.0", | ||
"description": "ESLint plugin to follow best practices and anticipate common mistakes when writing tests with jest-dom", | ||
@@ -42,6 +42,7 @@ "main": "dist/index.js", | ||
"@babel/runtime": "^7.9.6", | ||
"@testing-library/dom": "^7.28.1", | ||
"requireindex": "^1.2.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "6.8", | ||
"eslint": "7.14", | ||
"jest-extended": "^0.11.5", | ||
@@ -57,3 +58,4 @@ "kcd-scripts": "6.5.1" | ||
"babel/quotes": "off", | ||
"max-lines-per-function": "off" | ||
"max-lines-per-function": "off", | ||
"testing-library/no-dom-import": "off" | ||
} | ||
@@ -60,0 +62,0 @@ }, |
@@ -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-9-orange.svg?style=flat-square)](#contributors-) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors-) | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
@@ -104,14 +104,13 @@ [![PRs Welcome][prs-badge]][prs] | ||
<!-- __BEGIN AUTOGENERATED TABLE__ --> | ||
| Name | π | π§ | Description | | ||
| ---------------------------------------------------------------------------------------------------------------------------------------------- | --- | --- | -------------------------------------------------------------- | | ||
| [prefer-checked](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-checked.md) | π | π§ | prefer toBeChecked over checking attributes | | ||
| [prefer-empty](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-empty.md) | π | π§ | Prefer toBeEmpty over checking innerHTML | | ||
| [prefer-enabled-disabled](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-enabled-disabled.md) | π | π§ | prefer toBeDisabled or toBeEnabled over checking attributes | | ||
| [prefer-focus](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-focus.md) | π | π§ | prefer toHaveFocus over checking document.activeElement | | ||
| [prefer-required](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-required.md) | π | π§ | prefer toBeRequired over checking properties | | ||
| [prefer-to-have-attribute](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-to-have-attribute.md) | π | π§ | prefer toHaveAttribute over checking getAttribute/hasAttribute | | ||
| [prefer-to-have-style](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-to-have-style.md) | π | π§ | prefer toHaveStyle over checking element style | | ||
| [prefer-to-have-text-content](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-to-have-text-content.md) | π | π§ | Prefer toHaveTextContent over checking element.textContent | | ||
Name | π | π§ | Description | ||
----- | ----- | ----- | ----- | ||
[prefer-checked](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-checked.md) | π | π§ | prefer toBeChecked over checking attributes | ||
[prefer-empty](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-empty.md) | π | π§ | Prefer toBeEmpty over checking innerHTML | ||
[prefer-enabled-disabled](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-enabled-disabled.md) | π | π§ | prefer toBeDisabled or toBeEnabled over checking attributes | ||
[prefer-focus](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-focus.md) | π | π§ | prefer toHaveFocus over checking document.activeElement | ||
[prefer-in-document](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-in-document.md) | | π§ | Prefer .toBeInTheDocument() in favor of checking the length of the result using .toHaveLength(1) | ||
[prefer-required](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-required.md) | π | π§ | prefer toBeRequired over checking properties | ||
[prefer-to-have-attribute](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-to-have-attribute.md) | π | π§ | prefer toHaveAttribute over checking getAttribute/hasAttribute | ||
[prefer-to-have-style](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-to-have-style.md) | π | π§ | prefer toHaveStyle over checking element style | ||
[prefer-to-have-text-content](https://github.com/testing-library/eslint-plugin-jest-dom/blob/master/docs/rules/prefer-to-have-text-content.md) | π | π§ | Prefer toHaveTextContent over checking element.textContent | ||
<!-- __END AUTOGENERATED TABLE__ --> | ||
@@ -157,2 +156,5 @@ | ||
<td align="center"><a href="https://github.com/atsikov"><img src="https://avatars3.githubusercontent.com/u/1422928?v=4" width="100px;" alt=""/><br /><sub><b>Aleksei Tsikov</b></sub></a><br /><a href="https://github.com/testing-library/eslint-plugin-jest-dom/issues?q=author%3Aatsikov" title="Bug reports">π</a></td> | ||
<td align="center"><a href="https://mario.dev"><img src="https://avatars1.githubusercontent.com/u/2677072?v=4" width="100px;" alt=""/><br /><sub><b>Mario BeltrΓ‘n AlarcΓ³n</b></sub></a><br /><a href="https://github.com/testing-library/eslint-plugin-jest-dom/commits?author=Belco90" title="Documentation">π</a></td> | ||
<td align="center"><a href="https://codepen.io/ariperkkio/"><img src="https://avatars2.githubusercontent.com/u/14806298?v=4" width="100px;" alt=""/><br /><sub><b>Ari PerkkiΓΆ</b></sub></a><br /><a href="https://github.com/testing-library/eslint-plugin-jest-dom/issues?q=author%3AAriPerkkio" title="Bug reports">π</a></td> | ||
<td align="center"><a href="http://www.antn.se"><img src="https://avatars0.githubusercontent.com/u/785676?v=4" width="100px;" alt=""/><br /><sub><b>Anton Niklasson</b></sub></a><br /><a href="https://github.com/testing-library/eslint-plugin-jest-dom/commits?author=AntonNiklasson" title="Code">π»</a> <a href="https://github.com/testing-library/eslint-plugin-jest-dom/commits?author=AntonNiklasson" title="Tests">β οΈ</a> <a href="https://github.com/testing-library/eslint-plugin-jest-dom/commits?author=AntonNiklasson" title="Documentation">π</a></td> | ||
</tr> | ||
@@ -159,0 +161,0 @@ </table> |
51434
15
753
195
4
+ Added@testing-library/dom@^7.28.1
+ Added@babel/code-frame@7.24.7(transitive)
+ Added@babel/helper-validator-identifier@7.24.7(transitive)
+ Added@babel/highlight@7.24.7(transitive)
+ Added@babel/runtime-corejs3@7.24.7(transitive)
+ Added@jest/types@26.6.2(transitive)
+ Added@testing-library/dom@7.31.2(transitive)
+ Added@types/aria-query@4.2.2(transitive)
+ Added@types/istanbul-lib-coverage@2.0.6(transitive)
+ Added@types/istanbul-lib-report@3.0.3(transitive)
+ Added@types/istanbul-reports@3.0.4(transitive)
+ Added@types/node@20.14.9(transitive)
+ Added@types/yargs@15.0.19(transitive)
+ Added@types/yargs-parser@21.0.3(transitive)
+ Addedansi-styles@3.2.1(transitive)
+ Addedaria-query@4.2.2(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedcore-js-pure@3.37.1(transitive)
+ Addeddom-accessibility-api@0.5.16(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedlz-string@1.5.0(transitive)
+ Addedpicocolors@1.0.1(transitive)
+ Addedpretty-format@26.6.2(transitive)
+ Addedreact-is@17.0.2(transitive)
+ Addedsupports-color@5.5.0(transitive)
+ Addedundici-types@5.26.5(transitive)