'use strict';
import { ESLintUtils } from '@typescript-eslint/utils';
import { ruleTypes, url, ruleMessageIds } from '@flint/infra/constants/rules-meta';
import { firstOrUndefined } from '../../../fd-toolbox/server/collections/single-funcs.js';

var __defProp=Object['defineProperty'],__name=(_0x26f374,_0x2544c0)=>__defProp(_0x26f374,'name',{'value':_0x2544c0,'configurable':!![]});const ruleName='must-limit-lines-without-comments';const constants={'meta':{'type':ruleTypes['suggestion'],'docs':{'description':'Enforce\x20a\x20maximum\x20number\x20of\x20lines\x20in\x20a\x20file,\x20excluding\x20comments'},'messages':{'tooManyLines':ruleName+'\x0aFile\x20has\x20too\x20many\x20lines\x20({{lineCount}}).\x20Maximum\x20allowed\x20is\x20{{maxLines}}.\x0a\x0a###\x20**Must**\x20limit\x20the\x20number\x20of\x20lines\x20in\x20a\x20file\x20(excluding\x20comments).\x0a\x0a####\x20Wrong\x0a\x0a//\x20File\x20with\x20more\x20lines\x20than\x20allowed\x0a\x0aconst\x20a\x20=\x201;\x0aconst\x20b\x20=\x202;\x0a//\x20...\x0a//\x20(More\x20than\x20{{maxLines}}\x20lines\x20without\x20comments)\x0a\x0a####\x20Correct\x0a\x0a//\x20Shorter\x20file\x20within\x20the\x20allowed\x20limit\x0a\x0aconst\x20a\x20=\x201;\x0aconst\x20b\x20=\x202;\x0a\x0a####\x20Why\x0a\x0aLimiting\x20the\x20number\x20of\x20active\x20(non-comment)\x20lines\x20in\x20a\x20file\x20helps\x20keep\x20code\x20modular,\x20easier\x20to\x20review,\x20and\x20maintain.\x20It\x20encourages\x20splitting\x20large\x20files\x20into\x20smaller,\x20focused\x20components.'},'schema':[{'type':'object','properties':{'maxLines':{'type':'number','minimum':0x0}},'additionalProperties':![]}]},'defaultMaxLines':0x190},createRule=ESLintUtils['RuleCreator'](_0x418199=>''+url+_0x418199),mustLimitLinesWithoutComments=createRule({'name':ruleName,'meta':constants['meta'],'create'(_0x26b3f6){const _0x41ab89=_0x26b3f6['sourceCode'],_0x2e49c2=firstOrUndefined(_0x26b3f6['options'])??{'maxLines':constants['defaultMaxLines']},_0x3468e0=_0x2e49c2['maxLines'];return {'Program'(_0x3ad4e6){const _0x54cbad=countNonCommentLines(_0x41ab89);_0x54cbad>_0x3468e0&&_0x26b3f6['report']({'node':_0x3ad4e6,'messageId':ruleMessageIds['tooManyLines'],'data':{'lineCount':_0x54cbad,'maxLines':_0x3468e0}});}};},'defaultOptions':[{'maxLines':constants['defaultMaxLines']}]});function countNonCommentLines(_0x5cfd37){const _0x1d9e70=_0x5cfd37['lines'],_0x3747e8=_0x5cfd37['getTokens'](_0x5cfd37['ast'],{'includeComments':![]}),_0x4202f9=new Set();_0x3747e8['forEach'](_0x41a625=>{const _0x387348=_0x41a625['loc']['start']['line'],_0x4de480=_0x41a625['loc']['end']['line'];for(let _0x504d04=_0x387348;_0x504d04<=_0x4de480;_0x504d04++){_0x4202f9['add'](_0x504d04);}});let _0x1ffc3c=-0x6aa+-0x455*0x1+0x233*0x5;return _0x1d9e70['forEach']((_0x5225a3,_0x483c80)=>{const _0x595500=_0x483c80+(-0x73b*0x5+-0x133b*-0x2+-0x24e);_0x4202f9['has'](_0x595500)&&_0x5225a3['trim']()&&_0x1ffc3c++;}),_0x1ffc3c;}__name(countNonCommentLines,'countNonCommentLines');

export { mustLimitLinesWithoutComments as default, ruleName };
