'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { nodeTypes } from '@flint/infra/analysis';
import { url, eslintProperties, ruleTypes } from '@flint/infra/constants/rules-meta';

var __defProp=Object['defineProperty'],__name=(_0x26aece,_0x2a21d8)=>__defProp(_0x26aece,'name',{'value':_0x2a21d8,'configurable':!![]});const ruleName='must-use-nodetypes-structure-instead-of-string-node-type';const createRule=ESLintUtils['RuleCreator'](_0x40b282=>''+url+_0x40b282),forbiddenTypes=Object['values'](nodeTypes);function isTypeAccess(_0x124c01){return _0x124c01['type']===nodeTypes['memberExpression']&&!_0x124c01['computed']&&_0x124c01['property']['type']===nodeTypes['identifier']&&_0x124c01['property']['name']===eslintProperties['type'];}__name(isTypeAccess,'isTypeAccess');function isForbiddenLiteral(_0x3f6243){if(_0x3f6243['type']!==nodeTypes['literal'])return ![];if(!(eslintProperties['value']in _0x3f6243)||typeof _0x3f6243['value']!=='string')return ![];return forbiddenTypes['includes'](_0x3f6243['value']);}__name(isForbiddenLiteral,'isForbiddenLiteral');var mustUseNodetypesStructureInsteadOfStringNodeType = createRule({'name':ruleName,'meta':{'type':ruleTypes['problem'],'docs':{'description':'Enforce\x20using\x20nodeTypes\x20instead\x20of\x20string\x20literals\x20for\x20AST\x20node\x20types.'},'messages':{'mustUseNodeTypesInsteadOfStringNodeType':'must-use-nodetypes-structure-instead-of-string-node-type\x0a###\x20**Must**\x20use\x20nodeTypes\x20instead\x20of\x20string\x20literals\x20for\x20AST\x20node\x20types.\x0a\x0a####\x20Wrong\x0a\x0aif\x20(node.type\x20===\x20\x22MemberExpression\x22)\x20{\x0a\x20\x20\x20\x20...\x0a}\x0a\x0a####\x20Correct\x0a\x0aif\x20(node.type\x20===\x20nodeTypes.MemberExpression)\x20{\x0a\x20\x20\x20\x20...\x0a}\x0a\x0a####\x20Why\x0a\x0aUsing\x20nodeTypes\x20keeps\x20node\x20type\x20definitions\x20consistent\x20and\x20avoids\x20typos.'},'schema':[]},'defaultOptions':[],'create'(_0x6279c){return {'BinaryExpression'(_0x1fa94e){if(_0x1fa94e['operator']!=='==='&&_0x1fa94e['operator']!=='!==')return;(isTypeAccess(_0x1fa94e['left'])&&isForbiddenLiteral(_0x1fa94e['right'])||isTypeAccess(_0x1fa94e['right'])&&isForbiddenLiteral(_0x1fa94e['left']))&&_0x6279c['report']({'node':_0x1fa94e,'messageId':'mustUseNodeTypesInsteadOfStringNodeType'});}};}});

export { mustUseNodetypesStructureInsteadOfStringNodeType as default, ruleName };
