Socket
Socket
Sign inDemoInstall

eslint-plugin-jest-dom

Package Overview
Dependencies
167
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0 to 5.0.1

17

dist/assignment-ast.js

@@ -15,13 +15,16 @@ "use strict";

*
* @param {Object} context - Context for a rule
* @param {Object} expression - An expression node
* @returns {Object} - A node
*/
function getInnerNodeFrom(expression) {
function getInnerNodeFrom(context, expression) {
switch (expression.type) {
case "Identifier":
return getAssignmentForIdentifier(context, expression.name);
case "TSAsExpression":
return getInnerNodeFrom(expression.expression);
return getInnerNodeFrom(context, expression.expression);
case "AwaitExpression":
return getInnerNodeFrom(expression.argument);
return getInnerNodeFrom(context, expression.argument);
case "MemberExpression":
return getInnerNodeFrom(expression.object);
return getInnerNodeFrom(context, expression.object);
default:

@@ -46,3 +49,3 @@ return expression;

// let foo = bar;
assignmentNode = getInnerNodeFrom(init);
assignmentNode = getInnerNodeFrom(context, init);
} else {

@@ -55,3 +58,3 @@ // let foo;

}
assignmentNode = getInnerNodeFrom(assignmentRef.writeExpr);
assignmentNode = getInnerNodeFrom(context, assignmentRef.writeExpr);
}

@@ -70,3 +73,3 @@ return assignmentNode;

function getQueryNodeFrom(context, nodeWithValueProp) {
const queryNode = nodeWithValueProp.type === "Identifier" ? getAssignmentForIdentifier(context, nodeWithValueProp.name) : getInnerNodeFrom(nodeWithValueProp);
const queryNode = getInnerNodeFrom(context, nodeWithValueProp);
if (!queryNode || !queryNode.callee) {

@@ -73,0 +76,0 @@ return {

@@ -105,3 +105,3 @@ "use strict";

let fix = null;
if (typeof styleValue.value !== "number" && !(styleValue.value instanceof RegExp)) {
if (typeof styleValue.value !== "number" && !(styleValue.value instanceof RegExp) && styleName.type !== "Identifier") {
fix = fixer => {

@@ -124,3 +124,3 @@ return [fixer.removeRange([startOfStyleMemberExpression, endOfStyleMemberExpression]), fixer.replaceText(matcher, "toHaveStyle"), fixer.replaceText(styleValue, typeof styleName.value === "number" ? `{${getReplacementObjectProperty(styleValue)}: expect.anything()}` : getReplacementStyleParam(styleName, styleValue))];

let fix = null;
if (typeof styleName.value !== "number") {
if (typeof styleName.value !== "number" && styleName.type !== "Identifier") {
fix = fixer => {

@@ -127,0 +127,0 @@ return [fixer.removeRange([node.object.range[1], endOfStyleMemberExpression]), fixer.replaceText(matcher, "toHaveStyle"), fixer.replaceText(styleValue, getReplacementStyleParam(styleName, styleValue))];

{
"name": "eslint-plugin-jest-dom",
"version": "5.0.0",
"version": "5.0.1",
"description": "ESLint plugin to follow best practices and anticipate common mistakes when writing tests with jest-dom",

@@ -48,2 +48,3 @@ "main": "dist/index.js",

"devDependencies": {
"@testing-library/dom": "^8.20.0",
"@typescript-eslint/parser": "^5.9.1",

@@ -50,0 +51,0 @@ "eslint": "^8.7.0",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc