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

var __defProp=Object['defineProperty'],__name=(_0x215b7d,_0x4ca6b1)=>__defProp(_0x215b7d,'name',{'value':_0x4ca6b1,'configurable':!![]});const ruleName='no-eslint-disable-without-approved';const disablePattern='eslint-disable',approvedExamples='//\x20Approved',constants={'disablePattern':disablePattern,'approvedPrefix':'Approved','approvedExamples':approvedExamples,'messageIds':{'noEslintDisableWithoutApproved':'noEslintDisableWithoutApproved'},'meta':{'type':ruleTypes['problem'],'docs':{'description':'Require\x20'+approvedExamples+'\x20comment\x20before\x20any\x20'+disablePattern+'\x20comment'},'messages':{'noEslintDisableWithoutApproved':'no-eslint-disable-without-approved\x0a{{message}}\x0a\x0a###\x20**Must**\x20add\x20\x22//\x20Approved\x22\x20comment\x20before\x20any\x20\x22eslint-disable\x22\x20comment.\x0a\x0a####\x20Wrong\x0a\x0a//\x20eslint-disable\x20no-console\x0a\x0a####\x20Correct\x0a\x0a//\x20Approved\x0a//\x20eslint-disable\x20no-console\x0a\x0a//\x20Approved\x20with\x20explanation\x0a//\x20eslint-disable\x20no-console\x0a\x0a####\x20Why\x0a\x0aDisabling\x20of\x20ESLint\x20rules\x20without\x20context\x20can\x20hide\x20real\x20problems.\x20Requiring\x20an\x20\x22Approved\x22\x20comment\x20helps\x20enforce\x20code\x20quality.'},'schema':[]}},createRule=RuleCreator(_0xf1332f=>''+url+_0xf1332f),noEslintDisableWithoutApproved=createRule({'name':ruleName,'meta':constants['meta'],'defaultOptions':[],'create'(_0x43f842){const _0x2af722=_0x43f842['sourceCode']['getAllComments']();return {'Program'(){findEslintDisableComment(_0x2af722,_0x43f842,constants['disablePattern'],constants['approvedPrefix'],constants['messageIds']['noEslintDisableWithoutApproved'],'Add\x20`'+approvedExamples+'`\x20comment\x20before\x20any\x20`'+disablePattern+'`\x20comment.'),findApprovedLineComment(_0x2af722,_0x43f842);}};}});function findApprovedLineComment(_0x42dc56,_0x305b82){for(let _0x15431d=-0x107f+0x1e30+-0xdb1;_0x15431d<_0x42dc56['length'];_0x15431d++){const _0x1cc073=_0x42dc56[_0x15431d],_0x489e0a=_0x1cc073['type']===nodeTypes['Line']&&_0x1cc073['value']['trim']()['startsWith'](constants['approvedPrefix']);if(_0x489e0a){const _0x65c5be=_0x42dc56[_0x15431d+(-0xae1*-0x1+0x9*0x305+-0x260d)],_0x49e37b=_0x65c5be?.['value']?.['trim']()['startsWith'](constants['disablePattern'])&&_0x65c5be['loc']['start']['line']-_0x1cc073['loc']['end']['line']===0x7*-0x3ee+-0x1*0x11a8+0x1*0x2d2b;!_0x49e37b&&_0x305b82['report']({'loc':_0x1cc073['loc'],'messageId':constants['messageIds']['noEslintDisableWithoutApproved'],'data':{'message':'Remove\x20redundant\x20`'+approvedExamples+'`\x20comment.'}});}}}__name(findApprovedLineComment,'findApprovedLineComment');

export { noEslintDisableWithoutApproved as default, ruleName };
