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

var __defProp=Object['defineProperty'],__name=(_0x5e3f23,_0x156240)=>__defProp(_0x5e3f23,'name',{'value':_0x156240,'configurable':!![]});const ruleName='must-use-native-private';const constants={'messageIds':{'mustUseNativePrivate':'mustUseNativePrivate'},'meta':{'type':ruleTypes['suggestion'],'docs':{'description':'Disallow\x20the\x20use\x20of\x20\x27private\x27\x20modifier\x20in\x20favor\x20of\x20\x27#privateField\x27.'},'messages':{'mustUseNativePrivate':'must-use-native-private\x0a###\x20**Must**\x20use\x20native\x20private\x20fields\x20with\x20\x22#\x22\x20instead\x20of\x20\x22private\x22\x20modifier.\x0a\x0a####\x20Wrong\x0a\x0aclass\x20Foo\x20{\x0a\x20\x20\x20\x20private\x20bar:\x20string;\x0a}\x0a\x0a####\x20Correct\x0a\x0aclass\x20Foo\x20{\x0a\x20\x20\x20\x20#bar:\x20string;\x0a}\x0a\x0a####\x20Why\x0a\x0aThe\x20\x22#\x22\x20syntax\x20makes\x20fields\x20truly\x20private\x20—\x20they\x20can\x27t\x20be\x20accessed\x20from\x20outside\x20the\x20class\x20at\x20all.\x20Unlike\x20\x22private\x22\x20in\x20TypeScript,\x20which\x20only\x20works\x20at\x20compile\x20time,\x20the\x20\x22#\x22\x20syntax\x20enforces\x20privacy\x20at\x20runtime.'},'schema':[]},'accessModifiers':{'private':'private'}},createRule=ESLintUtils['RuleCreator'](_0x553c1a=>''+url+_0x553c1a),mustUseNativePrivate=createRule({'name':ruleName,'meta':constants['meta'],'defaultOptions':[],'create'(_0x4c140c){return {[nodeTypes['TSParameterProperty']](_0x59260d){if(isNodeInsideDeclaredClass(_0x59260d))return;_0x59260d['accessibility']===constants['accessModifiers']['private']&&_0x59260d['parameter']&&_0x59260d['parameter']['type']===nodeTypes['identifier']&&_0x4c140c['report']({'node':_0x59260d['parameter'],'messageId':constants['messageIds']['mustUseNativePrivate']});},'ClassBody'(_0xbb54f2){!isNodeInsideDeclaredClass(_0xbb54f2)&&reportPrivateMembersInClassBody(_0xbb54f2['body'],_0x4c140c);}};}});function isNodeInsideDeclaredClass(_0x3e8670){let _0x58ef69=_0x3e8670['parent'],_0x451bad=![];while(_0x58ef69){if(_0x58ef69['type']===nodeTypes['classDeclaration']||_0x58ef69['type']===nodeTypes['classExpression']){_0x451bad=Boolean(_0x58ef69['declare']);break;}if(_0x58ef69['type']===nodeTypes['program'])break;_0x58ef69=_0x58ef69['parent'];}return _0x451bad;}__name(isNodeInsideDeclaredClass,'isNodeInsideDeclaredClass');function reportPrivateMembersInClassBody(_0x124aad,_0x3456d2){for(const _0x66ec8e of _0x124aad){!('declare'in _0x66ec8e&&_0x66ec8e['declare'])&&(_0x66ec8e['type']===nodeTypes['propertyDefinition']||_0x66ec8e['type']===nodeTypes['methodDefinition'])&&_0x66ec8e['accessibility']===constants['accessModifiers']['private']&&_0x66ec8e['key']['type']===nodeTypes['identifier']&&_0x3456d2['report']({'node':_0x66ec8e['key'],'messageId':constants['messageIds']['mustUseNativePrivate']});}}__name(reportPrivateMembersInClassBody,'reportPrivateMembersInClassBody');

export { mustUseNativePrivate as default, ruleName };
