@next/eslint-plugin-next 13.4.8-canary.8 → 13.4.8

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.
@@ -28,8 +28,9 @@ module.exports = (0, _definerule.defineRule)({
28
28
  isClientComponent = true;
29
29
  }
30
30
  if (block.type === "ExportDefaultDeclaration" && isClientComponent) {
31
+ var _block_declaration;
31
32
  // export default async function MyComponent() {...}
32
- if (block.declaration.type === "FunctionDeclaration" && block.declaration.async && isCapitalized(block.declaration.id.name)) {
33
+ if (((_block_declaration = block.declaration) === null || _block_declaration === void 0 ? void 0 : _block_declaration.type) === "FunctionDeclaration" && block.declaration.async && isCapitalized(block.declaration.id.name)) {
33
34
  context.report({
34
35
  node: block,
35
36
  message: message
@@ -37,16 +38,34 @@ module.exports = (0, _definerule.defineRule)({
37
38
  }
38
39
  // async function MyComponent() {...}; export default MyComponent;
39
40
  if (block.declaration.type === "Identifier" && isCapitalized(block.declaration.name)) {
40
- var functionName = block.declaration.name;
41
+ var targetName = block.declaration.name;
41
42
  var functionDeclaration = node.body.find(function(localBlock) {
42
- return localBlock.type === "FunctionDeclaration" && localBlock.id.name === functionName;
43
+ if (localBlock.type === "FunctionDeclaration" && localBlock.id.name === targetName) return true;
44
+ if (localBlock.type === "VariableDeclaration" && localBlock.declarations.find(function(declaration) {
45
+ var _declaration_id;
46
+ return ((_declaration_id = declaration.id) === null || _declaration_id === void 0 ? void 0 : _declaration_id.type) === "Identifier" && declaration.id.name === targetName;
47
+ })) return true;
48
+ return false;
43
49
  });
44
- if (functionDeclaration.type === "FunctionDeclaration" && functionDeclaration.async) {
50
+ if ((functionDeclaration === null || functionDeclaration === void 0 ? void 0 : functionDeclaration.type) === "FunctionDeclaration" && functionDeclaration.async) {
45
51
  context.report({
46
52
  node: functionDeclaration,
47
53
  message: message
48
54
  });
49
55
  }
56
+ if ((functionDeclaration === null || functionDeclaration === void 0 ? void 0 : functionDeclaration.type) === "VariableDeclaration") {
57
+ var _varDeclarator_init;
58
+ var varDeclarator = functionDeclaration.declarations.find(function(declaration) {
59
+ var _declaration_id;
60
+ return ((_declaration_id = declaration.id) === null || _declaration_id === void 0 ? void 0 : _declaration_id.type) === "Identifier" && declaration.id.name === targetName;
61
+ });
62
+ if ((varDeclarator === null || varDeclarator === void 0 ? void 0 : (_varDeclarator_init = varDeclarator.init) === null || _varDeclarator_init === void 0 ? void 0 : _varDeclarator_init.type) === "ArrowFunctionExpression" && varDeclarator.init.async) {
63
+ context.report({
64
+ node: functionDeclaration,
65
+ message: message
66
+ });
67
+ }
68
+ }
50
69
  }
51
70
  }
52
71
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next/eslint-plugin-next",
3
- "version": "13.4.8-canary.8",
3
+ "version": "13.4.8",
4
4
  "description": "ESLint plugin for NextJS.",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",