Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-testing-library

Package Overview
Dependencies
Maintainers
3
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-testing-library - npm Package Compare versions

Comparing version 5.10.3 to 5.11.0

rules/prefer-query-matchers.js

8

create-testing-library-rule/detect-testing-library-utils.js

@@ -346,2 +346,9 @@ "use strict";

};
const isMatchingAssert = (node, matcherName) => {
const { matcher } = (0, node_utils_1.getAssertNodeInfo)(node);
if (!matcher) {
return false;
}
return matcher === matcherName;
};
const findImportedTestingLibraryUtilSpecifier = (specifierName) => {

@@ -453,2 +460,3 @@ var _a;

isPresenceAssert,
isMatchingAssert,
isAbsenceAssert,

@@ -455,0 +463,0 @@ canReportErrors,

2

package.json
{
"name": "eslint-plugin-testing-library",
"version": "5.10.3",
"version": "5.11.0",
"description": "ESLint plugin to follow best practices and anticipate common mistakes when writing tests with Testing Library",

@@ -5,0 +5,0 @@ "keywords": [

@@ -57,8 +57,8 @@ <div align="center">

Add `testing-library` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
Add `testing-library` to the plugins section of your `.eslintrc.js` configuration file. You can omit the `eslint-plugin-` prefix:
```json
{
"plugins": ["testing-library"]
}
```js
module.exports = {
plugins: ['testing-library'],
};
```

@@ -68,11 +68,11 @@

```json
{
"rules": {
"testing-library/await-async-query": "error",
"testing-library/no-await-sync-query": "error",
"testing-library/no-debugging-utils": "warn",
"testing-library/no-dom-import": "off"
}
}
```js
module.exports = {
rules: {
'testing-library/await-async-query': 'error',
'testing-library/no-await-sync-query': 'error',
'testing-library/no-debugging-utils': 'warn',
'testing-library/no-dom-import': 'off',
},
};
```

@@ -90,5 +90,5 @@

```json5
// .eslintrc
{
```js
// .eslintrc.js
module.exports = {
// 1) Here we have our usual config which applies to the whole project, so we don't put testing-library preset here.

@@ -107,3 +107,3 @@ extends: ['airbnb', 'plugin:prettier/recommended'],

],
}
};
```

@@ -122,14 +122,14 @@

```json5
```js
// ❌ Don't do this
{
module.exports = {
extends: ['plugin:testing-library/dom', 'plugin:testing-library/react'],
}
};
```
```json5
```js
// ✅ Just do this instead
{
module.exports = {
extends: ['plugin:testing-library/react'],
}
};
```

@@ -142,8 +142,8 @@

To enable this configuration use the `extends` property in your
`.eslintrc` config file:
`.eslintrc.js` config file:
```json
{
"extends": ["plugin:testing-library/dom"]
}
```js
module.exports = {
extends: ['plugin:testing-library/dom'],
};
```

@@ -156,8 +156,8 @@

To enable this configuration use the `extends` property in your
`.eslintrc` config file:
`.eslintrc.js` config file:
```json
{
"extends": ["plugin:testing-library/angular"]
}
```js
module.exports = {
extends: ['plugin:testing-library/angular'],
};
```

@@ -170,8 +170,8 @@

To enable this configuration use the `extends` property in your
`.eslintrc` config file:
`.eslintrc.js` config file:
```json
{
"extends": ["plugin:testing-library/react"]
}
```js
module.exports = {
extends: ['plugin:testing-library/react'],
};
```

@@ -184,8 +184,8 @@

To enable this configuration use the `extends` property in your
`.eslintrc` config file:
`.eslintrc.js` config file:
```json
{
"extends": ["plugin:testing-library/vue"]
}
```js
module.exports = {
extends: ['plugin:testing-library/vue'],
};
```

@@ -198,8 +198,8 @@

To enable this configuration use the `extends` property in your
`.eslintrc` config file:
`.eslintrc.js` config file:
```json
{
"extends": ["plugin:testing-library/marko"]
}
```js
module.exports = {
extends: ['plugin:testing-library/marko'],
};
```

@@ -241,2 +241,3 @@

| [prefer-query-by-disappearance](docs/rules/prefer-query-by-disappearance.md) | Suggest using `queryBy*` queries when waiting for disappearance | ![badge-angular][] ![badge-dom][] ![badge-marko][] ![badge-react][] ![badge-vue][] | |
| [prefer-query-matchers](docs/rules/prefer-query-matchers.md) | Ensure the configured `get*`/`query*` query is used with the corresponding matchers | | |
| [prefer-screen-queries](docs/rules/prefer-screen-queries.md) | Suggest using `screen` while querying | ![badge-angular][] ![badge-dom][] ![badge-marko][] ![badge-react][] ![badge-vue][] | |

@@ -265,9 +266,9 @@ | [prefer-user-event](docs/rules/prefer-user-event.md) | Suggest using `userEvent` over `fireEvent` for simulating user interactions | | |

```json5
// .eslintrc
{
```js
// .eslintrc.js
module.exports = {
settings: {
'testing-library/utils-module': 'my-custom-test-utility-file',
},
}
};
```

@@ -281,9 +282,9 @@

```json5
// .eslintrc
{
```js
// .eslintrc.js
module.exports = {
settings: {
'testing-library/custom-renders': ['display', 'renderWithProviders'],
},
}
};
```

@@ -297,9 +298,9 @@

```json5
// .eslintrc
{
```js
// .eslintrc.js
module.exports = {
settings: {
'testing-library/custom-queries': ['ByIcon', 'getByComplexText'],
},
}
};
```

@@ -313,5 +314,5 @@

```json5
// .eslintrc
{
```js
// .eslintrc.js
module.exports = {
settings: {

@@ -322,3 +323,3 @@ 'testing-library/utils-module': 'off',

},
}
};
```

@@ -325,0 +326,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc