Socket
Socket
Sign inDemoInstall

eslint-plugin-jest

Package Overview
Dependencies
Maintainers
11
Versions
325
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-jest - npm Package Compare versions

Comparing version 26.8.7 to 27.0.0-next.1

4

lib/rules/expect-expect.js

@@ -92,6 +92,4 @@ "use strict";

CallExpression(node) {
var _getNodeName;
const name = (0, _utils2.getNodeName)(node.callee) ?? '';
const name = (_getNodeName = (0, _utils2.getNodeName)(node.callee)) !== null && _getNodeName !== void 0 ? _getNodeName : '';
if ((0, _utils2.isTypeOfJestFnCall)(node, context, ['test']) || additionalTestBlockFunctions.includes(name)) {

@@ -98,0 +96,0 @@ if (node.callee.type === _utils.AST_NODE_TYPES.MemberExpression && (0, _utils2.isSupportedAccessor)(node.callee.property, 'todo')) {

@@ -50,7 +50,5 @@ "use strict";

CallExpression(node) {
var _parseJestFnCall;
const {
type: jestFnCallType
} = (_parseJestFnCall = (0, _utils2.parseJestFnCall)(node, context)) !== null && _parseJestFnCall !== void 0 ? _parseJestFnCall : {};
} = (0, _utils2.parseJestFnCall)(node, context) ?? {};

@@ -57,0 +55,0 @@ if (jestFnCallType === 'test') {

@@ -53,6 +53,6 @@ "use strict";

CallExpression(node) {
var _getNodeName$endsWith, _getNodeName;
var _getNodeName;
// done is the second argument for it.each, not the first
const isJestEach = (_getNodeName$endsWith = (_getNodeName = (0, _utils2.getNodeName)(node.callee)) === null || _getNodeName === void 0 ? void 0 : _getNodeName.endsWith('.each')) !== null && _getNodeName$endsWith !== void 0 ? _getNodeName$endsWith : false;
const isJestEach = ((_getNodeName = (0, _utils2.getNodeName)(node.callee)) === null || _getNodeName === void 0 ? void 0 : _getNodeName.endsWith('.each')) ?? false;

@@ -59,0 +59,0 @@ if (isJestEach && node.callee.type !== _utils.AST_NODE_TYPES.TaggedTemplateExpression) {

@@ -110,6 +110,4 @@ "use strict";

if (['toMatchInlineSnapshot', 'toThrowErrorMatchingInlineSnapshot'].includes((0, _utils2.getAccessorValue)(jestFnCall.matcher)) && jestFnCall.args.length) {
var _options$inlineMaxSiz;
reportOnViolation(context, jestFnCall.args[0], { ...options,
maxSize: (_options$inlineMaxSiz = options.inlineMaxSize) !== null && _options$inlineMaxSiz !== void 0 ? _options$inlineMaxSiz : options.maxSize
maxSize: options.inlineMaxSize ?? options.maxSize
});

@@ -116,0 +114,0 @@ }

@@ -107,6 +107,4 @@ "use strict";

if ((0, _utils.isTypeOfJestFnCall)(node, context, ['describe', 'test'])) {
var _depths$pop;
/* istanbul ignore next */
expressionDepth = (_depths$pop = depths.pop()) !== null && _depths$pop !== void 0 ? _depths$pop : 0;
expressionDepth = depths.pop() ?? 0;
}

@@ -113,0 +111,0 @@ },

@@ -80,7 +80,5 @@ "use strict";

create(context) {
var _context$options$;
const {
allowedFunctionCalls
} = (_context$options$ = context.options[0]) !== null && _context$options$ !== void 0 ? _context$options$ : {};
} = context.options[0] ?? {};

@@ -87,0 +85,0 @@ const checkBlockBody = body => {

@@ -40,7 +40,5 @@ "use strict";

create(context) {
var _context$options$;
const {
maxNumberOfTopLevelDescribes = Infinity
} = (_context$options$ = context.options[0]) !== null && _context$options$ !== void 0 ? _context$options$ : {};
} = context.options[0] ?? {};
let numberOfTopLevelDescribeBlocks = 0;

@@ -47,0 +45,0 @@ let numberOfDescribeBlocks = 0;

@@ -72,5 +72,5 @@ "use strict";

const resolvePossibleAliasedGlobal = (global, context) => {
var _context$settings$jes, _context$settings$jes2;
var _context$settings$jes;
const globalAliases = (_context$settings$jes = (_context$settings$jes2 = context.settings.jest) === null || _context$settings$jes2 === void 0 ? void 0 : _context$settings$jes2.globalAliases) !== null && _context$settings$jes !== void 0 ? _context$settings$jes : {};
const globalAliases = ((_context$settings$jes = context.settings.jest) === null || _context$settings$jes === void 0 ? void 0 : _context$settings$jes.globalAliases) ?? {};
const alias = Object.entries(globalAliases).find(([, aliases]) => aliases.includes(global));

@@ -114,3 +114,3 @@

const parseJestFnCallWithReasonInner = (node, context) => {
var _resolved$original, _node$parent2, _node$parent3;
var _node$parent2, _node$parent3;

@@ -142,3 +142,3 @@ const chain = getNodeChain(node);

const name = (_resolved$original = resolved.original) !== null && _resolved$original !== void 0 ? _resolved$original : resolved.local;
const name = resolved.original ?? resolved.local;
const links = [name, ...rest.map(link => (0, _utils2.getAccessorValue)(link))];

@@ -299,5 +299,3 @@

if (node.type === _utils.AST_NODE_TYPES.CallExpression && (0, _utils2.isIdentifier)(node.callee, 'require')) {
var _node$arguments$;
return (_node$arguments$ = node.arguments[0]) !== null && _node$arguments$ !== void 0 ? _node$arguments$ : null;
return node.arguments[0] ?? null;
}

@@ -304,0 +302,0 @@

@@ -127,8 +127,6 @@ "use strict";

const disallowedWordsRegexp = new RegExp(`\\b(${disallowedWords.join('|')})\\b`, 'iu');
const mustNotMatchPatterns = compileMatcherPatterns(mustNotMatch !== null && mustNotMatch !== void 0 ? mustNotMatch : {});
const mustMatchPatterns = compileMatcherPatterns(mustMatch !== null && mustMatch !== void 0 ? mustMatch : {});
const mustNotMatchPatterns = compileMatcherPatterns(mustNotMatch ?? {});
const mustMatchPatterns = compileMatcherPatterns(mustMatch ?? {});
return {
CallExpression(node) {
var _mustNotMatchPatterns, _mustMatchPatterns$je;
const jestFnCall = (0, _utils2.parseJestFnCall)(node, context);

@@ -209,3 +207,3 @@

const jestFunctionName = unprefixedName;
const [mustNotMatchPattern, mustNotMatchMessage] = (_mustNotMatchPatterns = mustNotMatchPatterns[jestFunctionName]) !== null && _mustNotMatchPatterns !== void 0 ? _mustNotMatchPatterns : [];
const [mustNotMatchPattern, mustNotMatchMessage] = mustNotMatchPatterns[jestFunctionName] ?? [];

@@ -227,3 +225,3 @@ if (mustNotMatchPattern) {

const [mustMatchPattern, mustMatchMessage] = (_mustMatchPatterns$je = mustMatchPatterns[jestFunctionName]) !== null && _mustMatchPatterns$je !== void 0 ? _mustMatchPatterns$je : [];
const [mustMatchPattern, mustMatchMessage] = mustMatchPatterns[jestFunctionName] ?? [];

@@ -230,0 +228,0 @@ if (mustMatchPattern) {

{
"name": "eslint-plugin-jest",
"version": "26.8.7",
"version": "27.0.0-next.1",
"description": "ESLint rules for Jest",

@@ -144,3 +144,3 @@ "keywords": [

"@typescript-eslint/eslint-plugin": "^5.0.0",
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
"eslint": "^7.0.0 || ^8.0.0"
},

@@ -157,4 +157,4 @@ "peerDependenciesMeta": {

"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
"node": "^14.15.0 || ^16.10.0 || >=18.0.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