'use strict';
import { nodeTypes } from '@flint/infra/analysis';
import { createEslintRule } from '@flint/infra/create-eslint-rule';
import { first, firstOrUndefined } from '../../../fd-toolbox/server/collections/single-funcs.js';

var __defProp=Object['defineProperty'],__name=(_0x15e2af,_0x468430)=>__defProp(_0x15e2af,'name',{'value':_0x468430,'configurable':!![]});const ruleName='use-function-without-parameter-shortcut';const ruleContent='\x0a###\x20**Must**\x20use\x20function\x20without\x20parameter\x20shortcut.\x0a\x0a####\x20Wrong\x0a\x0aconst\x20quux\x20=\x20baz((foo)\x20=>\x20bar(foo));\x0a\x0aconst\x20foo\x20=\x20[1,\x202,\x203].map((baz)\x20=>\x20bar(baz));\x0a\x0a<Button\x20onClick={(event)\x20=>\x20handleClick(event)}\x20/>\x0a\x0a####\x20Correct\x0a\x0aconst\x20quux\x20=\x20baz(bar);\x0a\x0aconst\x20foo\x20=\x20[1,\x202,\x203].map(bar);\x0a\x0a<Button\x20onClick={handleClick}\x20/>\x0a\x0a####\x20Why\x0a\x0aThis\x20contributes\x20to\x20improving\x20code\x20readability\x20and\x20reducing\x20its\x20size.',useFunctionWithoutParameterShortcut=createEslintRule(ruleName,ruleContent,_0x358df0=>{return {'ArrowFunctionExpression'(_0x5e8f31){checkFunction(_0x5e8f31,_0x358df0);},'FunctionExpression'(_0x118fe5){checkFunction(_0x118fe5,_0x358df0);}};});function isSingleIdentifierCall(_0x5d6d2f,_0x2b841d){let _0x199aec=![];const _0x1dcc4c=_0x5d6d2f['callee']['type']===nodeTypes['identifier'];if(_0x1dcc4c&&_0x5d6d2f['arguments']['length']===0xdc6+-0x16ee+0x929){const _0x3cdfcf=first(_0x5d6d2f['arguments']);_0x3cdfcf['type']===nodeTypes['identifier']&&_0x3cdfcf['name']===_0x2b841d&&(_0x199aec=!![]);}return _0x199aec;}__name(isSingleIdentifierCall,'isSingleIdentifierCall');function isReturnOfSingleCall(_0x34ecd2,_0x323ea4){let _0x41a110=![];if(_0x34ecd2['body']['length']===-0x173c+-0x7b5+0x1ef2){const _0x1316d0=first(_0x34ecd2['body']);if(_0x1316d0&&_0x1316d0['type']===nodeTypes['returnStatement']){const _0x1347b1=_0x1316d0['argument'];_0x1347b1&&_0x1347b1['type']===nodeTypes['callExpression']&&(_0x41a110=isSingleIdentifierCall(_0x1347b1,_0x323ea4));}}return _0x41a110;}__name(isReturnOfSingleCall,'isReturnOfSingleCall');function checkFunction(_0x4893e0,_0x1fadea){const _0x10b9ed=firstOrUndefined(_0x4893e0['params']);if(_0x4893e0['params']['length']!==-0x2468+0x408+0xacb*0x3||!_0x10b9ed||_0x10b9ed['type']!==nodeTypes['identifier'])return;const _0x23d0f0=_0x10b9ed['name'],_0x46f579=_0x4893e0['body'],_0x1f55a2=_0x46f579['type']===nodeTypes['callExpression']&&isSingleIdentifierCall(_0x46f579,_0x23d0f0),_0x106650=_0x46f579['type']===nodeTypes['blockStatement']&&_0x46f579['body']['length']===-0x6*0x504+-0x247*-0xb+-0x143*-0x4&&isReturnOfSingleCall(_0x46f579,_0x23d0f0);(_0x1f55a2||_0x106650)&&_0x1fadea['report']({'node':_0x4893e0,'messageId':ruleName});}__name(checkFunction,'checkFunction');

export { useFunctionWithoutParameterShortcut as default, ruleName };
