'use strict';
import { createEslintRule } from '@flint/infra/create-eslint-rule';
import { getFileName, nodeTypes, isStringLiteral, isTemplateLiteral } from '@flint/infra/analysis';
import _0x1869d0__default from 'path';
import { fileBaseNames } from '../../../base-repo/constants/internal-common-strings.js';
import { variableDeclarationKinds } from '@flint/infra/analysis/module-analysis';
import { eslintRuleSyntax } from '@flint/infra/constants/eslint-rule-syntax';
import { first } from '../../../fd-toolbox/server/collections/single-funcs.js';

const ruleName='must-match-rule-name-with-file-name';const ruleContent='\x0a###\x20**Must**\x20match\x20rule\x20name\x20with\x20file\x20name.\x0a\x0a####\x20Wrong\x0a\x0a//\x20file:\x20\x22foo.ts\x22\x0aexport\x20const\x20ruleName\x20=\x20\x22baz\x22;\x0a\x0a####\x20Correct\x0a\x0a//\x20file:\x20\x22foo.ts\x22\x0aexport\x20const\x20ruleName\x20=\x20\x22foo\x22;\x0a\x0a####\x20Why\x0a\x0aEnforces\x20a\x20single\x20source\x20of\x20truth\x20for\x20ESLint\x20rule\x20names.';var mustMatchRuleNameWithFileName = createEslintRule(ruleName,ruleContent,_0x46cb6c=>{const _0x592aab=[];return {'ExportNamedDeclaration'(_0xb13339){_0xb13339['declaration']&&_0xb13339['declaration']['type']===nodeTypes['variableDeclaration']&&_0x592aab['push'](_0xb13339['declaration']);},[eslintRuleSyntax['programExitSelector']](_0x3e3951){const _0xd8b550=getFileName(_0x46cb6c['filename'],_0x1869d0__default['extname'](_0x46cb6c['filename']));if(_0xd8b550===fileBaseNames['index'])return;const _0xc66873=[];for(const _0x5f5d0b of _0x592aab){_0x5f5d0b['kind']===variableDeclarationKinds['const']&&_0xc66873['push'](..._0x5f5d0b['declarations']);}const _0x3f8f4b=_0xc66873['find'](_0x5767d6=>{return _0x5767d6['id']['type']===nodeTypes['identifier']&&_0x5767d6['id']['name']===eslintRuleSyntax['ruleName'];});let _0x4dfd87;if(!_0x3f8f4b?.['init'])_0x4dfd87=_0x3e3951;else {const _0x58b5bd=_0x3f8f4b['init'];let _0x5c303f;if(isStringLiteral(_0x58b5bd))_0x5c303f=_0x58b5bd['value'];else isTemplateLiteral(_0x58b5bd)&&_0x58b5bd['expressions']['length']===0xb2*0x35+-0x1*-0x2367+-0x4841&&(_0x5c303f=first(_0x58b5bd['quasis'])?.['value']['cooked']);_0x5c303f!==_0xd8b550&&(_0x4dfd87=_0x3f8f4b);}_0x4dfd87&&_0x46cb6c['report']({'node':_0x4dfd87,'messageId':ruleName});}};});

export { mustMatchRuleNameWithFileName as default, ruleName };
