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
2
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 1.3.1 to 1.3.2

13

lib/rules/prefer-explicit-assert.js
'use strict';
const { getDocsUrl, ALL_QUERIES_METHODS } = require('../utils');
const { findParent, getDocsUrl, ALL_QUERIES_METHODS } = require('../utils');

@@ -10,3 +10,3 @@ const ALL_GET_BY_QUERIES = ALL_QUERIES_METHODS.map(

const findCallExpressionParent = node =>
node.type === 'CallExpression' ? node : findCallExpressionParent(node.parent);
findParent(node, node => node.type === 'CallExpression');

@@ -23,3 +23,4 @@ const isValidQuery = (node, customQueryNames = []) =>

const isDeclared = node => node.parent.type === 'VariableDeclarator';
const isDeclared = node =>
!!findParent(node, node => node.type === 'VariableDeclarator');

@@ -29,2 +30,7 @@ const isReturnedByReturnStatement = node =>

const isInDestructuringStatement = node =>
(node.parent.type === 'Property' &&
node.parent.parent.type === 'ObjectPattern') ||
node.parent.type === 'ArrayPattern';
module.exports = {

@@ -69,2 +75,3 @@ meta: {

isValidQuery(node, customQueryNames) &&
!isInDestructuringStatement(node) &&
!isDirectlyCalledByFunction(callExpressionNode) &&

@@ -71,0 +78,0 @@ !isReturnedByArrowFunctionExpression(callExpressionNode) &&

@@ -51,3 +51,14 @@ 'use strict';

const findParent = (node, cb) => {
if (cb(node)) {
return node;
} else if (node.parent) {
return findParent(node.parent, cb);
}
return null;
};
module.exports = {
findParent,
getDocsUrl,

@@ -54,0 +65,0 @@ SYNC_QUERIES_VARIANTS,

{
"name": "eslint-plugin-testing-library",
"version": "1.3.1",
"version": "1.3.2",
"description": "ESLint rules for Testing Library",

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

@@ -175,3 +175,3 @@ <div align="center">

<td align="center"><a href="https://aarongarciah.com"><img src="https://avatars0.githubusercontent.com/u/7225802?v=4" width="100px;" alt="Aarón García Hervás"/><br /><sub><b>Aarón García Hervás</b></sub></a><br /><a href="https://github.com/Belco90/eslint-plugin-testing-library/commits?author=aarongarciah" title="Documentation">📖</a></td>
<td align="center"><a href="https://www.matej.snuderl.si/"><img src="https://avatars3.githubusercontent.com/u/8524109?v=4" width="100px;" alt="Matej Šnuderl"/><br /><sub><b>Matej Šnuderl</b></sub></a><br /><a href="#ideas-Meemaw" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://www.matej.snuderl.si/"><img src="https://avatars3.githubusercontent.com/u/8524109?v=4" width="100px;" alt="Matej Šnuderl"/><br /><sub><b>Matej Šnuderl</b></sub></a><br /><a href="#ideas-Meemaw" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/Belco90/eslint-plugin-testing-library/commits?author=Meemaw" title="Documentation">📖</a></td>
</tr>

@@ -178,0 +178,0 @@ </table>

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