eslint-plugin-react-hooks 4.1.0-rc.0 → 4.1.0

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.
@@ -1,4 +1,4 @@
1
- /** @license React v4.1.0-rc.0
1
+ /** @license React vundefined
2
2
  * eslint-plugin-react-hooks.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -926,7 +926,7 @@ var ExhaustiveDeps = {
926
926
  if (isEffect && node.async) {
927
927
  reportProblem({
928
928
  node: node,
929
- message: "Effect callbacks are synchronous to prevent race conditions. " + "Put the async function inside:\n\n" + 'useEffect(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + 'Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching'
929
+ message: "Effect callbacks are synchronous to prevent race conditions. " + "Put the async function inside:\n\n" + 'useEffect(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + 'Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching'
930
930
  });
931
931
  } // Get the current scope.
932
932
 
@@ -1508,38 +1508,44 @@ var ExhaustiveDeps = {
1508
1508
  var problemCount = duplicateDependencies.size + missingDependencies.size + unnecessaryDependencies.size;
1509
1509
 
1510
1510
  if (problemCount === 0) {
1511
- // If nothing else to report, check if some callbacks
1512
- // are bare and would invalidate on every render.
1513
- var bareFunctions = scanForDeclaredBareFunctions({
1511
+ // If nothing else to report, check if some dependencies would
1512
+ // invalidate on every render.
1513
+ var constructions = scanForConstructions({
1514
1514
  declaredDependencies: declaredDependencies,
1515
1515
  declaredDependenciesNode: declaredDependenciesNode,
1516
1516
  componentScope: componentScope,
1517
1517
  scope: scope
1518
1518
  });
1519
- bareFunctions.forEach(function (_ref4) {
1520
- var fn = _ref4.fn,
1521
- suggestUseCallback = _ref4.suggestUseCallback;
1522
- var message = "The '" + fn.name.name + "' function makes the dependencies of " + (reactiveHookName + " Hook (at line " + declaredDependenciesNode.loc.start.line + ") ") + "change on every render.";
1523
-
1524
- if (suggestUseCallback) {
1525
- message += " To fix this, " + ("wrap the '" + fn.name.name + "' definition into its own useCallback() Hook.");
1526
- } else {
1527
- message += " Move it inside the " + reactiveHookName + " callback. " + ("Alternatively, wrap the '" + fn.name.name + "' definition into its own useCallback() Hook.");
1528
- }
1529
-
1530
- var suggest; // Only handle the simple case: arrow functions.
1519
+ constructions.forEach(function (_ref4) {
1520
+ var construction = _ref4.construction,
1521
+ isUsedOutsideOfHook = _ref4.isUsedOutsideOfHook,
1522
+ depType = _ref4.depType;
1523
+ var wrapperHook = depType === 'function' ? 'useCallback' : 'useMemo';
1524
+ var constructionType = depType === 'function' ? 'definition' : 'initialization';
1525
+ var defaultAdvice = "wrap the " + constructionType + " of '" + construction.name.name + "' in its own " + wrapperHook + "() Hook.";
1526
+ var advice = isUsedOutsideOfHook ? "To fix this, " + defaultAdvice : "Move it inside the " + reactiveHookName + " callback. Alternatively, " + defaultAdvice;
1527
+ var causation = depType === 'conditional' || depType === 'logical expression' ? 'could make' : 'makes';
1528
+ var message = "The '" + construction.name.name + "' " + depType + " " + causation + " the dependencies of " + (reactiveHookName + " Hook (at line " + declaredDependenciesNode.loc.start.line + ") ") + ("change on every render. " + advice);
1529
+ var suggest; // Only handle the simple case of variable assignments.
1531
1530
  // Wrapping function declarations can mess up hoisting.
1532
1531
 
1533
- if (suggestUseCallback && fn.type === 'Variable') {
1532
+ if (isUsedOutsideOfHook && construction.type === 'Variable' && // Objects may be mutated ater construction, which would make this
1533
+ // fix unsafe. Functions _probably_ won't be mutated, so we'll
1534
+ // allow this fix for them.
1535
+ depType === 'function') {
1534
1536
  suggest = [{
1535
- desc: "Wrap the '" + fn.name.name + "' definition into its own useCallback() Hook.",
1537
+ desc: "Wrap the " + constructionType + " of '" + construction.name.name + "' in its own " + wrapperHook + "() Hook.",
1536
1538
  fix: function (fixer) {
1539
+ var _ref5 = wrapperHook === 'useMemo' ? ["useMemo(() => { return ", '; })'] : ['useCallback(', ')'],
1540
+ before = _ref5[0],
1541
+ after = _ref5[1];
1542
+
1537
1543
  return [// TODO: also add an import?
1538
- fixer.insertTextBefore(fn.node.init, 'useCallback('), // TODO: ideally we'd gather deps here but it would require
1544
+ fixer.insertTextBefore(construction.node.init, before), // TODO: ideally we'd gather deps here but it would require
1539
1545
  // restructuring the rule code. This will cause a new lint
1540
1546
  // error to appear immediately for useCallback. Note we're
1541
1547
  // not adding [] because would that changes semantics.
1542
- fixer.insertTextAfter(fn.node.init, ')')];
1548
+ fixer.insertTextAfter(construction.node.init, after)];
1543
1549
  }
1544
1550
  }];
1545
1551
  } // TODO: What if the function needs to change on every render anyway?
@@ -1548,7 +1554,7 @@ var ExhaustiveDeps = {
1548
1554
 
1549
1555
  reportProblem({
1550
1556
  // TODO: Why not report this at the dependency site?
1551
- node: fn.node,
1557
+ node: construction.node,
1552
1558
  message: message,
1553
1559
  suggest: suggest
1554
1560
  });
@@ -1847,12 +1853,12 @@ var ExhaustiveDeps = {
1847
1853
  }
1848
1854
  }; // The meat of the logic.
1849
1855
 
1850
- function collectRecommendations(_ref5) {
1851
- var dependencies = _ref5.dependencies,
1852
- declaredDependencies = _ref5.declaredDependencies,
1853
- stableDependencies = _ref5.stableDependencies,
1854
- externalDependencies = _ref5.externalDependencies,
1855
- isEffect = _ref5.isEffect;
1856
+ function collectRecommendations(_ref6) {
1857
+ var dependencies = _ref6.dependencies,
1858
+ declaredDependencies = _ref6.declaredDependencies,
1859
+ stableDependencies = _ref6.stableDependencies,
1860
+ externalDependencies = _ref6.externalDependencies,
1861
+ isEffect = _ref6.isEffect;
1856
1862
  // Our primary data structure.
1857
1863
  // It is a logical representation of property chains:
1858
1864
  // `props` -> `props.foo` -> `props.foo.bar` -> `props.foo.bar.baz`
@@ -1888,8 +1894,8 @@ function collectRecommendations(_ref5) {
1888
1894
  }); // Mark all satisfied nodes.
1889
1895
  // Imagine checkmarks next to each declared dependency.
1890
1896
 
1891
- declaredDependencies.forEach(function (_ref6) {
1892
- var key = _ref6.key;
1897
+ declaredDependencies.forEach(function (_ref7) {
1898
+ var key = _ref7.key;
1893
1899
  var node = getOrCreateNodeByPath(depTree, key);
1894
1900
  node.isSatisfiedRecursively = true;
1895
1901
  });
@@ -2011,8 +2017,8 @@ function collectRecommendations(_ref5) {
2011
2017
  var suggestedDependencies = [];
2012
2018
  var unnecessaryDependencies = new Set();
2013
2019
  var duplicateDependencies = new Set();
2014
- declaredDependencies.forEach(function (_ref7) {
2015
- var key = _ref7.key;
2020
+ declaredDependencies.forEach(function (_ref8) {
2021
+ var key = _ref8.key;
2016
2022
 
2017
2023
  // Does this declared dep satisfy a real need?
2018
2024
  if (satisfyingDependencies.has(key)) {
@@ -2048,48 +2054,127 @@ function collectRecommendations(_ref5) {
2048
2054
  duplicateDependencies: duplicateDependencies,
2049
2055
  missingDependencies: missingDependencies
2050
2056
  };
2051
- } // Finds functions declared as dependencies
2057
+ } // If the node will result in constructing a referentially unique value, return
2058
+ // its human readable type name, else return null.
2059
+
2060
+
2061
+ function getConstructionExpressionType(node) {
2062
+ switch (node.type) {
2063
+ case 'ObjectExpression':
2064
+ return 'object';
2065
+
2066
+ case 'ArrayExpression':
2067
+ return 'array';
2068
+
2069
+ case 'ArrowFunctionExpression':
2070
+ case 'FunctionExpression':
2071
+ return 'function';
2072
+
2073
+ case 'ClassExpression':
2074
+ return 'class';
2075
+
2076
+ case 'ConditionalExpression':
2077
+ if (getConstructionExpressionType(node.consequent) != null || getConstructionExpressionType(node.alternate) != null) {
2078
+ return 'conditional';
2079
+ }
2080
+
2081
+ return null;
2082
+
2083
+ case 'LogicalExpression':
2084
+ if (getConstructionExpressionType(node.left) != null || getConstructionExpressionType(node.right) != null) {
2085
+ return 'logical expression';
2086
+ }
2087
+
2088
+ return null;
2089
+
2090
+ case 'JSXFragment':
2091
+ return 'JSX fragment';
2092
+
2093
+ case 'JSXElement':
2094
+ return 'JSX element';
2095
+
2096
+ case 'AssignmentExpression':
2097
+ if (getConstructionExpressionType(node.right) != null) {
2098
+ return 'assignment expression';
2099
+ }
2100
+
2101
+ return null;
2102
+
2103
+ case 'NewExpression':
2104
+ return 'object construction';
2105
+
2106
+ case 'Literal':
2107
+ if (node.value instanceof RegExp) {
2108
+ return 'regular expression';
2109
+ }
2110
+
2111
+ return null;
2112
+
2113
+ case 'TypeCastExpression':
2114
+ return getConstructionExpressionType(node.expression);
2115
+
2116
+ case 'TSAsExpression':
2117
+ return getConstructionExpressionType(node.expression);
2118
+ }
2119
+
2120
+ return null;
2121
+ } // Finds variables declared as dependencies
2052
2122
  // that would invalidate on every render.
2053
2123
 
2054
2124
 
2055
- function scanForDeclaredBareFunctions(_ref8) {
2056
- var declaredDependencies = _ref8.declaredDependencies,
2057
- declaredDependenciesNode = _ref8.declaredDependenciesNode,
2058
- componentScope = _ref8.componentScope,
2059
- scope = _ref8.scope;
2060
- var bareFunctions = declaredDependencies.map(function (_ref9) {
2061
- var key = _ref9.key;
2062
- var fnRef = componentScope.set.get(key);
2125
+ function scanForConstructions(_ref9) {
2126
+ var declaredDependencies = _ref9.declaredDependencies,
2127
+ declaredDependenciesNode = _ref9.declaredDependenciesNode,
2128
+ componentScope = _ref9.componentScope,
2129
+ scope = _ref9.scope;
2130
+ var constructions = declaredDependencies.map(function (_ref10) {
2131
+ var key = _ref10.key;
2132
+ var ref = componentScope.variables.find(function (v) {
2133
+ return v.name === key;
2134
+ });
2063
2135
 
2064
- if (fnRef == null) {
2136
+ if (ref == null) {
2065
2137
  return null;
2066
2138
  }
2067
2139
 
2068
- var fnNode = fnRef.defs[0];
2140
+ var node = ref.defs[0];
2069
2141
 
2070
- if (fnNode == null) {
2142
+ if (node == null) {
2071
2143
  return null;
2072
2144
  } // const handleChange = function () {}
2073
2145
  // const handleChange = () => {}
2146
+ // const foo = {}
2147
+ // const foo = []
2148
+ // etc.
2149
+
2074
2150
 
2151
+ if (node.type === 'Variable' && node.node.type === 'VariableDeclarator' && node.node.id.type === 'Identifier' && // Ensure this is not destructed assignment
2152
+ node.node.init != null) {
2153
+ var constantExpressionType = getConstructionExpressionType(node.node.init);
2075
2154
 
2076
- if (fnNode.type === 'Variable' && fnNode.node.type === 'VariableDeclarator' && fnNode.node.init != null && (fnNode.node.init.type === 'ArrowFunctionExpression' || fnNode.node.init.type === 'FunctionExpression')) {
2077
- return fnRef;
2155
+ if (constantExpressionType != null) {
2156
+ return [ref, constantExpressionType];
2157
+ }
2078
2158
  } // function handleChange() {}
2079
2159
 
2080
2160
 
2081
- if (fnNode.type === 'FunctionName' && fnNode.node.type === 'FunctionDeclaration') {
2082
- return fnRef;
2161
+ if (node.type === 'FunctionName' && node.node.type === 'FunctionDeclaration') {
2162
+ return [ref, 'function'];
2163
+ } // class Foo {}
2164
+
2165
+
2166
+ if (node.type === 'ClassName' && node.node.type === 'ClassDeclaration') {
2167
+ return [ref, 'class'];
2083
2168
  }
2084
2169
 
2085
2170
  return null;
2086
2171
  }).filter(Boolean);
2087
2172
 
2088
- function isUsedOutsideOfHook(fnRef) {
2173
+ function isUsedOutsideOfHook(ref) {
2089
2174
  var foundWriteExpr = false;
2090
2175
 
2091
- for (var i = 0; i < fnRef.references.length; i++) {
2092
- var reference = fnRef.references[i];
2176
+ for (var i = 0; i < ref.references.length; i++) {
2177
+ var reference = ref.references[i];
2093
2178
 
2094
2179
  if (reference.writeExpr) {
2095
2180
  if (foundWriteExpr) {
@@ -2120,10 +2205,13 @@ function scanForDeclaredBareFunctions(_ref8) {
2120
2205
  return false;
2121
2206
  }
2122
2207
 
2123
- return bareFunctions.map(function (fnRef) {
2208
+ return constructions.map(function (_ref11) {
2209
+ var ref = _ref11[0],
2210
+ depType = _ref11[1];
2124
2211
  return {
2125
- fn: fnRef.defs[0],
2126
- suggestUseCallback: isUsedOutsideOfHook(fnRef)
2212
+ construction: ref.defs[0],
2213
+ depType: depType,
2214
+ isUsedOutsideOfHook: isUsedOutsideOfHook(ref)
2127
2215
  };
2128
2216
  });
2129
2217
  }
@@ -1,4 +1,4 @@
1
- /** @license React v4.1.0-rc.0
1
+ /** @license React vundefined
2
2
  * eslint-plugin-react-hooks.production.min.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -6,52 +6,55 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- 'use strict';function O(a){if("Identifier"===a.type)return/^use[A-Z0-9].*$/.test(a.name);if("MemberExpression"===a.type&&!a.computed&&O(a.property)){a=a.object;var c=/^[A-Z].*/;return"Identifier"===a.type&&c.test(a.name)}return!1}function aa(a){return"Identifier"===a.type?!/^[a-z]/.test(a.name):!1}function ba(a,c){return a.name===c||"MemberExpression"===a.type&&"React"===a.object.name&&a.property.name===c}function ea(a){return!!(a.parent&&a.parent.callee&&ba(a.parent.callee,"forwardRef"))}
