'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { nodeTypes, getFileName } from '@flint/infra/analysis';
import { ruleRecommendationLevels, ruleTypes, url } from '@flint/infra/constants/rules-meta';
import { fileExtensions } from '../../../base-repo/app-constants/internal-system-constants.js';
import { flintRuleIdentifiers } from '@flint/infra/constants/shared-string-identifiers';

var __defProp=Object['defineProperty'],__name=(_0x45c2c3,_0x1a7970)=>__defProp(_0x45c2c3,'name',{'value':_0x1a7970,'configurable':!![]});const ruleName='must-use-filename-in-assert-functions';const constants={'messageIds':{'mustUseFilenameInAssertFunctions':'mustUseFilenameInAssertFunctions'},'meta':{'type':ruleTypes['problem'],'docs':{'description':'Assert\x20functions\x20must\x20use\x20filename\x20in\x20their\x20name.','recommended':ruleRecommendationLevels['error']},'messages':{'mustUseFilenameInAssertFunctions':'must-use-filename-in-assert-functions\x0a###\x20**Must**\x20use\x20filename\x20in\x20assert\x20functions.\x0a\x0a####\x20Wrong\x0a\x0a//table-asserts.ts\x0aexport\x20function\x20assertGetFoo()\x20{...}\x0a\x0a####\x20Correct\x0a\x0a//table-asserts.ts\x0aexport\x20function\x20assertTableGetFoo()\x20{...}\x0a\x0a####\x20Why\x0a\x0aThis\x20improves\x20clarity\x20and\x20helps\x20with\x20naming\x20conflicts.'},'schema':[]},'assertFunctionSubString':flintRuleIdentifiers['assert'],'assertStringsToRemove':['-asserts','-asserter','-']},createRule=ESLintUtils['RuleCreator'](_0x23b68d=>''+url+_0x23b68d),mustUseFilenameInAssertFunctions=createRule({'name':ruleName,'meta':constants['meta'],'defaultOptions':[],'create'(_0x5d20fe){return {'FunctionDeclaration'(_0x171e6f){_0x171e6f['id']?.['name']['toLowerCase']()['includes'](constants['assertFunctionSubString'])&&validateAssertFunctionName(_0x171e6f['id'],_0x5d20fe);},'VariableDeclarator'(_0x654879){_0x654879['id']['type']===nodeTypes['identifier']&&_0x654879['init']&&(_0x654879['init']['type']===nodeTypes['arrowFunctionExpression']||_0x654879['init']['type']===nodeTypes['functionExpression'])&&(_0x654879['id']['name']['toLowerCase']()['includes'](constants['assertFunctionSubString'])&&validateAssertFunctionName(_0x654879['id'],_0x5d20fe));}};}});function validateAssertFunctionName(_0x430c2d,_0x36f4f8){const _0x52835e=_0x430c2d['name'],_0x42be3d=getFileName(_0x36f4f8['filename'],fileExtensions['ts']),_0x31b451=constants['assertStringsToRemove']['reduce']((_0x13aa01,_0x5b9eb0)=>_0x13aa01['replace'](_0x5b9eb0,''),_0x42be3d);!_0x52835e['toLowerCase']()['includes'](_0x31b451)&&_0x36f4f8['report']({'node':_0x430c2d,'messageId':constants['messageIds']['mustUseFilenameInAssertFunctions'],'data':{'fileName':_0x42be3d}});}__name(validateAssertFunctionName,'validateAssertFunctionName');

export { mustUseFilenameInAssertFunctions as default, ruleName };
