eslint-plugin-jest 27.0.0 → 27.0.1

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.
@@ -33,8 +33,7 @@ var _default = (0, _utils2.createRule)({
33
33
  docs: {
34
34
  category: 'Best Practices',
35
35
  description: 'Avoid using a callback in asynchronous tests and hooks',
36
- recommended: 'error',
37
- suggestion: true
36
+ recommended: 'error'
38
37
  },
39
38
  messages: {
40
39
  noDoneCallback: 'Return a Promise instead of relying on callback parameter',
@@ -15,8 +15,7 @@ var _default = (0, _utils2.createRule)({
15
15
  docs: {
16
16
  category: 'Best Practices',
17
17
  description: 'Disallow focused tests',
18
- recommended: 'error',
19
- suggestion: true
18
+ recommended: 'error'
20
19
  },
21
20
  messages: {
22
21
  focusedTest: 'Unexpected focused test.',
@@ -15,8 +15,7 @@ var _default = (0, _utils2.createRule)({
15
15
  docs: {
16
16
  category: 'Best Practices',
17
17
  description: 'Suggest using the built-in equality matchers',
18
- recommended: false,
19
- suggestion: true
18
+ recommended: false
20
19
  },
21
20
  messages: {
22
21
  useEqualityMatcher: 'Prefer using one of the equality matchers instead',
@@ -13,10 +13,16 @@ const isFirstStatement = node => {
13
13
  let parent = node;
14
14
 
15
15
  while (parent) {
16
- var _parent$parent;
16
+ var _parent$parent, _parent$parent2;
17
17
 
18
18
  if (((_parent$parent = parent.parent) === null || _parent$parent === void 0 ? void 0 : _parent$parent.type) === _utils.AST_NODE_TYPES.BlockStatement) {
19
19
  return parent.parent.body[0] === parent;
20
+ } // if we've hit an arrow function, then it must have a single expression
21
+ // as its body, as otherwise we would have hit the block statement already
22
+
23
+
24
+ if (((_parent$parent2 = parent.parent) === null || _parent$parent2 === void 0 ? void 0 : _parent$parent2.type) === _utils.AST_NODE_TYPES.ArrowFunctionExpression) {
25
+ return true;
20
26
  }
21
27
 
22
28
  parent = parent.parent;
@@ -32,18 +38,13 @@ const suggestRemovingExtraArguments = (args, extraArgsStartAt) => ({
32
38
  fix: fixer => fixer.removeRange([args[extraArgsStartAt].range[0] - Math.sign(extraArgsStartAt), args[args.length - 1].range[1]])
33
39
  });
34
40
 
35
- // const suggestions: Array<[MessageIds, string]> = [
36
- // ['suggestAddingHasAssertions', 'expect.hasAssertions();'],
37
- // ['suggestAddingAssertions', 'expect.assertions();'],
38
- // ];
39
41
  var _default = (0, _utils2.createRule)({
40
42
  name: __filename,
41
43
  meta: {
42
44
  docs: {
43
45
  category: 'Best Practices',
44
46
  description: 'Suggest using `expect.assertions()` OR `expect.hasAssertions()`',
45
- recommended: false,
46
- suggestion: true
47
+ recommended: false
47
48
  },
48
49
  messages: {
49
50
  hasAssertionsTakesNoArguments: '`expect.hasAssertions` expects no arguments',
@@ -13,8 +13,7 @@ var _default = (0, _utils.createRule)({
13
13
  docs: {
14
14
  category: 'Best Practices',
15
15
  description: 'Suggest using `toStrictEqual()`',
16
- recommended: false,
17
- suggestion: true
16
+ recommended: false
18
17
  },
19
18
  messages: {
20
19
  useToStrictEqual: 'Use `toStrictEqual()` instead',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-jest",
3
- "version": "27.0.0",
3
+ "version": "27.0.1",
4
4
  "description": "ESLint rules for Jest",
5
5
  "keywords": [
6
6
  "eslint",