'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { nodeTypes } from '@flint/infra/analysis';
import { ruleTypes, url } from '@flint/infra/constants/rules-meta';

var __defProp=Object['defineProperty'],__name=(_0x3314dd,_0x3d0343)=>__defProp(_0x3314dd,'name',{'value':_0x3d0343,'configurable':!![]});const ruleName='must-use-func-declaration-for-named-func';const constants={'messageIds':{'mustUseFuncDeclarationForNamedFunc':'mustUseFuncDeclarationForNamedFunc'},'meta':{'type':ruleTypes['suggestion'],'docs':{'description':'Enforce\x20function\x20declarations\x20over\x20function\x20expressions.'},'messages':{'mustUseFuncDeclarationForNamedFunc':ruleName+'\x0a###\x20**Must**\x20use\x20function\x20declarations\x20instead\x20of\x20arrow\x20functions\x20for\x20named\x20functions.\x0a\x0a####\x20Wrong\x0a\x0aconst\x20getUser\x20=\x20async\x20function\x20()\x20{}\x0a\x0aconst\x20getData\x20=\x20async\x20()\x20=>\x20{}\x0a\x0a####\x20Correct\x0a\x0aasync\x20function\x20getUser()\x20{}\x0a\x0aasync\x20function\x20getData()\x20{}\x0a\x0a####\x20Why\x0a\x0aUse\x20function\x20declarations\x20instead\x20of\x20arrow\x20functions\x20with\x20constants\x20when\x20defining\x20named\x20functions\x20for\x20better\x20readability,\x20debugging,\x20and\x20consistent\x20code\x20style.'},'schema':[]}},createRule=ESLintUtils['RuleCreator'](_0x1f6c56=>''+url+_0x1f6c56),mustUseFuncDeclarationForNamedFunc=createRule({'name':ruleName,'meta':constants['meta'],'defaultOptions':[],'create'(_0x466941){return {'VariableDeclarator'(_0x4410ca){if(_0x4410ca['id']['type']!==nodeTypes['identifier']||!_0x4410ca['init']||!containsForbiddenFunction(_0x4410ca['init']))return;const _0x5cde30=_0x4410ca['parent']?.['parent'];if(!_0x5cde30||_0x5cde30['type']!==nodeTypes['program']&&_0x5cde30['type']!==nodeTypes['exportNamedDeclaration'])return;_0x466941['report']({'node':_0x4410ca,'messageId':constants['messageIds']['mustUseFuncDeclarationForNamedFunc']});}};}});function containsForbiddenFunction(_0x32622d){let _0x5c7063=![];return (_0x32622d['type']===nodeTypes['arrowFunctionExpression']||_0x32622d['type']===nodeTypes['functionExpression'])&&(_0x5c7063=!![]),_0x32622d['type']===nodeTypes['conditionalExpression']&&(_0x5c7063=containsForbiddenFunction(_0x32622d['consequent'])||containsForbiddenFunction(_0x32622d['alternate'])),_0x32622d['type']===nodeTypes['logicalExpression']&&(_0x5c7063=containsForbiddenFunction(_0x32622d['left'])||containsForbiddenFunction(_0x32622d['right'])),_0x5c7063;}__name(containsForbiddenFunction,'containsForbiddenFunction');

export { mustUseFuncDeclarationForNamedFunc as default, ruleName };
