'use strict';
import { createEslintRule } from '@flint/infra/create-eslint-rule';
import { getTSTypeReferenceNames, isNameMatch, hasSuffix, nodeTypes, isIdentifier, isFunctionExpression, isMethodDefinition } from '@flint/infra/analysis';
import { namingConstants } from '@flint/infra/constants/naming-constants';

var __defProp=Object['defineProperty'],__name=(_0x29533b,_0x2fd94a)=>__defProp(_0x29533b,'name',{'value':_0x2fd94a,'configurable':!![]});const ruleName='must-use-suffix-config-instead-of-options';const ruleContent='\x0a###\x20**Must**\x20use\x20suffix\x20Config\x20instead\x20of\x20Options\x0a\x0a####\x20Wrong\x0a\x0ainterface\x20FooOptions\x20{\x0a\x20\x20\x20\x20bar:\x20string;\x0a}\x0a\x0aconst\x20options:\x20FooOptions\x20=\x20{\x20bar:\x20\x27baz\x27\x20};\x0a\x0aexport\x20async\x20function\x20foo(options:\x20FooOptions)\x20{\x20...\x20}\x0a\x0a####\x20Correct\x0a\x0ainterface\x20FooConfig\x20{\x0a\x20\x20\x20\x20bar:\x20string;\x0a}\x0a\x0aconst\x20fooConfig:\x20FooConfig\x20=\x20{\x20bar:\x20\x27baz\x27\x20};\x0a\x0aexport\x20async\x20function\x20foo(config:\x20FooConfig)\x20{\x20...\x20}\x0a\x0a####\x20Why\x0a\x0aTo\x20maintain\x20a\x20unified\x20naming\x20convention\x20and\x20clearly\x20distinguish\x20configuration\x20from\x20generic\x20options.';var mustUseSuffixConfigInsteadOfOptions = createEslintRule(ruleName,ruleContent,__name(function create(_0x30b03c){const _0x43a4d6=new Set();function _0x6f35b(_0x1c95a6){const _0x3bafb8=getTSTypeReferenceNames(_0x1c95a6['typeAnnotation']?.['typeAnnotation']),_0x5332ac=isNameMatch(_0x1c95a6,'options')||hasSuffix(_0x1c95a6,namingConstants['suffixOptions']);for(const _0x4fd5ab of _0x3bafb8){hasSuffix(_0x4fd5ab,namingConstants['suffixOptions'])&&!_0x43a4d6['has'](_0x4fd5ab['name'])&&_0x30b03c['report']({'node':_0x4fd5ab,'messageId':ruleName});}const _0x478ce8=_0x3bafb8['some'](_0x57d43f=>!_0x43a4d6['has'](_0x57d43f['name'])&&(hasSuffix(_0x57d43f,namingConstants['suffixConfig'])||hasSuffix(_0x57d43f,namingConstants['suffixOptions'])));_0x5332ac&&_0x478ce8&&_0x30b03c['report']({'node':_0x1c95a6,'messageId':ruleName});}return __name(_0x6f35b,'checkId'),{[nodeTypes['importDeclaration']]({specifiers:_0x392326}){for(const _0x458a4b of _0x392326){_0x43a4d6['add'](_0x458a4b['local']['name']);}},[nodeTypes['TSInterfaceDeclaration']+',\x20'+nodeTypes['TSTypeAliasDeclaration']](_0x549107){if(!_0x549107['id']||!isIdentifier(_0x549107['id']))return;hasSuffix(_0x549107['id'],namingConstants['suffixOptions'])&&_0x30b03c['report']({'node':_0x549107['id'],'messageId':ruleName});},[nodeTypes['functionDeclaration']+',\x20'+nodeTypes['arrowFunctionExpression']+',\x20'+nodeTypes['methodDefinition']+',\x20'+nodeTypes['functionExpression']](_0x41ff62){if(isFunctionExpression(_0x41ff62)&&isMethodDefinition(_0x41ff62['parent']))return;const _0x19e79f=isMethodDefinition(_0x41ff62)?_0x41ff62['value']['params']:_0x41ff62['params'];for(const _0x17c1cf of _0x19e79f){isIdentifier(_0x17c1cf)&&_0x6f35b(_0x17c1cf),_0x17c1cf['type']===nodeTypes['assignmentPattern']&&isIdentifier(_0x17c1cf['left'])&&_0x6f35b(_0x17c1cf['left']);}},[nodeTypes['variableDeclarator']](_0x3ff5fd){isIdentifier(_0x3ff5fd['id'])&&_0x6f35b(_0x3ff5fd['id']);}};},'create'));

export { mustUseSuffixConfigInsteadOfOptions as default, ruleName };
