eslint-plugin-jest 26.4.3 → 26.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,8 +23,8 @@ var _utils2 = require("./utils");
23
23
  */
24
24
  function matchesAssertFunctionName(nodeName, patterns) {
25
25
  return patterns.some(p => new RegExp(`^${p.split('.').map(x => {
26
- if (x === '**') return '[a-z\\.]*';
27
- return x.replace(/\*/gu, '[a-z]*');
26
+ if (x === '**') return '[a-z\\d\\.]*';
27
+ return x.replace(/\*/gu, '[a-z\\d]*');
28
28
  }).join('\\.')}(\\.|$)`, 'ui').test(nodeName));
29
29
  }
30
30
 
@@ -46,7 +46,7 @@ var _default = (0, _utils.createRule)({
46
46
  if (jestFnCall.type === 'test') {
47
47
  testDepth++;
48
48
 
49
- if (node.arguments.length < 2) {
49
+ if (node.arguments.length < 2 && jestFnCall.members.every(s => (0, _utils.getAccessorValue)(s) !== 'todo')) {
50
50
  context.report({
51
51
  messageId: 'missingFunction',
52
52
  node
@@ -81,26 +81,30 @@ const parseJestFnCall = (node, scope) => {
81
81
 
82
82
  if (!(chain !== null && chain !== void 0 && chain.length)) {
83
83
  return null;
84
- } // ensure that the only call expression in the chain is at the end
84
+ } // check that every link in the chain except the last is a member expression
85
85
 
86
86
 
87
87
  if (chain.slice(0, chain.length - 1).some(nod => {
88
88
  var _nod$parent;
89
89
 
90
- return ((_nod$parent = nod.parent) === null || _nod$parent === void 0 ? void 0 : _nod$parent.type) === _utils.AST_NODE_TYPES.CallExpression;
90
+ return ((_nod$parent = nod.parent) === null || _nod$parent === void 0 ? void 0 : _nod$parent.type) !== _utils.AST_NODE_TYPES.MemberExpression;
91
91
  })) {
92
92
  return null;
93
93
  }
94
94
 
95
95
  const [first, ...rest] = chain;
96
- const lastNode = chain[chain.length - 1]; // if we're an `each()`, ensure we're the outer CallExpression (i.e `.each()()`)
96
+ const lastLink = (0, _utils2.getAccessorValue)(chain[chain.length - 1]); // if we're an `each()`, ensure we're the outer CallExpression (i.e `.each()()`)
97
97
 
98
- if ((0, _utils2.isSupportedAccessor)(lastNode, 'each')) {
98
+ if (lastLink === 'each') {
99
99
  if (node.callee.type !== _utils.AST_NODE_TYPES.CallExpression && node.callee.type !== _utils.AST_NODE_TYPES.TaggedTemplateExpression) {
100
100
  return null;
101
101
  }
102
102
  }
103
103
 
104
+ if (node.callee.type === _utils.AST_NODE_TYPES.TaggedTemplateExpression && lastLink !== 'each') {
105
+ return null;
106
+ }
107
+
104
108
  const resolved = resolveToJestFn(scope, (0, _utils2.getAccessorValue)(first)); // we're not a jest function
105
109
 
106
110
  if (!resolved) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-jest",
3
- "version": "26.4.3",
3
+ "version": "26.4.6",
4
4
  "description": "ESLint rules for Jest",
5
5
  "keywords": [
6
6
  "eslint",