eslint-plugin-react-hooks
Advanced tools
Comparing version 4.1.1 to 4.1.2
@@ -24,6 +24,6 @@ /** @license React vundefined | ||
function V(a,c,b){c&&(a.optional?c.has(b)||c.set(b,!0):c.set(b,!1))} | ||
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){if("ChainExpression"!==a.type||a.computed)throw Error("Unsupported node type: "+a.type);a=a.expression;var b=W(a.object,c),d=W(a.property,null);b=b+"."+d;V(a,c,b);return b}b=W(a.object,c);d=W(a.property,null);b=b+"."+d;V(a,c,b);return b}b=W(a.object,c);d=W(a.property,null);b=b+"."+d;V(a,c,b);return b} | ||
function W(a,c){if("Identifier"===a.type||"JSXIdentifier"===a.type)return a=a.name,c&&c.set(a,!1),a;if("MemberExpression"!==a.type||a.computed){if("OptionalMemberExpression"!==a.type||a.computed){if("ChainExpression"!==a.type||a.computed)throw Error("Unsupported node type: "+a.type);a=a.expression;var b=W(a.object,c),d=W(a.property,null);b=b+"."+d;V(a,c,b);return b}b=W(a.object,c);d=W(a.property,null);b=b+"."+d;V(a,c,b);return b}b=W(a.object,c);d=W(a.property,null);b=b+"."+d;V(a,c,b);return b} | ||
function sa(a){return"MemberExpression"!==a.type||"Identifier"!==a.object.type||"React"!==a.object.name||"Identifier"!==a.property.type||a.computed?a:a.property} | ||
function ta(a,c){var b=sa(a);if("Identifier"!==b.type)return-1;switch(b.name){case "useEffect":case "useLayoutEffect":case "useCallback":case "useMemo":return 0;case "useImperativeHandle":return 1;default:if(b===a&&c&&c.additionalHooks){try{var d=W(b,null)}catch(e){if(/Unsupported node type/.test(e.message))return 0;throw e;}return c.additionalHooks.test(d)?0:-1}return-1}} | ||
function X(a,c){for(var b=[a],d=null;b.length;){d=b.shift();if("Identifier"===d.type&&d.name===c.name&&d.range[0]===c.range[0]&&d.range[1]===c.range[1])return d;if(pa(d,c)){a=0;for(var e=Object.entries(d);a<e.length;a++){var n=e[a],h=n[1];"parent"!==n[0]&&(ua(h)?(h.parent=d,b.push(h)):Array.isArray(h)&&h.forEach(function(a){ua(a)&&(a.parent=d,b.push(a))}))}}}return null} | ||
function X(a,c){for(var b=[a],d=null;b.length;){d=b.shift();if(("Identifier"===d.type||"JSXIdentifier"===d.type)&&d.type===c.type&&d.name===c.name&&d.range[0]===c.range[0]&&d.range[1]===c.range[1])return d;if(pa(d,c)){a=0;for(var e=Object.entries(d);a<e.length;a++){var n=e[a],h=n[1];"parent"!==n[0]&&(ua(h)?(h.parent=d,b.push(h)):Array.isArray(h)&&h.forEach(function(a){ua(a)&&(a.parent=d,b.push(a))}))}}}return null} | ||
function va(a){for(var c="",b=0;b<a.length;b++)c+=a[b],0===b&&2===a.length?c+=" and ":b===a.length-2&&2<a.length?c+=", and ":b<a.length-1&&(c+=", ");return c}function ua(a){return"object"===typeof a&&null!==a&&!Array.isArray(a)&&"string"===typeof a.type}function pa(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"}}}; | ||
@@ -30,0 +30,0 @@ 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=[],b=[];return{onCodePathSegmentStart:function(a){return b.push(a)},onCodePathSegmentEnd:function(){return b.pop()},onCodePathStart:function(){return c.push(new Map)},onCodePathEnd:function(b,e){function d(a,c){var f=d.cache,e=f.get(a.id);c=new Set(c);if(c.has(a.id)){f=[].concat(c); |
{ | ||
"name": "eslint-plugin-react-hooks", | ||
"description": "ESLint rules for React Hooks", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
Sorry, the diff of this file is too big to display
116269