'use strict';
import { nodeTypes, isIdentifier, isStringLiteral } from '@flint/infra/analysis';
import { createEslintRule } from '@flint/infra/create-eslint-rule';
import { eslintProperties } from '@flint/infra/constants/rules-meta';
import { flintRuleIdentifiers } from '@flint/infra/constants/shared-string-identifiers';
import { firstOrUndefined } from '../../../fd-toolbox/server/collections/single-funcs.js';

var __defProp=Object['defineProperty'],__name=(_0x3643e7,_0x579dd7)=>__defProp(_0x3643e7,'name',{'value':_0x579dd7,'configurable':!![]});const ruleName='must-use-create-eslint-rule';const forbiddenImports=new Set([flintRuleIdentifiers['ruleCreator'],'ESLintUtils']),ruleContent='\x0a###\x20**Must**\x20use\x20createEslintRule\x20utility\x20to\x20create\x20ESLint\x20rules.\x20Bulk\x20import\x20of\x20@typescript-eslint/utils\x20is\x20not\x20allowed.\x0a\x0a####\x20Wrong\x0a\x0aimport\x20{\x20ESLintUtils\x20}\x20from\x20\x22@typescript-eslint/utils\x22;\x0a\x0aimport\x20{\x20RuleCreator\x20}\x20from\x20\x22@typescript-eslint/utils\x22;\x0a\x0aimport\x20*\x20as\x20Utils\x20from\x20\x22@typescript-eslint/utils\x22;\x0a\x0a####\x20Correct\x0a\x0aimport\x20{\x20createEslintRule\x20}\x20from\x20\x22@flint/infra/create-eslint-rule\x22;\x0a\x0aimport\x20{\x20getParserServices\x20}\x20from\x20\x22@typescript-eslint/utils\x22;\x0a\x0aimport\x20{\x20TSESTree\x20}\x20from\x20\x22@typescript-eslint/utils\x22;\x0a\x0a####\x20Why\x0a\x0aUsing\x20the\x20createEslintRule\x20utility\x20ensures\x20consistency\x20across\x20all\x20ESLint\x20rules\x20in\x20the\x20codebase,\x20simplifies\x20rule\x20creation,\x20reduces\x20boilerplate.';var mustUseCreateEslintRule = createEslintRule(ruleName,ruleContent,__name(function create(_0x276f8e){const _0x24ddf9='@typescript-eslint/utils';return {'ImportDeclaration'(_0x209f1e){const _0x96ad2=isStringLiteral(_0x209f1e['source'])?_0x209f1e['source']['value']:void(0x79*0x2+-0x228f*0x1+0x219d);if(_0x96ad2!==_0x24ddf9)return;_0x209f1e['specifiers']['forEach'](_0x209fad=>{_0x209fad['type']===nodeTypes['importSpecifier']&&isIdentifier(_0x209fad['imported'])&&forbiddenImports['has'](_0x209fad['imported']['name'])&&_0x276f8e['report']({'node':_0x209fad,'messageId':ruleName}),_0x209fad['type']===nodeTypes['importNamespaceSpecifier']&&_0x276f8e['report']({'node':_0x209fad,'messageId':ruleName});});},'VariableDeclarator'(_0x428db1){if(!_0x428db1['init']||_0x428db1['init']['type']!==nodeTypes['callExpression'])return;const _0x15584a=_0x428db1['init'];if(!isIdentifier(_0x15584a['callee'])||_0x15584a['callee']['name']!==eslintProperties['require'])return;const _0x1f9071=firstOrUndefined(_0x15584a['arguments']);if(_0x1f9071&&isStringLiteral(_0x1f9071)&&_0x1f9071['value']===_0x24ddf9){if(isIdentifier(_0x428db1['id']))_0x276f8e['report']({'node':_0x428db1['init'],'messageId':ruleName});else _0x428db1['id']['type']===nodeTypes['objectPattern']&&_0x428db1['id']['properties']['forEach'](_0x3dd68b=>{_0x3dd68b['type']===nodeTypes['property']&&isIdentifier(_0x3dd68b['key'])&&forbiddenImports['has'](_0x3dd68b['key']['name'])&&_0x276f8e['report']({'node':_0x3dd68b,'messageId':ruleName});});}}};},'create'));

export { mustUseCreateEslintRule as default, ruleName };