10
- function fa(a){return!!(a.parent&&a.parent.callee&&ba(a.parent.callee,"memo"))}function ha(a){for(;a;){var c=ia(a);if(c&&(aa(c)||O(c))||ea(a)||fa(a))return!0;a=a.parent}return!1}
11
- function ia(a){if("FunctionDeclaration"===a.type||"FunctionExpression"===a.type&&a.id)return a.id;if("FunctionExpression"===a.type||"ArrowFunctionExpression"===a.type)return"VariableDeclarator"===a.parent.type&&a.parent.init===a?a.parent.id:"AssignmentExpression"===a.parent.type&&a.parent.right===a&&"="===a.parent.operator?a.parent.left:"Property"!==a.parent.type||a.parent.value!==a||a.parent.computed?"AssignmentPattern"!==a.parent.type||a.parent.right!==a||a.parent.computed?void 0:a.parent.left:
9
+ 'use strict';function K(a){if("Identifier"===a.type)return/^use[A-Z0-9].*$/.test(a.name);if("MemberExpression"===a.type&&!a.computed&&K(a.property)){a=a.object;var b=/^[A-Z].*/;return"Identifier"===a.type&&b.test(a.name)}return!1}function ba(a){return"Identifier"===a.type?!/^[a-z]/.test(a.name):!1}function ca(a,b){return a.name===b||"MemberExpression"===a.type&&"React"===a.object.name&&a.property.name===b}function fa(a){return!!(a.parent&&a.parent.callee&&ca(a.parent.callee,"forwardRef"))}
10
+ function ha(a){return!!(a.parent&&a.parent.callee&&ca(a.parent.callee,"memo"))}function ia(a){for(;a;){var b=ja(a);if(b&&(ba(b)||K(b))||fa(a)||ha(a))return!0;a=a.parent}return!1}
11
+ function ja(a){if("FunctionDeclaration"===a.type||"FunctionExpression"===a.type&&a.id)return a.id;if("FunctionExpression"===a.type||"ArrowFunctionExpression"===a.type)return"VariableDeclarator"===a.parent.type&&a.parent.init===a?a.parent.id:"AssignmentExpression"===a.parent.type&&a.parent.right===a&&"="===a.parent.operator?a.parent.left:"Property"!==a.parent.type||a.parent.value!==a||a.parent.computed?"AssignmentPattern"!==a.parent.type||a.parent.right!==a||a.parent.computed?void 0:a.parent.left:
12
12
  a.parent.key}
13
- function ja(a){function c(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}function e(a,b){b=b.split(".");var m=!0,e=!1,f=void 0;try{for(var d=b[Symbol.iterator](),h;!(m=(h=d.next()).done);m=!0){var y=h.value,l=a.children.get(y);l||(l=c(),a.children.set(y,l));a=l}}catch(K){e=!0,f=K}finally{try{m||null==d.return||d.return()}finally{if(e)throw f;}}return a}function h(a,c,b){c=c.split(".");var m=!0,e=!1,f=void 0;try{for(var d=c[Symbol.iterator](),h;!(m=(h=d.next()).done);m=
14
- !0){var l=a.children.get(h.value);if(!l)break;b(l);a=l}}catch(K){e=!0,f=K}finally{try{m||null==d.return||d.return()}finally{if(e)throw f;}}}function f(a,c,b,e){a.children.forEach(function(a,m){var d=e(m);a.isSatisfiedRecursively?a.isSubtreeUsed&&b.add(d):a.isUsed?c.add(d):f(a,c,b,function(a){return d+"."+a})})}var B=a.dependencies,k=a.declaredDependencies,q=a.stableDependencies,u=a.externalDependencies,v=a.isEffect,E=c();B.forEach(function(a,c){e(E,c).isUsed=!0;h(E,c,function(a){a.isSubtreeUsed=!0})});
15
- k.forEach(function(a){e(E,a.key).isSatisfiedRecursively=!0});q.forEach(function(a){e(E,a).isSatisfiedRecursively=!0});a=new Set;var d=new Set;f(E,a,d,function(a){return a});var b=[],l=new Set,w=new Set;k.forEach(function(a){a=a.key;d.has(a)?-1===b.indexOf(a)?b.push(a):w.add(a):!v||a.endsWith(".current")||u.has(a)?l.add(a):-1===b.indexOf(a)&&b.push(a)});a.forEach(function(a){b.push(a)});return{suggestedDependencies:b,unnecessaryDependencies:l,duplicateDependencies:w,missingDependencies:a}}
16
- function la(a){var c=a.declaredDependenciesNode,e=a.componentScope,h=a.scope;return a.declaredDependencies.map(function(a){a=e.set.get(a.key);if(null==a)return null;var c=a.defs[0];return null==c?null:"Variable"===c.type&&"VariableDeclarator"===c.node.type&&null!=c.node.init&&("ArrowFunctionExpression"===c.node.init.type||"FunctionExpression"===c.node.init.type)||"FunctionName"===c.type&&"FunctionDeclaration"===c.node.type?a:null}).filter(Boolean).map(function(a){var e=a.defs[0];a:{for(var f=!1,q=
17
- 0;q<a.references.length;q++){var u=a.references[q];if(u.writeExpr)if(f){a=!0;break a}else{f=!0;continue}for(var v=u.from;v!==h&&null!=v;)v=v.upper;if(v!==h&&!ma(c,u.identifier)){a=!0;break a}}a=!1}return{fn:e,suggestUseCallback:a}})}
18
- function na(a){return"MemberExpression"!==a.parent.type&&"OptionalMemberExpression"!==a.parent.type||a.parent.object!==a||"current"===a.parent.property.name||a.parent.computed||null!=a.parent.parent&&("CallExpression"===a.parent.parent.type||"OptionalCallExpression"===a.parent.parent.type)&&a.parent.parent.callee===a.parent?"MemberExpression"===a.type&&a.parent&&"AssignmentExpression"===a.parent.type&&a.parent.left===a?a.object:a:na(a.parent)}
19
- function W(a,c){if("Identifier"===a.type)return a=a.name,c&&c.set(a,!1),a;if("MemberExpression"!==a.type||a.computed){if("OptionalMemberExpression"!==a.type||a.computed)throw Error("Unsupported node type: "+a.type);var e=W(a.object,c),h=W(a.property,null);e=e+"."+h;c&&(a.optional?c.has(e)||c.set(e,!0):c.set(e,!1));return e}e=W(a.object,c);a=W(a.property,null);a=e+"."+a;c&&c.set(a,!1);return a}
20
- function oa(a){return"MemberExpression"!==a.type||"Identifier"!==a.object.type||"React"!==a.object.name||"Identifier"!==a.property.type||a.computed?a:a.property}
21
- function qa(a,c){var e=oa(a);if("Identifier"!==e.type)return-1;switch(e.name){case "useEffect":case "useLayoutEffect":case "useCallback":case "useMemo":return 0;case "useImperativeHandle":return 1;default:if(e===a&&c&&c.additionalHooks){try{var h=W(e,null)}catch(f){if(/Unsupported node type/.test(f.message))return 0;throw f;}return c.additionalHooks.test(h)?0:-1}return-1}}
22
- function ra(a,c){for(var e=[a],h=null;e.length;){h=e.shift();if("Identifier"===h.type&&h.name===c.name&&h.range[0]===c.range[0]&&h.range[1]===c.range[1])return h;if(ma(h,c)){a=0;for(var f=Object.entries(h);a<f.length;a++){var B=f[a],k=B[1];"parent"!==B[0]&&(sa(k)?(k.parent=h,e.push(k)):Array.isArray(k)&&k.forEach(function(a){sa(a)&&(a.parent=h,e.push(a))}))}}}return null}
23
- function ta(a){for(var c="",e=0;e<a.length;e++)c+=a[e],0===e&&2===a.length?c+=" and ":e===a.length-2&&2<a.length?c+=", and ":e<a.length-1&&(c+=", ");return c}function sa(a){return"object"===typeof a&&null!==a&&!Array.isArray(a)&&"string"===typeof a.type}function ma(a,c){return a.range[0]<=c.range[0]&&a.range[1]>=c.range[1]}exports.configs={recommended:{plugins:["react-hooks"],rules:{"react-hooks/rules-of-hooks":"error","react-hooks/exhaustive-deps":"warn"}}};
24
- exports.rules={"rules-of-hooks":{meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",category:"Possible Errors",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"}},create:function(a){var c=[],e=[];return{onCodePathSegmentStart:function(a){return e.push(a)},onCodePathSegmentEnd:function(){return e.pop()},onCodePathStart:function(){return c.push(new Map)},onCodePathEnd:function(e,f){function h(a,c){var b=h.cache,d=b.get(a.id);c=new Set(c);if(c.has(a.id)){b=[].concat(c);
25
- a=b.slice(b.indexOf(a.id)+1);b=!0;d=!1;var l=void 0;try{for(var f=a[Symbol.iterator](),g;!(b=(g=f.next()).done);b=!0)v.add(g.value)}catch(G){d=!0,l=G}finally{try{b||null==f.return||f.return()}finally{if(d)throw l;}}return 0}c.add(a.id);if(void 0!==d)return d;if(e.thrownSegments.includes(a))d=0;else if(0===a.prevSegments.length)d=1;else{d=0;f=!0;g=!1;var L=void 0;try{l=a.prevSegments[Symbol.iterator]();for(var M;!(f=(M=l.next()).done);f=!0)d+=h(M.value,c)}catch(G){g=!0,L=G}finally{try{f||null==l.return||
26
- l.return()}finally{if(g)throw L;}}}a.reachable&&0===d?b.delete(a.id):b.set(a.id,d);return d}function k(a,c){var d=k.cache,b=d.get(a.id);c=new Set(c);if(c.has(a.id)){d=Array.from(c);a=d.slice(d.indexOf(a.id)+1);d=!0;b=!1;var f=void 0;try{for(var l=a[Symbol.iterator](),g;!(d=(g=l.next()).done);d=!0)v.add(g.value)}catch(G){b=!0,f=G}finally{try{d||null==l.return||l.return()}finally{if(b)throw f;}}return 0}c.add(a.id);if(void 0!==b)return b;if(e.thrownSegments.includes(a))b=0;else if(0===a.nextSegments.length)b=
27
- 1;else{b=0;l=!0;g=!1;var L=void 0;try{f=a.nextSegments[Symbol.iterator]();for(var M;!(l=(M=f.next()).done);l=!0)b+=k(M.value,c)}catch(G){g=!0,L=G}finally{try{l||null==f.return||f.return()}finally{if(g)throw L;}}}d.set(a.id,b);return b}function q(a){var c=q.cache,b=c.get(a.id);if(null===b)return Infinity;if(void 0!==b)return b;c.set(a.id,null);if(0===a.prevSegments.length)b=1;else{b=Infinity;var d=!0,e=!1,l=void 0;try{for(var g=a.prevSegments[Symbol.iterator](),L;!(d=(L=g.next()).done);d=!0){var M=
28
- q(L.value);M<b&&(b=M)}}catch(G){e=!0,l=G}finally{try{d||null==g.return||g.return()}finally{if(e)throw l;}}b+=1}c.set(a.id,b);return b}var u=c.pop();if(0!==u.size){var v=new Set;h.cache=new Map;k.cache=new Map;q.cache=new Map;var E=k(e.initialSegment),d=ia(f),b=ha(f),l=d?aa(d)||O(d):ea(f)||fa(f),w=Infinity,m=!0,y=!1,J=void 0;try{for(var A=e.finalSegments[Symbol.iterator](),p;!(m=(p=A.next()).done);m=!0){var ka=p.value;if(ka.reachable){var z=q(ka);z<w&&(w=z)}}}catch(F){y=!0,J=F}finally{try{m||null==
29
- A.return||A.return()}finally{if(y)throw J;}}m=!0;y=!1;J=void 0;try{for(var r=u[Symbol.iterator](),T;!(m=(T=r.next()).done);m=!0){var K=T.value,C=K[0],x=K[1];if(C.reachable){var Y=0===C.nextSegments.length?w<=q(C):w<q(C),V=h(C)*k(C),P=v.has(C.id);u=!0;A=!1;p=void 0;try{for(var H=x[Symbol.iterator](),N;!(u=(N=H.next()).done);u=!0){var n=N.value;P&&a.report({node:n,message:'React Hook "'+a.getSource(n)+'" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.'});
30
- if(l){if(!P&&V!==E){var D='React Hook "'+a.getSource(n)+'" is called conditionally. React Hooks must be called in the exact same order in every component render.'+(Y?" Did you accidentally call a React Hook after an early return?":"");a.report({node:n,message:D})}}else if(f.parent&&("MethodDefinition"===f.parent.type||"ClassProperty"===f.parent.type)&&f.parent.value===f){var Z='React Hook "'+a.getSource(n)+'" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.';
31
- a.report({node:n,message:Z})}else if(d){var R='React Hook "'+a.getSource(n)+'" is called in function "'+(a.getSource(d)+'" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter.');a.report({node:n,message:R})}else if("Program"===f.type){var S='React Hook "'+a.getSource(n)+'" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.';a.report({node:n,message:S})}else if(b){var I=
32
- 'React Hook "'+a.getSource(n)+'" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.';a.report({node:n,message:I})}}}catch(F){A=!0,p=F}finally{try{u||null==H.return||H.return()}finally{if(A)throw p;}}}}}catch(F){y=!0,J=F}finally{try{m||null==r.return||r.return()}finally{if(y)throw J;}}}},CallExpression:function(a){if(O(a.callee)){var f=c[c.length-1],h=e[e.length-1],k=f.get(h);k||(k=[],f.set(h,k));k.push(a.callee)}}}}},"exhaustive-deps":{meta:{type:"suggestion",
33
- docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",category:"Best Practices",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",schema:[{type:"object",additionalProperties:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create:function(a){function c(c){f&&Array.isArray(c.suggest)&&0<c.suggest.length&&(c.fix=
34
- c.suggest[0].fix);a.report(c)}function e(a,c){return function(b){if(c.has(b))return c.get(b);var d=a(b);c.set(b,d);return d}}function h(d,b,f,h,m){function l(a){var c=!0,g=!1,b=void 0;try{for(var f=a.references[Symbol.iterator](),e;!(c=(e=f.next()).done);c=!0){var h=e.value;if(h.resolved&&B.has(h.resolved.scope)){var n=ra(d,h.identifier),k=na(n),w=W(k,Y),y;if(y=m&&"Identifier"===k.type&&("MemberExpression"===k.parent.type||"OptionalMemberExpression"===k.parent.type)&&!k.parent.computed&&"Identifier"===
35
- k.parent.property.type&&"current"===k.parent.property.name){for(var p=h.from,r=!1;p.block!==d;)"function"===p.type&&(r=null!=p.block.parent&&"ReturnStatement"===p.block.parent.type),p=p.upper;y=r}y&&C.set(w,{reference:h,dependencyNode:k});if("TSTypeQuery"!==k.parent.type){var q=h.resolved.defs[0];if(null!=q&&(null==q.node||q.node.init!==d.parent)&&"TypeParameter"!==q.type)if(x.has(w))x.get(w).references.push(h);else{var t=h.resolved,u=T(t)||K(t);x.set(w,{isStable:u,references:[h]})}}}}}catch(da){g=
36
- !0,b=da}finally{try{c||null==f.return||f.return()}finally{if(g)throw b;}}c=!0;g=!1;b=void 0;try{for(var v=a.childScopes[Symbol.iterator](),J;!(c=(J=v.next()).done);c=!0)l(J.value)}catch(da){g=!0,b=da}finally{try{c||null==v.return||v.return()}finally{if(g)throw b;}}}function w(a){a=a.split(".");for(var c="",g=0;g<a.length;g++){if(0!==g){var b=a.slice(0,g+1).join(".");b=!0===Y.get(b);c+=b?"?.":"."}c+=a[g]}return c}function A(a,c,b,d){return 0===a.size?null:(1<a.size?"":c+" ")+b+" "+(1<a.size?"dependencies":
37
- "dependency")+": "+ta(Array.from(a).sort().map(function(a){return"'"+w(a)+"'"}))+(". Either "+d+" "+(1<a.size?"them":"it")+" or remove the dependency array.")}m&&d.async&&c({node:d,message:"Effect callbacks are synchronous to prevent race conditions. Put the async function inside:\n\nuseEffect(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching"});
38
- for(var p=k.acquire(d),B=new Set,z=null,r=p.upper;r;){B.add(r);if("function"===r.type)break;r=r.upper}if(r){z=r;var T=e(function(a){if(!Array.isArray(a.defs))return!1;var c=a.defs[0];if(null==c||"VariableDeclarator"!==c.node.type)return!1;var b=c.node.init;if(null==b)return!1;for(;"TSAsExpression"===b.type;)b=b.expression;var g=c.node.parent;if(null==g&&(ra(z.block,c.node.id),g=c.node.parent,null==g))return!1;if("const"===g.kind&&"Literal"===b.type&&("string"===typeof b.value||"number"===typeof b.value||
39
- null===b.value))return!0;if("CallExpression"!==b.type)return!1;b=b.callee;"MemberExpression"!==b.type||"React"!==b.object.name||null==b.property||b.computed||(b=b.property);if("Identifier"!==b.type)return!1;c=c.node.id;b=b.name;if("useRef"===b&&"Identifier"===c.type)return!0;if(("useState"===b||"useReducer"===b)&&"ArrayPattern"===c.type&&2===c.elements.length&&Array.isArray(a.identifiers)){if(c.elements[1]===a.identifiers[0]){if("useState"===b)for(a=a.references,b=0;b<a.length;b++)q.set(a[b].identifier,
40
- c.elements[0]);return!0}if(c.elements[0]===a.identifiers[0]&&"useState"===b)for(a=a.references,c=0;c<a.length;c++)u.add(a[c].identifier)}return!1},v),K=e(function(a){if(!Array.isArray(a.defs))return!1;a=a.defs[0];if(null==a||null==a.node||null==a.node.id)return!1;var c=a.node,b=z.childScopes;a=null;var g;for(g=0;g<b.length;g++){var d=b[g],f=d.block;if("FunctionDeclaration"===c.type&&f===c||"VariableDeclarator"===c.type&&f.parent===c){a=d;break}}if(null==a)return!1;for(g=0;g<a.through.length;g++)if(c=
41
- a.through[g],null!=c.resolved&&B.has(c.resolved.scope)&&!T(c.resolved))return!1;return!0},E),C=new Map,x=new Map,Y=new Map;l(p);C.forEach(function(a,b){var g=a.dependencyNode;a=a.reference.resolved.references;for(var d=!1,f=0;f<a.length;f++){var e=a[f].identifier.parent;if(null!=e&&"MemberExpression"===e.type&&!e.computed&&"Identifier"===e.property.type&&"current"===e.property.name&&"AssignmentExpression"===e.parent.type&&e.parent.left===e){d=!0;break}}d||c({node:g.parent.property,message:"The ref value '"+
42
- b+".current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '"+(b+".current' to a variable inside the effect, and use that variable in the cleanup function.")})});var V=new Set,P=new Set;x.forEach(function(b,d){var g=b.references;b.isStable&&P.add(d);g.forEach(function(b){b.writeExpr&&(b=b.writeExpr,V.has(d)||(V.add(d),c({node:b,message:"Assignments to the '"+d+"' variable from inside React Hook "+(a.getSource(f)+" will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ")+
43
- (a.getSource(f)+".")})))})});if(!(0<V.size))if(b){var H=[],N=new Set;"ArrayExpression"!==b.type?c({node:b,message:"React Hook "+a.getSource(f)+" was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies."}):b.elements.forEach(function(b){if(null!==b)if("SpreadElement"===b.type)c({node:b,message:"React Hook "+a.getSource(f)+" has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies."});
44
- else{try{var d=W(b,null)}catch(pa){if(/Unsupported node type/.test(pa.message)){"Literal"===b.type?x.has(b.value)?c({node:b,message:"The "+b.raw+" literal is not a valid dependency because it never changes. Did you mean to include "+(b.value+" in the array instead?")}):c({node:b,message:"The "+b.raw+" literal is not a valid dependency because it never changes. You can safely remove it."}):c({node:b,message:"React Hook "+a.getSource(f)+" has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked."});
45
- return}throw pa;}for(var g=b;"MemberExpression"===g.type||"OptionalMemberExpression"===g.type;)g=g.object;var e=!z.through.some(function(a){return a.identifier===g});H.push({key:d,node:b});e||N.add(d)}});var n=ja({dependencies:x,declaredDependencies:H,stableDependencies:P,externalDependencies:N,isEffect:m});r=n.unnecessaryDependencies;var D=n.missingDependencies,Z=n.duplicateDependencies,R=n.suggestedDependencies;if(0===Z.size+D.size+r.size)la({declaredDependencies:H,declaredDependenciesNode:b,componentScope:z,
46
- scope:p}).forEach(function(a){var d=a.fn;a=a.suggestUseCallback;var g="The '"+d.name.name+"' function makes the dependencies of "+(h+" Hook (at line "+b.loc.start.line+") change on every render.");g=a?g+(" To fix this, wrap the '"+(d.name.name+"' definition into its own useCallback() Hook.")):g+(" Move it inside the "+h+" callback. Alternatively, wrap the '"+(d.name.name+"' definition into its own useCallback() Hook."));var e;a&&"Variable"===d.type&&(e=[{desc:"Wrap the '"+d.name.name+"' definition into its own useCallback() Hook.",
47
- fix:function(a){return[a.insertTextBefore(d.node.init,"useCallback("),a.insertTextAfter(d.node.init,")")]}}]);c({node:d.node,message:g,suggest:e})});else{!m&&0<D.size&&(R=ja({dependencies:x,declaredDependencies:[],stableDependencies:P,externalDependencies:N,isEffect:m}).suggestedDependencies);(function(){if(0===H.length)return!0;var a=H.map(function(a){return a.key}),b=a.slice().sort();return a.join(",")===b.join(",")})()&&R.sort();n="";if(0<r.size){var S=null;Array.from(r.keys()).forEach(function(a){null===
48
- S&&a.endsWith(".current")&&(S=a)});if(null!==S)n=" Mutable values like '"+S+"' aren't valid dependencies because mutating them doesn't re-render the component.";else if(0<N.size){var I=Array.from(N)[0];p.set.has(I)||(n=" Outer scope values like '"+I+"' aren't valid dependencies because mutating them doesn't re-render the component.")}}if(!n&&D.has("props")){p=x.get("props");if(null==p)return;p=p.references;if(!Array.isArray(p))return;I=!0;for(var F=0;F<p.length;F++){var Q=ra(z.block,p[F].identifier);
49
- if(!Q){I=!1;break}Q=Q.parent;if(null==Q){I=!1;break}if("MemberExpression"!==Q.type&&"OptionalMemberExpression"!==Q.type){I=!1;break}}I&&(n=" However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the "+(h+" call and refer to those specific props inside ")+(a.getSource(f)+"."))}if(!n&&0<D.size){var X=null;D.forEach(function(a){if(!X){var b=z.set.get(a),c=x.get(a);if(c.references[0].resolved===b&&(b=b.defs[0],null!=b&&null!=b.name&&
50
- "Parameter"===b.type)){b=!1;for(var d,e=0;e<c.references.length;e++)if(d=c.references[e].identifier,null!=d&&null!=d.parent&&("CallExpression"===d.parent.type||"OptionalCallExpression"===d.parent.type)&&d.parent.callee===d){b=!0;break}b&&(X=a)}}});null!==X&&(n=" If '"+X+"' changes too often, find the parent component that defines it and wrap that definition in useCallback.")}if(!n&&0<D.size){var t=null;D.forEach(function(a){if(null===t)for(var b=x.get(a).references,c,d,e=0;e<b.length;e++){c=b[e].identifier;
51
- for(d=c.parent;null!=d&&d!==z.block;){if("CallExpression"===d.type){var f=q.get(d.callee);if(null!=f){f.name===a?t={missingDep:a,setter:d.callee.name,form:"updater"}:u.has(c)?t={missingDep:a,setter:d.callee.name,form:"reducer"}:(c=b[e].resolved,null!=c&&(c=c.defs[0],null!=c&&"Parameter"===c.type&&(t={missingDep:a,setter:d.callee.name,form:"inlineReducer"})));break}}d=d.parent}if(null!==t)break}});if(null!==t)switch(t.form){case "reducer":n=" You can also replace multiple useState variables with useReducer if '"+
52
- (t.setter+"' needs the current value of '")+(t.missingDep+"'.");break;case "inlineReducer":n=" If '"+t.setter+"' needs the current value of '"+(t.missingDep+"', you can also switch to useReducer instead of useState and read '")+(t.missingDep+"' in the reducer.");break;case "updater":n=" You can also do a functional update '"+t.setter+"("+t.missingDep.substring(0,1)+" => ...)' if you only need '"+t.missingDep+"' in the '"+(t.setter+"' call.");break;default:throw Error("Unknown case.");}}c({node:b,
53
- message:"React Hook "+a.getSource(f)+" has "+(A(D,"a","missing","include")||A(r,"an","unnecessary","exclude")||A(Z,"a","duplicate","omit"))+n,suggest:[{desc:"Update the dependencies array to be: ["+R.map(w).join(", ")+"]",fix:function(a){return a.replaceText(b,"["+R.map(w).join(", ")+"]")}}]})}}else{var U=null;x.forEach(function(a,b){U||a.references.forEach(function(a){if(!U&&q.has(a.identifier)){for(a=a.from;"function"!==a.type;)a=a.upper;a.block===d&&(U=b)}})});if(U){var ca=ja({dependencies:x,declaredDependencies:[],
54
- stableDependencies:P,externalDependencies:new Set,isEffect:!0}).suggestedDependencies;c({node:f,message:"React Hook "+h+" contains a call to '"+U+"'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass ["+ca.join(", ")+("] as a second argument to the "+h+" Hook."),suggest:[{desc:"Add dependencies array: ["+ca.join(", ")+"]",fix:function(a){return a.insertTextAfter(d,", ["+ca.join(", ")+"]")}}]})}}}}var f=a.options&&a.options[0]&&a.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||
55
- !1,B={additionalHooks:a.options&&a.options[0]&&a.options[0].additionalHooks?new RegExp(a.options[0].additionalHooks):void 0,enableDangerousAutofixThisMayCauseInfiniteLoops:f},k=a.getSourceCode().scopeManager,q=new WeakMap,u=new WeakSet,v=new WeakMap,E=new WeakMap;return{CallExpression:function(d){var b=qa(d.callee,B);if(-1!==b){var e=d.arguments[b],f=d.callee,m=oa(f).name,k=d.arguments[b+1];d=/Effect($|[^a-z])/g.test(m);if(k||d){switch(e.type){case "FunctionExpression":case "ArrowFunctionExpression":h(e,
56
- k,f,m,d);return;case "Identifier":if(!k||k.elements&&k.elements.some(function(a){return a&&"Identifier"===a.type&&a.name===e.name}))return;b=a.getScope().set.get(e.name);if(null==b||null==b.defs)return;b=b.defs[0];if(!b||!b.node)break;if("Variable"!==b.type&&"FunctionName"!==b.type)break;switch(b.node.type){case "FunctionDeclaration":h(b.node,k,f,m,d);return;case "VariableDeclarator":if(b=b.node.init)switch(b.type){case "ArrowFunctionExpression":case "FunctionExpression":h(b,k,f,m,d);return}}break;
57
- default:c({node:f,message:"React Hook "+m+" received a function whose dependencies are unknown. Pass an inline function instead."});return}c({node:f,message:"React Hook "+m+" has a missing dependency: '"+e.name+"'. Either include it or remove the dependency array.",suggest:[{desc:"Update the dependencies array to be: ["+e.name+"]",fix:function(a){return a.replaceText(k,"["+e.name+"]")}}]})}else"useMemo"!==m&&"useCallback"!==m||c({node:f,message:"React Hook "+m+" does nothing when called with only one argument. Did you forget to pass an array of dependencies?"})}}}}}};
13
+ function ka(a){function b(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}function e(a,c){c=c.split(".");var l=!0,e=!1,h=void 0;try{for(var d=c[Symbol.iterator](),k;!(l=(k=d.next()).done);l=!0){var f=k.value,x=a.children.get(f);x||(x=b(),a.children.set(f,x));a=x}}catch(J){e=!0,h=J}finally{try{l||null==d.return||d.return()}finally{if(e)throw h;}}return a}function f(a,b,c){b=b.split(".");var l=!0,e=!1,h=void 0;try{for(var d=b[Symbol.iterator](),k;!(l=(k=d.next()).done);l=
14
+ !0){var f=a.children.get(k.value);if(!f)break;c(f);a=f}}catch(J){e=!0,h=J}finally{try{l||null==d.return||d.return()}finally{if(e)throw h;}}}function h(a,b,c,e){a.children.forEach(function(a,l){var d=e(l);a.isSatisfiedRecursively?a.isSubtreeUsed&&c.add(d):a.isUsed?b.add(d):h(a,b,c,function(a){return d+"."+a})})}var y=a.dependencies,k=a.declaredDependencies,t=a.stableDependencies,u=a.externalDependencies,A=a.isEffect,r=b();y.forEach(function(a,b){e(r,b).isUsed=!0;f(r,b,function(a){a.isSubtreeUsed=!0})});
15
+ k.forEach(function(a){e(r,a.key).isSatisfiedRecursively=!0});t.forEach(function(a){e(r,a).isSatisfiedRecursively=!0});a=new Set;var d=new Set;h(r,a,d,function(a){return a});var c=[],B=new Set,v=new Set;k.forEach(function(a){a=a.key;d.has(a)?-1===c.indexOf(a)?c.push(a):v.add(a):!A||a.endsWith(".current")||u.has(a)?B.add(a):-1===c.indexOf(a)&&c.push(a)});a.forEach(function(a){c.push(a)});return{suggestedDependencies:c,unnecessaryDependencies:B,duplicateDependencies:v,missingDependencies:a}}
16
+ function O(a){switch(a.type){case "ObjectExpression":return"object";case "ArrayExpression":return"array";case "ArrowFunctionExpression":case "FunctionExpression":return"function";case "ClassExpression":return"class";case "ConditionalExpression":if(null!=O(a.consequent)||null!=O(a.alternate))return"conditional";break;case "LogicalExpression":if(null!=O(a.left)||null!=O(a.right))return"logical expression";break;case "JSXFragment":return"JSX fragment";case "JSXElement":return"JSX element";case "AssignmentExpression":if(null!=
17
+ O(a.right))return"assignment expression";break;case "NewExpression":return"object construction";case "Literal":if(a.value instanceof RegExp)return"regular expression";break;case "TypeCastExpression":return O(a.expression);case "TSAsExpression":return O(a.expression)}return null}
18
+ function ma(a){var b=a.declaredDependenciesNode,e=a.componentScope,f=a.scope;return a.declaredDependencies.map(function(a){var b=a.key;a=e.variables.find(function(a){return a.name===b});if(null==a)return null;var f=a.defs[0];if(null==f)return null;if("Variable"===f.type&&"VariableDeclarator"===f.node.type&&"Identifier"===f.node.id.type&&null!=f.node.init){var h=O(f.node.init);if(null!=h)return[a,h]}return"FunctionName"===f.type&&"FunctionDeclaration"===f.node.type?[a,"function"]:"ClassName"===f.type&&
19
+ "ClassDeclaration"===f.node.type?[a,"class"]:null}).filter(Boolean).map(function(a){var e=a[0];a=a[1];var h=e.defs[0];a:{for(var t=!1,u=0;u<e.references.length;u++){var A=e.references[u];if(A.writeExpr)if(t){e=!0;break a}else{t=!0;continue}for(var r=A.from;r!==f&&null!=r;)r=r.upper;if(r!==f&&!na(b,A.identifier)){e=!0;break a}}e=!1}return{construction:h,depType:a,isUsedOutsideOfHook:e}})}
20
+ function oa(a){return"MemberExpression"!==a.parent.type&&"OptionalMemberExpression"!==a.parent.type||a.parent.object!==a||"current"===a.parent.property.name||a.parent.computed||null!=a.parent.parent&&("CallExpression"===a.parent.parent.type||"OptionalCallExpression"===a.parent.parent.type)&&a.parent.parent.callee===a.parent?"MemberExpression"===a.type&&a.parent&&"AssignmentExpression"===a.parent.type&&a.parent.left===a?a.object:a:oa(a.parent)}
21
+ function X(a,b){if("Identifier"===a.type)return a=a.name,b&&b.set(a,!1),a;if("MemberExpression"!==a.type||a.computed){if("OptionalMemberExpression"!==a.type||a.computed)throw Error("Unsupported node type: "+a.type);var e=X(a.object,b),f=X(a.property,null);e=e+"."+f;b&&(a.optional?b.has(e)||b.set(e,!0):b.set(e,!1));return e}e=X(a.object,b);a=X(a.property,null);a=e+"."+a;b&&b.set(a,!1);return a}
22
+ function pa(a){return"MemberExpression"!==a.type||"Identifier"!==a.object.type||"React"!==a.object.name||"Identifier"!==a.property.type||a.computed?a:a.property}
23
+ function ra(a,b){var e=pa(a);if("Identifier"!==e.type)return-1;switch(e.name){case "useEffect":case "useLayoutEffect":case "useCallback":case "useMemo":return 0;case "useImperativeHandle":return 1;default:if(e===a&&b&&b.additionalHooks){try{var f=X(e,null)}catch(h){if(/Unsupported node type/.test(h.message))return 0;throw h;}return b.additionalHooks.test(f)?0:-1}return-1}}
24
+ function sa(a,b){for(var e=[a],f=null;e.length;){f=e.shift();if("Identifier"===f.type&&f.name===b.name&&f.range[0]===b.range[0]&&f.range[1]===b.range[1])return f;if(na(f,b)){a=0;for(var h=Object.entries(f);a<h.length;a++){var y=h[a],k=y[1];"parent"!==y[0]&&(ta(k)?(k.parent=f,e.push(k)):Array.isArray(k)&&k.forEach(function(a){ta(a)&&(a.parent=f,e.push(a))}))}}}return null}
25
+ function ua(a){for(var b="",e=0;e<a.length;e++)b+=a[e],0===e&&2===a.length?b+=" and ":e===a.length-2&&2<a.length?b+=", and ":e<a.length-1&&(b+=", ");return b}function ta(a){return"object"===typeof a&&null!==a&&!Array.isArray(a)&&"string"===typeof a.type}function na(a,b){return a.range[0]<=b.range[0]&&a.range[1]>=b.range[1]}exports.configs={recommended:{plugins:["react-hooks"],rules:{"react-hooks/rules-of-hooks":"error","react-hooks/exhaustive-deps":"warn"}}};
26
+ exports.rules={"rules-of-hooks":{meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",category:"Possible Errors",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"}},create:function(a){var b=[],e=[];return{onCodePathSegmentStart:function(a){return e.push(a)},onCodePathSegmentEnd:function(){return e.pop()},onCodePathStart:function(){return b.push(new Map)},onCodePathEnd:function(e,h){function f(a,b){var c=f.cache,d=c.get(a.id);b=new Set(b);if(b.has(a.id)){c=[].concat(b);
27
+ a=c.slice(c.indexOf(a.id)+1);c=!0;d=!1;var h=void 0;try{for(var l=a[Symbol.iterator](),g;!(c=(g=l.next()).done);c=!0)A.add(g.value)}catch(F){d=!0,h=F}finally{try{c||null==l.return||l.return()}finally{if(d)throw h;}}return 0}b.add(a.id);if(void 0!==d)return d;if(e.thrownSegments.includes(a))d=0;else if(0===a.prevSegments.length)d=1;else{d=0;l=!0;g=!1;var L=void 0;try{h=a.prevSegments[Symbol.iterator]();for(var M;!(l=(M=h.next()).done);l=!0)d+=f(M.value,b)}catch(F){g=!0,L=F}finally{try{l||null==h.return||
28
+ h.return()}finally{if(g)throw L;}}}a.reachable&&0===d?c.delete(a.id):c.set(a.id,d);return d}function k(a,b){var d=k.cache,c=d.get(a.id);b=new Set(b);if(b.has(a.id)){d=Array.from(b);a=d.slice(d.indexOf(a.id)+1);d=!0;c=!1;var f=void 0;try{for(var h=a[Symbol.iterator](),g;!(d=(g=h.next()).done);d=!0)A.add(g.value)}catch(F){c=!0,f=F}finally{try{d||null==h.return||h.return()}finally{if(c)throw f;}}return 0}b.add(a.id);if(void 0!==c)return c;if(e.thrownSegments.includes(a))c=0;else if(0===a.nextSegments.length)c=
29
+ 1;else{c=0;h=!0;g=!1;var L=void 0;try{f=a.nextSegments[Symbol.iterator]();for(var M;!(h=(M=f.next()).done);h=!0)c+=k(M.value,b)}catch(F){g=!0,L=F}finally{try{h||null==f.return||f.return()}finally{if(g)throw L;}}}d.set(a.id,c);return c}function t(a){var b=t.cache,c=b.get(a.id);if(null===c)return Infinity;if(void 0!==c)return c;b.set(a.id,null);if(0===a.prevSegments.length)c=1;else{c=Infinity;var d=!0,e=!1,f=void 0;try{for(var g=a.prevSegments[Symbol.iterator](),L;!(d=(L=g.next()).done);d=!0){var M=
30
+ t(L.value);M<c&&(c=M)}}catch(F){e=!0,f=F}finally{try{d||null==g.return||g.return()}finally{if(e)throw f;}}c+=1}b.set(a.id,c);return c}var u=b.pop();if(0!==u.size){var A=new Set;f.cache=new Map;k.cache=new Map;t.cache=new Map;var r=k(e.initialSegment),d=ja(h),c=ia(h),B=d?ba(d)||K(d):fa(h)||ha(h),v=Infinity,l=!0,x=!1,I=void 0;try{for(var Q=e.finalSegments[Symbol.iterator](),p;!(l=(p=Q.next()).done);l=!0){var la=p.value;if(la.reachable){var z=t(la);z<v&&(v=z)}}}catch(E){x=!0,I=E}finally{try{l||null==
31
+ Q.return||Q.return()}finally{if(x)throw I;}}l=!0;x=!1;I=void 0;try{for(var n=u[Symbol.iterator](),U;!(l=(U=n.next()).done);l=!0){var J=U.value,C=J[0],w=J[1];if(C.reachable){var Z=0===C.nextSegments.length?v<=t(C):v<t(C),W=f(C)*k(C),P=A.has(C.id);u=!0;Q=!1;p=void 0;try{for(var G=w[Symbol.iterator](),N;!(u=(N=G.next()).done);u=!0){var m=N.value;P&&a.report({node:m,message:'React Hook "'+a.getSource(m)+'" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.'});
32
+ if(B){if(!P&&W!==r){var D='React Hook "'+a.getSource(m)+'" is called conditionally. React Hooks must be called in the exact same order in every component render.'+(Z?" Did you accidentally call a React Hook after an early return?":"");a.report({node:m,message:D})}}else if(h.parent&&("MethodDefinition"===h.parent.type||"ClassProperty"===h.parent.type)&&h.parent.value===h){var aa='React Hook "'+a.getSource(m)+'" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.';
33
+ a.report({node:m,message:aa})}else if(d){var S='React Hook "'+a.getSource(m)+'" is called in function "'+(a.getSource(d)+'" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter.');a.report({node:m,message:S})}else if("Program"===h.type){var T='React Hook "'+a.getSource(m)+'" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.';a.report({node:m,
34
+ message:T})}else if(c){var H='React Hook "'+a.getSource(m)+'" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.';a.report({node:m,message:H})}}}catch(E){Q=!0,p=E}finally{try{u||null==G.return||G.return()}finally{if(Q)throw p;}}}}}catch(E){x=!0,I=E}finally{try{l||null==n.return||n.return()}finally{if(x)throw I;}}}},CallExpression:function(a){if(K(a.callee)){var f=b[b.length-1],y=e[e.length-1],k=f.get(y);k||(k=[],f.set(y,k));
35
+ k.push(a.callee)}}}}},"exhaustive-deps":{meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",category:"Best Practices",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",schema:[{type:"object",additionalProperties:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create:function(a){function b(b){h&&
36
+ Array.isArray(b.suggest)&&0<b.suggest.length&&(b.fix=b.suggest[0].fix);a.report(b)}function e(a,b){return function(c){if(b.has(c))return b.get(c);var d=a(c);b.set(c,d);return d}}function f(d,c,f,h,l){function x(a){var g=!0,b=!1,c=void 0;try{for(var f=a.references[Symbol.iterator](),e;!(g=(e=f.next()).done);g=!0){var h=e.value;if(h.resolved&&y.has(h.resolved.scope)){var m=sa(d,h.identifier),k=oa(m),v=X(k,Z),p;if(p=l&&"Identifier"===k.type&&("MemberExpression"===k.parent.type||"OptionalMemberExpression"===
37
+ k.parent.type)&&!k.parent.computed&&"Identifier"===k.parent.property.type&&"current"===k.parent.property.name){for(var n=h.from,B=!1;n.block!==d;)"function"===n.type&&(B=null!=n.block.parent&&"ReturnStatement"===n.block.parent.type),n=n.upper;p=B}p&&C.set(v,{reference:h,dependencyNode:k});if("TSTypeQuery"!==k.parent.type){var q=h.resolved.defs[0];if(null!=q&&(null==q.node||q.node.init!==d.parent)&&"TypeParameter"!==q.type)if(w.has(v))w.get(v).references.push(h);else{var t=h.resolved,u=U(t)||J(t);
38
+ w.set(v,{isStable:u,references:[h]})}}}}}catch(ea){b=!0,c=ea}finally{try{g||null==f.return||f.return()}finally{if(b)throw c;}}g=!0;b=!1;c=void 0;try{for(var r=a.childScopes[Symbol.iterator](),I;!(g=(I=r.next()).done);g=!0)x(I.value)}catch(ea){b=!0,c=ea}finally{try{g||null==r.return||r.return()}finally{if(b)throw c;}}}function v(a){a=a.split(".");for(var g="",b=0;b<a.length;b++){if(0!==b){var c=a.slice(0,b+1).join(".");c=!0===Z.get(c);g+=c?"?.":"."}g+=a[b]}return g}function B(a,b,c,f){return 0===a.size?
39
+ null:(1<a.size?"":b+" ")+c+" "+(1<a.size?"dependencies":"dependency")+": "+ua(Array.from(a).sort().map(function(a){return"'"+v(a)+"'"}))+(". Either "+f+" "+(1<a.size?"them":"it")+" or remove the dependency array.")}l&&d.async&&b({node:d,message:"Effect callbacks are synchronous to prevent race conditions. Put the async function inside:\n\nuseEffect(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching"});
40
+ for(var p=k.acquire(d),y=new Set,z=null,n=p.upper;n;){y.add(n);if("function"===n.type)break;n=n.upper}if(n){z=n;var U=e(function(a){if(!Array.isArray(a.defs))return!1;var b=a.defs[0];if(null==b||"VariableDeclarator"!==b.node.type)return!1;var g=b.node.init;if(null==g)return!1;for(;"TSAsExpression"===g.type;)g=g.expression;var c=b.node.parent;if(null==c&&(sa(z.block,b.node.id),c=b.node.parent,null==c))return!1;if("const"===c.kind&&"Literal"===g.type&&("string"===typeof g.value||"number"===typeof g.value||
41
+ null===g.value))return!0;if("CallExpression"!==g.type)return!1;g=g.callee;"MemberExpression"!==g.type||"React"!==g.object.name||null==g.property||g.computed||(g=g.property);if("Identifier"!==g.type)return!1;b=b.node.id;g=g.name;if("useRef"===g&&"Identifier"===b.type)return!0;if(("useState"===g||"useReducer"===g)&&"ArrayPattern"===b.type&&2===b.elements.length&&Array.isArray(a.identifiers)){if(b.elements[1]===a.identifiers[0]){if("useState"===g)for(a=a.references,g=0;g<a.length;g++)t.set(a[g].identifier,
42
+ b.elements[0]);return!0}if(b.elements[0]===a.identifiers[0]&&"useState"===g)for(a=a.references,b=0;b<a.length;b++)u.add(a[b].identifier)}return!1},A),J=e(function(a){if(!Array.isArray(a.defs))return!1;a=a.defs[0];if(null==a||null==a.node||null==a.node.id)return!1;var b=a.node,g=z.childScopes;a=null;var c;for(c=0;c<g.length;c++){var f=g[c],d=f.block;if("FunctionDeclaration"===b.type&&d===b||"VariableDeclarator"===b.type&&d.parent===b){a=f;break}}if(null==a)return!1;for(c=0;c<a.through.length;c++)if(b=
43
+ a.through[c],null!=b.resolved&&y.has(b.resolved.scope)&&!U(b.resolved))return!1;return!0},r),C=new Map,w=new Map,Z=new Map;x(p);C.forEach(function(a,c){var g=a.dependencyNode;a=a.reference.resolved.references;for(var f=!1,d=0;d<a.length;d++){var e=a[d].identifier.parent;if(null!=e&&"MemberExpression"===e.type&&!e.computed&&"Identifier"===e.property.type&&"current"===e.property.name&&"AssignmentExpression"===e.parent.type&&e.parent.left===e){f=!0;break}}f||b({node:g.parent.property,message:"The ref value '"+
44
+ c+".current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '"+(c+".current' to a variable inside the effect, and use that variable in the cleanup function.")})});var W=new Set,P=new Set;w.forEach(function(c,d){var g=c.references;c.isStable&&P.add(d);g.forEach(function(c){c.writeExpr&&(c=c.writeExpr,W.has(d)||(W.add(d),b({node:c,message:"Assignments to the '"+d+"' variable from inside React Hook "+(a.getSource(f)+" will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ")+
45
+ (a.getSource(f)+".")})))})});if(!(0<W.size))if(c){var G=[],N=new Set;"ArrayExpression"!==c.type?b({node:c,message:"React Hook "+a.getSource(f)+" was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies."}):c.elements.forEach(function(c){if(null!==c)if("SpreadElement"===c.type)b({node:c,message:"React Hook "+a.getSource(f)+" has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies."});
46
+ else{try{var g=X(c,null)}catch(qa){if(/Unsupported node type/.test(qa.message)){"Literal"===c.type?w.has(c.value)?b({node:c,message:"The "+c.raw+" literal is not a valid dependency because it never changes. Did you mean to include "+(c.value+" in the array instead?")}):b({node:c,message:"The "+c.raw+" literal is not a valid dependency because it never changes. You can safely remove it."}):b({node:c,message:"React Hook "+a.getSource(f)+" has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked."});
47
+ return}throw qa;}for(var d=c;"MemberExpression"===d.type||"OptionalMemberExpression"===d.type;)d=d.object;var e=!z.through.some(function(a){return a.identifier===d});G.push({key:g,node:c});e||N.add(g)}});var m=ka({dependencies:w,declaredDependencies:G,stableDependencies:P,externalDependencies:N,isEffect:l});n=m.unnecessaryDependencies;var D=m.missingDependencies,aa=m.duplicateDependencies,S=m.suggestedDependencies;if(0===aa.size+D.size+n.size)ma({declaredDependencies:G,declaredDependenciesNode:c,
48
+ componentScope:z,scope:p}).forEach(function(a){var g=a.construction,d=a.isUsedOutsideOfHook;a=a.depType;var f="function"===a?"useCallback":"useMemo",e="function"===a?"definition":"initialization",l="wrap the "+e+" of '"+g.name.name+"' in its own "+f+"() Hook.";l="The '"+g.name.name+"' "+a+" "+("conditional"===a||"logical expression"===a?"could make":"makes")+" the dependencies of "+(h+" Hook (at line "+c.loc.start.line+") change on every render. ")+(d?"To fix this, "+l:"Move it inside the "+h+" callback. Alternatively, "+
49
+ l);var k;d&&"Variable"===g.type&&"function"===a&&(k=[{desc:"Wrap the "+e+" of '"+g.name.name+"' in its own "+f+"() Hook.",fix:function(a){var b="useMemo"===f?["useMemo(() => { return ","; })"]:["useCallback(",")"],c=b[1];return[a.insertTextBefore(g.node.init,b[0]),a.insertTextAfter(g.node.init,c)]}}]);b({node:g.node,message:l,suggest:k})});else{!l&&0<D.size&&(S=ka({dependencies:w,declaredDependencies:[],stableDependencies:P,externalDependencies:N,isEffect:l}).suggestedDependencies);(function(){if(0===
50
+ G.length)return!0;var a=G.map(function(a){return a.key}),b=a.slice().sort();return a.join(",")===b.join(",")})()&&S.sort();m="";if(0<n.size){var T=null;Array.from(n.keys()).forEach(function(a){null===T&&a.endsWith(".current")&&(T=a)});if(null!==T)m=" Mutable values like '"+T+"' aren't valid dependencies because mutating them doesn't re-render the component.";else if(0<N.size){var H=Array.from(N)[0];p.set.has(H)||(m=" Outer scope values like '"+H+"' aren't valid dependencies because mutating them doesn't re-render the component.")}}if(!m&&
51
+ D.has("props")){p=w.get("props");if(null==p)return;p=p.references;if(!Array.isArray(p))return;H=!0;for(var E=0;E<p.length;E++){var R=sa(z.block,p[E].identifier);if(!R){H=!1;break}R=R.parent;if(null==R){H=!1;break}if("MemberExpression"!==R.type&&"OptionalMemberExpression"!==R.type){H=!1;break}}H&&(m=" However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the "+(h+" call and refer to those specific props inside ")+(a.getSource(f)+
52
+ "."))}if(!m&&0<D.size){var Y=null;D.forEach(function(a){if(!Y){var b=z.set.get(a),c=w.get(a);if(c.references[0].resolved===b&&(b=b.defs[0],null!=b&&null!=b.name&&"Parameter"===b.type)){b=!1;for(var d,g=0;g<c.references.length;g++)if(d=c.references[g].identifier,null!=d&&null!=d.parent&&("CallExpression"===d.parent.type||"OptionalCallExpression"===d.parent.type)&&d.parent.callee===d){b=!0;break}b&&(Y=a)}}});null!==Y&&(m=" If '"+Y+"' changes too often, find the parent component that defines it and wrap that definition in useCallback.")}if(!m&&
53
+ 0<D.size){var q=null;D.forEach(function(a){if(null===q)for(var b=w.get(a).references,c,d,g=0;g<b.length;g++){c=b[g].identifier;for(d=c.parent;null!=d&&d!==z.block;){if("CallExpression"===d.type){var f=t.get(d.callee);if(null!=f){f.name===a?q={missingDep:a,setter:d.callee.name,form:"updater"}:u.has(c)?q={missingDep:a,setter:d.callee.name,form:"reducer"}:(c=b[g].resolved,null!=c&&(c=c.defs[0],null!=c&&"Parameter"===c.type&&(q={missingDep:a,setter:d.callee.name,form:"inlineReducer"})));break}}d=d.parent}if(null!==
54
+ q)break}});if(null!==q)switch(q.form){case "reducer":m=" You can also replace multiple useState variables with useReducer if '"+(q.setter+"' needs the current value of '")+(q.missingDep+"'.");break;case "inlineReducer":m=" If '"+q.setter+"' needs the current value of '"+(q.missingDep+"', you can also switch to useReducer instead of useState and read '")+(q.missingDep+"' in the reducer.");break;case "updater":m=" You can also do a functional update '"+q.setter+"("+q.missingDep.substring(0,1)+" => ...)' if you only need '"+
55
+ q.missingDep+"' in the '"+(q.setter+"' call.");break;default:throw Error("Unknown case.");}}b({node:c,message:"React Hook "+a.getSource(f)+" has "+(B(D,"a","missing","include")||B(n,"an","unnecessary","exclude")||B(aa,"a","duplicate","omit"))+m,suggest:[{desc:"Update the dependencies array to be: ["+S.map(v).join(", ")+"]",fix:function(a){return a.replaceText(c,"["+S.map(v).join(", ")+"]")}}]})}}else{var V=null;w.forEach(function(a,b){V||a.references.forEach(function(a){if(!V&&t.has(a.identifier)){for(a=
56
+ a.from;"function"!==a.type;)a=a.upper;a.block===d&&(V=b)}})});if(V){var da=ka({dependencies:w,declaredDependencies:[],stableDependencies:P,externalDependencies:new Set,isEffect:!0}).suggestedDependencies;b({node:f,message:"React Hook "+h+" contains a call to '"+V+"'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass ["+da.join(", ")+("] as a second argument to the "+h+" Hook."),suggest:[{desc:"Add dependencies array: ["+da.join(", ")+"]",fix:function(a){return a.insertTextAfter(d,
57
+ ", ["+da.join(", ")+"]")}}]})}}}}var h=a.options&&a.options[0]&&a.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,y={additionalHooks:a.options&&a.options[0]&&a.options[0].additionalHooks?new RegExp(a.options[0].additionalHooks):void 0,enableDangerousAutofixThisMayCauseInfiniteLoops:h},k=a.getSourceCode().scopeManager,t=new WeakMap,u=new WeakSet,A=new WeakMap,r=new WeakMap;return{CallExpression:function(d){var c=ra(d.callee,y);if(-1!==c){var e=d.arguments[c],h=d.callee,l=pa(h).name,
58
+ k=d.arguments[c+1];d=/Effect($|[^a-z])/g.test(l);if(k||d){switch(e.type){case "FunctionExpression":case "ArrowFunctionExpression":f(e,k,h,l,d);return;case "Identifier":if(!k||k.elements&&k.elements.some(function(a){return a&&"Identifier"===a.type&&a.name===e.name}))return;c=a.getScope().set.get(e.name);if(null==c||null==c.defs)return;c=c.defs[0];if(!c||!c.node)break;if("Variable"!==c.type&&"FunctionName"!==c.type)break;switch(c.node.type){case "FunctionDeclaration":f(c.node,k,h,l,d);return;case "VariableDeclarator":if(c=
59
+ c.node.init)switch(c.type){case "ArrowFunctionExpression":case "FunctionExpression":f(c,k,h,l,d);return}}break;default:b({node:h,message:"React Hook "+l+" received a function whose dependencies are unknown. Pass an inline function instead."});return}b({node:h,message:"React Hook "+l+" has a missing dependency: '"+e.name+"'. Either include it or remove the dependency array.",suggest:[{desc:"Update the dependencies array to be: ["+e.name+"]",fix:function(a){return a.replaceText(k,"["+e.name+"]")}}]})}else"useMemo"!==
60
+ l&&"useCallback"!==l||b({node:h,message:"React Hook "+l+" does nothing when called with only one argument. Did you forget to pass an array of dependencies?"})}}}}}};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-hooks",
3
3
  "description": "ESLint rules for React Hooks",
4
- "version": "4.1.0-rc.0",
4
+ "version": "4.1.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/facebook/react.git",
package/build-info.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "branch": "master",
3
- "buildNumber": "193044",
4
- "checksum": "38fb0e9",
5
- "commit": "94c0244ba",
6
- "environment": "ci",
7
- "reactVersion": "17.0.0-alpha.0-94c0244ba"
8
- }