'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { createNodeVisitor, nodeTypes } from '@flint/infra/analysis';
import { url, ruleTypes } from '@flint/infra/constants/rules-meta';
import { firstOrUndefined } from '../../../fd-toolbox/server/collections/single-funcs.js';

var __defProp=Object['defineProperty'],__name=(_0x3882d7,_0x222d83)=>__defProp(_0x3882d7,'name',{'value':_0x222d83,'configurable':!![]});const ruleName='no-default-props';const messageId='noDefaultProps',createRule=ESLintUtils['RuleCreator'](_0x596e59=>''+url+_0x596e59),noDefaultProps=createRule({'name':ruleName,'meta':{'type':ruleTypes['problem'],'docs':{'description':'Disallow\x20default\x20values\x20in\x20props\x20destructuring;\x20use\x20optional\x20props\x20instead.'},'messages':{[messageId]:ruleName+'\x0aParameters\x20\x27{{param}}\x27\x20has\x20a\x20default\x20value\x20in\x20destructuring.\x0a\x0a###\x20**Must**\x20use\x20operator\x20\x22?\x22\x20for\x20props\x20instead\x20of\x20default\x20values\x20in\x20props\x20destructuring.\x0a\x0a####\x20Wrong\x0a\x0ainterface\x20FooProps\x20{\x0a\x20\x20\x20\x20bar:\x20string;\x0a}\x0a\x0aexport\x20function\x20Foo({bar\x20=\x22default\x22}:\x20FooProps)\x20{…}\x0a\x0a####\x20Correct\x0a\x0ainterface\x20FooProps\x20{\x0a\x20\x20\x20\x20bar?:\x20string;\x0a}\x0a\x0aexport\x20function\x20Foo({bar}:\x20FooProps)\x20{…}\x0a\x0a####\x20Why\x0a\x0aUsing\x20the\x20optional\x20chaining\x20operator\x20(?)\x20for\x20props\x20makes\x20the\x20code\x20more\x20readable\x20and\x20aligns\x20with\x20TypeScript\x20best\x20practices,\x20avoiding\x20unnecessary\x20default\x20values\x20in\x20the\x20destructuring.'},'schema':[]},'create'(_0x1975e4){return {...createNodeVisitor(_0x450881=>checkFunctionParamsForDefaults(_0x450881,_0x1975e4),[nodeTypes['functionDeclaration'],nodeTypes['arrowFunctionExpression']])};},'defaultOptions':[]});function checkFunctionParamsForDefaults(_0x68b80,_0x3bb78c){if(!firstOrUndefined(_0x68b80['params']))return;for(const _0x513efa of _0x68b80['params']){let _0x2c0afb=[];if(_0x513efa['type']===nodeTypes['objectPattern'])_0x2c0afb=_0x513efa['properties'],reportProblem(_0x68b80,_0x2c0afb,_0x3bb78c);else _0x513efa['type']===nodeTypes['assignmentPattern']&&_0x513efa['left']['type']===nodeTypes['objectPattern']&&(_0x2c0afb=_0x513efa['left']['properties'],reportProblem(_0x68b80,_0x2c0afb,_0x3bb78c));}}__name(checkFunctionParamsForDefaults,'checkFunctionParamsForDefaults');function reportProblem(_0x1d24c5,_0x39ad11,_0x2a5178){const _0x2fdf00=[];for(const _0x4acd1d of _0x39ad11){if(_0x4acd1d['type']!==nodeTypes['restElement']&&_0x4acd1d['type']===nodeTypes['property']&&_0x4acd1d['value']['type']===nodeTypes['assignmentPattern']&&_0x4acd1d['key']['type']===nodeTypes['identifier']){const _0x49af77=_0x4acd1d['value']['left']['type']===nodeTypes['identifier']?_0x4acd1d['value']['left']['name']:_0x4acd1d['key']['name'];_0x2fdf00['push'](_0x49af77);}}_0x2fdf00['length']>-0x1a72+-0x11f4+0x1633*0x2&&_0x2a5178['report']({'node':_0x1d24c5,'messageId':messageId,'data':{'param':_0x2fdf00['join'](',\x20')}});}__name(reportProblem,'reportProblem');

export { noDefaultProps as default, ruleName };
