pickier 0.1.74 → 0.1.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1 -1
- package/dist/chunk-9k028jfq.js +2 -0
- package/dist/{chunk-gm98vb80.js → chunk-hm7sfaz3.js} +1 -1
- package/dist/{chunk-96vhwdwy.js → chunk-j38cqh4p.js} +2 -2
- package/dist/{chunk-rx0b7k57.js → chunk-mq0hh9yt.js} +15 -15
- package/dist/chunk-n224szdq.js +2 -0
- package/dist/{chunk-rdpajf43.js → chunk-q50pq5mc.js} +1 -1
- package/dist/{chunk-wz6hqyhd.js → chunk-q5t3ta01.js} +1 -1
- package/dist/chunk-rt9y8epr.js +2 -0
- package/dist/chunk-shq21jvq.js +124 -0
- package/dist/{chunk-nhan327m.js → chunk-xgqhgjnn.js} +1 -1
- package/dist/{chunk-t0w79bj5.js → chunk-xk86b5d3.js} +4 -4
- package/dist/native/darwin-arm64/pickier-native +0 -0
- package/dist/native/darwin-x64/pickier-native +0 -0
- package/dist/native/linux-arm64/pickier-native +0 -0
- package/dist/native/linux-x64/pickier-native +0 -0
- package/dist/native/win32-arm64/pickier-native.exe +0 -0
- package/dist/native/win32-x64/pickier-native.exe +0 -0
- package/dist/src/index.js +1 -1
- package/dist/src/lint-worker.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2n2819ks.js +0 -124
- package/dist/chunk-fn87cp4c.js +0 -2
- package/dist/chunk-gx7gjw2a.js +0 -2
- package/dist/chunk-zdbvg427.js +0 -2
package/dist/chunk-2n2819ks.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{g,I,q,G,c,S,p,O,M,C,L,f,r,m,N,o,t,u,x,T,h,d}from"./chunk-rx0b7k57.js";import{F}from"./chunk-gm98vb80.js";import{e,k}from"./chunk-qq03kpe0.js";import{readdirSync as Go,readFileSync as Hn,statSync as $n,writeFileSync as Kn}from"fs";import{isAbsolute as Ye,join as Vo,relative as Cn,resolve as Xe,sep as Ko}from"path";import{readFileSync as mo,writeFileSync as fc}from"fs";import{isAbsolute as mc,relative as uo,resolve as pc}from"path";var On=Promise.resolve();function lt(y){let b=null,s=null,l=()=>(s??=import("./chunk-dxrcbgyc.js").then((i)=>(b=new i.Logger(y,{showTags:!1}),b)),s),n=(i,w)=>{if(b){b[i](...w);return}On=On.then(l).then((a)=>{a[i](...w)}).catch(()=>{})};return{debug:(...i)=>n("debug",i),info:(...i)=>n("info",i),warn:(...i)=>n("warn",i),error:(...i)=>n("error",i),ready:async()=>{await l()}}}function R(){return On}var ct={meta:{docs:"Enforce return statements in callbacks of array methods",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),i=new RegExp(`\\.(${["map","filter","find","findIndex","findLast","findLastIndex","every","some","reduce","reduceRight","sort","flatMap"].join("|")})\\s*\\(`,"g");for(let w=0;w<l.length;w++){let a=l[w],P;for(P=i.exec(a);P!==null;P=i.exec(a)){let E=P[1],_=P.index+P[0].length,D=a.slice(_),j=D.match(/^\s*(?:\(([^)]*)\)|([a-z_$][\w$]*))\s*=>/i),B=D.match(/^\s*function\s*(?:[a-zA-Z_$][\w$]*\s*)?\(/);if(j){let Z=D.slice(j[0].length).trim();if(Z.startsWith("{")){let z=!1,Y=0,X=Z,J=w;while(J<l.length){let ie=J===w?X:l[J];for(let Q=0;Q<ie.length;Q++){let ee=ie[Q];if(ee==="{")Y++;if(ee==="}"){if(Y--,Y===0){if(!z)s.push({filePath:b.filePath,line:w+1,column:P.index+1,ruleId:"eslint/array-callback-return",message:`Array method '${E}' callback should return a value`,severity:"error"});break}}}if(ie.match(new RegExp("\\breturn\\s+[^;]")))z=!0;if(Y===0)break;J++,X=l[J]||""}}}else if(B){let Z=!1,z=0,Y=w,X=!1;while(Y<l.length){let J=l[Y];for(let ie=0;ie<J.length;ie++){let Q=J[ie];if(Q==="{")z++,X=!0;else if(Q==="}"){if(z--,z===0&&X){if(!Z)s.push({filePath:b.filePath,line:w+1,column:P.index+1,ruleId:"eslint/array-callback-return",message:`Array method '${E}' callback should return a value`,severity:"error"});break}}}if(X&&J.match(new RegExp("\\breturn\\s+[^;]")))Z=!0;if(z===0&&X)break;Y++}}}}return s}};var at={meta:{docs:"Require super() calls in constructors of derived classes",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=!1,i=!1,w=0,a=0,P=!1;for(let E=0;E<l.length;E++){let _=l[E];if(_.match(/\bclass\s+\w+\s+extends\s+\w+/))n=!0;if(n&&_.match(/\bconstructor\s*\(/))i=!0,w=E+1,a=0,P=!1;if(i){for(let D of _){if(D==="{")a++;if(D==="}")a--}if(_.match(/\bsuper\s*\(/))P=!0;if(a===0&&_.includes("}")){if(!P)s.push({filePath:b.filePath,line:w,column:1,ruleId:"eslint/constructor-super",message:"Constructors of derived classes must call super()",severity:"error"});i=!1,n=!1}}}return s}};var ut={meta:{docs:'Enforce "for" loop update clause moving counter in the right direction',recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=new RegExp("\\bfor\\s*\\(\\s*(?:(?:let|var|const)\\s*)?(\\w+)\\s*=[^;]+;\\s*(\\w+)\\s*([<>]=?)[^;]+;\\s*(\\w+)(\\+\\+|--|[\\s+-]=)"),a=i.match(w);if(a){let P=a[1],E=a[2],_=a[3],D=a[4],j=a[5];if(P===E&&E===D){let B=j.includes("+"),Z=_.includes("<");if(Z&&!B||!Z&&B)s.push({filePath:b.filePath,line:n+1,column:1,ruleId:"eslint/for-direction",message:"The update clause in this loop moves the variable in the wrong direction",severity:"error"})}}}return s}};var ft={meta:{docs:"Enforce return statements in getters",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let w=l[n].match(/\bget\s+(\w+)\s*\(/);if(w){let a=w[1],P=!1,E=0,_=n;while(_<l.length){let D=l[_];for(let B of D){if(B==="{")E++;if(B==="}"){if(E--,E===0){if(!P)s.push({filePath:b.filePath,line:n+1,column:1,ruleId:"eslint/getter-return",message:`Getter '${a}' must return a value`,severity:"error"});break}}}let j=new RegExp("\\breturn\\s+[^;]");if(D.match(j))P=!0;if(E===0)break;_++}}}return s}};var mt={meta:{docs:"Disallow async functions as Promise executor",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/new\s+Promise\s*\(\s*async\s*(?:\(|function)/g,a;for(a=w.exec(i);a!==null;a=w.exec(i))s.push({filePath:b.filePath,line:n+1,column:a.index+1,ruleId:"eslint/no-async-promise-executor",message:"Promise executor functions should not be async",severity:"error"})}return s}};var pt={meta:{docs:"Disallow comparing against -0",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/([!=]==?)\s*-0\b|\b-0\s*([!=]==?)/g,a;for(a=w.exec(i);a!==null;a=w.exec(i))s.push({filePath:b.filePath,line:n+1,column:a.index+1,ruleId:"eslint/no-compare-neg-zero",message:"Do not use the '-0' literal in comparisons",severity:"error"})}return s}};var dt={meta:{docs:"Disallow assignment operators in conditional expressions",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\b(if|while)\s*\([^)]*\b(\w+)\s*=\s*(?!=)[^)]*\)/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){let P=a[0];if(/===|==/.test(P))continue;if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-cond-assign",message:"Expected a conditional expression and instead saw an assignment",severity:"error"})}}return s}};var ht={meta:{docs:"Disallow reassigning const variables",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=new Map;for(let i=0;i<l.length;i++){let w=l[i],a=w.match(/\bconst\s+(\w+)/);if(a)n.set(a[1],i);let P=/\b(\w+)\s*=(?!=)/g,E;for(E=P.exec(w);E!==null;E=P.exec(w)){let _=E[1],D=w.substring(0,E.index);if(!/\b(?:const|let|var)\s*$/.test(D)&&n.has(_))s.push({filePath:b.filePath,line:i+1,column:Math.max(1,E.index+1),ruleId:"eslint/no-const-assign",message:`'${_}' is constant`,severity:"error"})}}return s}};var gt={meta:{docs:"Disallow constant expressions in conditions",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=[{pattern:/\b(if|while)\s*\(\s*(true|false)\s*\)/g,type:"boolean"},{pattern:/\b(if|while)\s*\(\s*(\d+)\s*\)/g,type:"number"},{pattern:/\b(if|while)\s*\(\s*(['"`][^'"`]*['"`])\s*\)/g,type:"string"}];for(let{pattern:a,type:P}of w){let E;while((E=a.exec(i))!==null){let _=E[1];if(i.substring(0,E.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,E.index+_.length+2),ruleId:"eslint/no-constant-condition",message:"Unexpected constant condition",severity:"error"})}}}return s}};var yt={meta:{docs:"Disallow duplicate class members",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=!1,i=new Set,w=0;for(let a=0;a<l.length;a++){let P=l[a];if(P.match(/\bclass\s+\w+/))n=!0,i=new Set,w=0;if(n){for(let _ of P){if(_==="{")w++;if(_==="}"){if(w--,w===0)n=!1}}let E=[...P.matchAll(/^\s*(?:(?:public|private|protected|static|readonly|async)\s*)?(?:get|set)?\s*(\w+)\s*\(/g),...P.matchAll(/^\s*(?:(?:public|private|protected|static|readonly)\s*)?(\w+)\s*[:=]/g)];for(let _ of E){let D=_[1];if(i.has(D))s.push({filePath:b.filePath,line:a+1,column:1,ruleId:"eslint/no-dupe-class-members",message:`Duplicate class member '${D}'`,severity:"error"});else i.add(D)}}}return s}};var Je={meta:{docs:"Disallow duplicate keys in object literals",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=/\{\s*$/,i=/^\s*(?:(['"`])(.+?)\1|(\w+))\s*:/;for(let w=0;w<l.length;w++){let a=l[w];if(!n.test(a)&&!a.includes("{"))continue;let P=new Map,E=(a.match(/\{/g)||[]).length-(a.match(/\}/g)||[]).length,_=w;for(let D=w+1;D<l.length&&E>0;D++){let j=l[D];E+=(j.match(/\{/g)||[]).length,E-=(j.match(/\}/g)||[]).length;let B=j.match(i);if(B){let Z=B[2]||B[3];if(Z)if(P.get(Z)!==void 0)s.push({filePath:b.filePath,line:D+1,column:Math.max(1,j.search(/\S/)+1),ruleId:"eslint/no-dupe-keys",message:`Duplicate key '${Z}'`,severity:"error"});else P.set(Z,D)}if(E===0)break}}return s},fix:(y,b)=>{let s=Je.check(y,b);if(s.length===0)return y;let l=y.split(/\r?\n/),n=new Set(s.map((w)=>w.line-1));return l.filter((w,a)=>!n.has(a)).join(`
|
|
3
|
-
`)}};var bt={meta:{docs:"Disallow duplicate case labels in switch statements",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=!1,i=new Set,w=-1;for(let a=0;a<l.length;a++){let P=l[a],E=P.trim();if(/\bswitch\s*\(/.test(E)){n=!0,i=new Set,w=a;continue}if(n&&E==="}"&&a>w){let _=l[w].match(/^\s*/)?.[0].length||0;if((P.match(/^\s*/)?.[0].length||0)<=_+2)n=!1,i=new Set}if(n){let _=E.match(/^case\s+(.+?)\s*:/);if(_){let D=_[1].trim();if(i.has(D))s.push({filePath:b.filePath,line:a+1,column:Math.max(1,P.indexOf("case")+1),ruleId:"eslint/no-duplicate-case",message:`Duplicate case label '${D}'`,severity:"error"});else i.add(D)}}}return s}};var xt={meta:{docs:"Disallow empty destructuring patterns",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\{\s*\}\s*=/g,a=/\[\s*\]\s*=/g,P;for(P=w.exec(i);P!==null;P=w.exec(i)){if(i.substring(0,P.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,P.index+1),ruleId:"eslint/no-empty-pattern",message:"Unexpected empty object pattern",severity:"error"})}for(P=a.exec(i);P!==null;P=a.exec(i)){if(i.substring(0,P.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,P.index+1),ruleId:"eslint/no-empty-pattern",message:"Unexpected empty array pattern",severity:"error"})}}return s}};var Rt={meta:{docs:"Disallow fallthrough of case statements",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=!1,i=-1,w=!1;for(let a=0;a<l.length;a++){let E=l[a].trim();if(/\bswitch\s*\(/.test(E)){n=!0;continue}if(n){if(/^case\s+/.test(E)||/^default\s*:/.test(E)){if(i>=0&&w){if(!(/\/\/.*falls?\s*through|\/\*.*falls?\s*through/i.test(l[i])||a>0&&/\/\/.*falls?\s*through|\/\*.*falls?\s*through/i.test(l[a-1])))s.push({filePath:b.filePath,line:i+1,column:Math.max(1,l[i].indexOf("case")+1),ruleId:"eslint/no-fallthrough",message:"Expected a 'break' statement before 'case'",severity:"error"})}i=a,w=!0}if(/\b(?:break|return|throw|continue)\b/.test(E))w=!1;if(E==="}")n=!1,i=-1,w=!1}}return s}};var wt={meta:{docs:"Disallow number literals that lose precision",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\b(\d{17,}(?:\.\d+)?|\d+\.\d{17,})\b/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){let P=a[1];if(Number(P).toString()!==P)s.push({filePath:b.filePath,line:n+1,column:a.index+1,ruleId:"eslint/no-loss-of-precision",message:"This number literal will lose precision at runtime",severity:"error"})}}return s}};var kt={meta:{docs:"Disallow returning values from Promise executor functions",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++)if(l[n].match(/new\s+Promise\s*\(/)){let a=0,P=!1,E=n;while(E<l.length){let _=l[E];for(let j of _){if(j==="{")a++,P=!0;if(j==="}"){if(a--,a===0&&P)break}}let D=new RegExp("\\breturn\\s+[^;]");if(P&&_.match(D))s.push({filePath:b.filePath,line:E+1,column:1,ruleId:"eslint/no-promise-executor-return",message:"Return values from promise executor functions cannot be read",severity:"error"});if(a===0&&P)break;E++}}return s}};var It={meta:{docs:"Disallow variable redeclaration",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=new Map;for(let i=0;i<l.length;i++){let w=l[i],a=/\b(var|let|const)\s+(\w+)/g,P;for(P=a.exec(w);P!==null;P=a.exec(w)){let _=P[2];if(n.get(_)!==void 0)s.push({filePath:b.filePath,line:i+1,column:Math.max(1,P.index+1),ruleId:"eslint/no-redeclare",message:`'${_}' is already defined`,severity:"error"});else n.set(_,i)}let E=/\bfunction\s+(\w+)/g;for(P=E.exec(w);P!==null;P=E.exec(w)){let _=P[1];if(n.get(_)!==void 0)s.push({filePath:b.filePath,line:i+1,column:Math.max(1,P.index+1),ruleId:"eslint/no-redeclare",message:`'${_}' is already defined`,severity:"error"});else n.set(_,i)}}return s}};var Qe={meta:{docs:"Disallow assignments where both sides are identical",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=new RegExp("\\b(\\w+)\\s*=\\s*(\\w+)\\s*(?:;\\s*)?(?:\\/\\/.*)?$"),a=i.match(w);if(a&&a[1]===a[2]){s.push({filePath:b.filePath,line:n+1,column:Math.max(1,i.indexOf(a[1])+1),ruleId:"eslint/no-self-assign",message:`'${a[1]}' is assigned to itself`,severity:"error"});continue}let P=i.match(/([\w.]+)\s*=\s*([\w.]+)/);if(P&&P[1]===P[2]){s.push({filePath:b.filePath,line:n+1,column:Math.max(1,i.indexOf(P[1])+1),ruleId:"eslint/no-self-assign",message:`'${P[1]}' is assigned to itself`,severity:"error"});continue}let E=i.match(/(\w+\[[^\]]+\])\s*=\s*(\w+\[[^\]]+\])/);if(E){let _=E[1].replace(/\s/g,""),D=E[2].replace(/\s/g,"");if(_===D)s.push({filePath:b.filePath,line:n+1,column:Math.max(1,i.indexOf(E[1])+1),ruleId:"eslint/no-self-assign",message:`'${E[1]}' is assigned to itself`,severity:"error"})}}return s},fix:(y,b)=>{let s=Qe.check(y,b);if(s.length===0)return y;let l=y.split(/\r?\n/),n=new Set(s.map((w)=>w.line-1));return l.map((w,a)=>{if(n.has(a)){let P=w.trim();if(new RegExp("^\\w+(?:\\.\\w+|\\[[^\\]]+\\])?\\s*=\\s*\\w+(?:\\.\\w+|\\[[^\\]]+\\])?;?\\s*$").test(P))return""}return w}).filter((w,a,P)=>{if(w===""&&n.has(a)){let E=a>0&&P[a-1].trim()!=="",_=a<P.length-1&&P[a+1]&&P[a+1].trim()!=="";if(!E||!_)return!1}return!0}).join(`
|
|
4
|
-
`)}};var Pt={meta:{docs:"Disallow comparisons where both sides are identical",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/([\w.\[\]]+)\s*(===|!==|==|!=|<|>|<=|>=)\s*([\w.\[\]]+)/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){let P=a[1].replace(/\s/g,""),E=a[2],_=a[3].replace(/\s/g,"");if(P===_)s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-self-compare",message:`Comparing '${a[1]}' to itself is potentially pointless`,severity:"error"})}}return s}};var Mt={meta:{docs:"Disallow sparse arrays (arrays with empty slots)",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\[([^\]]*)\]/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){let P=a[1];if(/,\s*,/.test(P))s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-sparse-arrays",message:"Unexpected sparse array",severity:"error"})}}return s},fix:(y,b)=>{let s=y.split(/\r?\n/),l=!1,n=s.map((i)=>{let w=i;return w=w.replace(/\[([^\]]*)\]/g,(a,P)=>{if(/,\s*,/.test(P))return l=!0,`[${P.replace(/,(\s*),/g,", undefined,")}]`;return a}),w});return l?n.join(`
|
|
5
|
-
`):y}};var vt={meta:{docs:"Disallow undeclared variables",recommended:!0,wip:!0},check:(y,b)=>[]};var $t={meta:{docs:"Disallow unreachable code after return, throw, continue, or break",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(/^\s*(?:return|throw|break|continue)\b/.test(i))for(let a=n+1;a<l.length;a++){let P=l[a],E=P.trim();if(E===""||E.startsWith("//")||E.startsWith("/*"))continue;if(E==="}"||E.startsWith("}"))break;if(/^(?:case\b|default\s*:)/.test(E))break;s.push({filePath:b.filePath,line:a+1,column:Math.max(1,P.search(/\S/)+1),ruleId:"eslint/no-unreachable",message:"Unreachable code",severity:"error"});break}}return s}};var Ct={meta:{docs:"Disallow negation of the left operand of relational operators",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/!\s*\w+\s+in\s+/g,a=/!\s*\w+\s+instanceof\s+/g,P;for(P=w.exec(i);P!==null;P=w.exec(i))s.push({filePath:b.filePath,line:n+1,column:P.index+1,ruleId:"eslint/no-unsafe-negation",message:"Unexpected negation of 'in' operand",severity:"error"});for(P=a.exec(i);P!==null;P=a.exec(i))s.push({filePath:b.filePath,line:n+1,column:P.index+1,ruleId:"eslint/no-unsafe-negation",message:"Unexpected negation of 'instanceof' operand",severity:"error"})}return s},fix:(y)=>{let b=y;return b=b.replace(/!\s*(\w+)\s+in\s+/g,"!($1 in "),b=b.replace(/!\s*(\w+)\s+instanceof\s+/g,"!($1 instanceof "),b}};var Lt={meta:{docs:"Disallow unnecessary catch clauses",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.match(/catch\s*\(\s*(\w+)\s*\)/);if(!w)continue;let a=w[1];for(let P=n+1;P<Math.min(n+5,l.length);P++){let E=l[P].trim();if(E===`throw ${a}`||E===`throw ${a};`){let _=!1;for(let D=n+1;D<P;D++){let j=l[D].trim();if(j!==""&&j!=="{"&&!j.startsWith("//")){_=!0;break}}if(!_)s.push({filePath:b.filePath,line:n+1,column:Math.max(1,i.indexOf("catch")+1),ruleId:"eslint/no-useless-catch",message:"Unnecessary catch clause",severity:"error"});break}if(E==="}")break}}return s}};var St={meta:{docs:"Require isNaN() when checking for NaN",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\b([\w.\[\]]+)\s*(===|!==|==|!=)\s*NaN\b|\bNaN\s*(===|!==|==|!=)\s*([\w.\[\]]+)/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){let P=a[1]||a[4];s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/use-isnan",message:"Use isNaN() to compare with NaN",severity:"error"})}}return s},fix:(y,b)=>{let s=y.split(/\r?\n/),l=!1,n=s.map((i)=>{let w=i;return w=w.replace(/\b([\w.\[\]]+)\s*===\s*NaN\b/g,(a,P)=>(l=!0,`isNaN(${P})`)),w=w.replace(/\bNaN\s*===\s*([\w.\[\]]+)\b/g,(a,P)=>(l=!0,`isNaN(${P})`)),w=w.replace(/\b([\w.\[\]]+)\s*!==\s*NaN\b/g,(a,P)=>(l=!0,`!isNaN(${P})`)),w=w.replace(/\bNaN\s*!==\s*([\w.\[\]]+)\b/g,(a,P)=>(l=!0,`!isNaN(${P})`)),w=w.replace(/\b([\w.\[\]]+)\s*==\s*NaN\b/g,(a,P)=>(l=!0,`isNaN(${P})`)),w=w.replace(/\bNaN\s*==\s*([\w.\[\]]+)\b/g,(a,P)=>(l=!0,`isNaN(${P})`)),w=w.replace(/\b([\w.\[\]]+)\s*!=\s*NaN\b/g,(a,P)=>(l=!0,`!isNaN(${P})`)),w=w.replace(/\bNaN\s*!=\s*([\w.\[\]]+)\b/g,(a,P)=>(l=!0,`!isNaN(${P})`)),w});return l?n.join(`
|
|
6
|
-
`):y}};var Jn=["undefined","object","boolean","number","string","function","symbol","bigint"],Et={meta:{docs:"Enforce comparing typeof expressions against valid strings",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/typeof\s+\w+\s*(?:===|!==|==|!=)\s*(['"`])(\w+)\1/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){let E=a[2];if(!Jn.includes(E))s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/valid-typeof",message:`Invalid typeof comparison value '${E}'`,severity:"error"})}let P=/(['"`])(\w+)\1\s*(?:===|!==|==|!=)\s*typeof\s+\w+/g;for(a=P.exec(i);a!==null;a=P.exec(i)){let E=a[2];if(!Jn.includes(E))s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/valid-typeof",message:`Invalid typeof comparison value '${E}'`,severity:"error"})}}return s}};var At={meta:{docs:"Enforce a maximum cyclomatic complexity allowed in a program",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=10,i=!1,w=0,a="",P=0,E=0;for(let _=0;_<l.length;_++){let D=l[_],j=D.match(/\bfunction\s+(\w+)\s*\(|(\w+)\s*=\s*(?:\([^)]*\)|(\w+))\s*=>/);if(j)i=!0,w=_+1,a=j[1]||j[2]||j[3]||"anonymous",P=1,E=0;if(i){for(let Z of D){if(Z==="{")E++;if(Z==="}"){if(E--,E===0){if(P>10)s.push({filePath:b.filePath,line:w,column:1,ruleId:"eslint/complexity",message:`Function '${a}' has complexity ${P}, exceeds maximum of 10`,severity:"error"});i=!1}}}let B=[/\bif\s*\(/,/\belse\s+if\s*\(/,/\bfor\s*\(/,/\bwhile\s*\(/,/\bcase\s+/,/\bcatch\s*\(/,/\b&&\b/,/\b\|\|\b/,/\?\s*(?:\S.*(?:[\n\r\u2028\u2029]\s*)?)?:/];for(let Z of B){let z=D.match(new RegExp(Z,"g"));if(z)P+=z.length}}}return s}};var Ot={meta:{docs:"Require default case in switch statements",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=!1,i=0,w=!1,a=0;for(let P=0;P<l.length;P++){let E=l[P];if(E.match(/\bswitch\s*\(/))n=!0,i=P+1,w=!1,a=0;if(n){for(let _ of E){if(_==="{")a++;if(_==="}"){if(a--,a===0){if(!w)s.push({filePath:b.filePath,line:i,column:1,ruleId:"eslint/default-case",message:"Expected a default case",severity:"error"});n=!1}}}if(E.match(/\bdefault\s*:/))w=!0}}return s}};var _t={meta:{docs:"Require === and !== instead of == and !=",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/([^=!])(\s*)(==)(\s*)([^=])/g,a=/([^!])(\s*)(!=)(\s*)([^=])/g,P;for(P=w.exec(i);P!==null;P=w.exec(i))s.push({filePath:b.filePath,line:n+1,column:Math.max(1,P.index+2),ruleId:"eslint/eqeqeq",message:"Expected '===' and instead saw '=='",severity:"error"});for(P=a.exec(i);P!==null;P=a.exec(i))s.push({filePath:b.filePath,line:n+1,column:Math.max(1,P.index+2),ruleId:"eslint/eqeqeq",message:"Expected '!==' and instead saw '!='",severity:"error"})}return s},fix:(y)=>{let b=y;return b=b.replace(/([^!])(\s*)(!=)(\s*)([^=])/g,"$1$2!==$4$5"),b=b.replace(/([^=!])(\s*)(==)(\s*)([^=])/g,"$1$2===$4$5"),b}};var Tt={meta:{docs:"Enforce a maximum depth that blocks can be nested",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=4,i=0,w=0,a=0;for(let P=0;P<l.length;P++){let E=l[P];if(E.match(/\b(if|for|while|switch|try|catch|else)\b.*\{/)){if(i++,i>w)w=i,a=P+1}else if(E.match(/\{/)&&!E.match(/^.*\}/)){if(l[P-1]?.match(/\b(if|for|while|switch|try|catch|else)\b/)){if(i++,i>w)w=i,a=P+1}}if(E.match(/^\s*\}/))i--;if(i>4)s.push({filePath:b.filePath,line:P+1,column:1,ruleId:"eslint/max-depth",message:`Blocks are nested too deeply (${i}), maximum allowed is 4`,severity:"error"})}return s}};var Wt={meta:{docs:"Enforce a maximum number of lines of code in a function",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=50,i=!1,w=0,a="",P=0;for(let E=0;E<l.length;E++){let _=l[E],D=_.match(/\bfunction\s+(\w+)\s*\(|(\w+)\s*=\s*(?:\([^)]*\)|(\w+))\s*=>/);if(D)i=!0,w=E+1,a=D[1]||D[2]||D[3]||"anonymous",P=0;if(i)for(let j of _){if(j==="{")P++;if(j==="}"){if(P--,P===0){let B=E+1-w+1;if(B>50)s.push({filePath:b.filePath,line:w,column:1,ruleId:"eslint/max-lines-per-function",message:`Function '${a}' has ${B} lines, exceeds maximum of 50`,severity:"error"});i=!1}}}}return s}};var Nt={meta:{docs:"Disallow alert, confirm, and prompt",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\b(alert|confirm|prompt)\s*\(/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-alert",message:`Unexpected ${a[1]}`,severity:"warning"})}}return s}};var Dt={meta:{docs:"Disallow await inside of loops",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=!1,i=0,w=0;for(let a=0;a<l.length;a++){let P=l[a];if(P.match(/\b(for|while|do)\s*\(/))n=!0,i=0,w=a;if(n){for(let E of P){if(E==="{")i++;if(E==="}"){if(i--,i===0)n=!1}}if(P.match(/\bawait\s+/))s.push({filePath:b.filePath,line:a+1,column:1,ruleId:"eslint/no-await-in-loop",message:"Unexpected await inside a loop. Consider using Promise.all() instead",severity:"error"})}}return s}};var jt={meta:{docs:"Disallow use of arguments.caller or arguments.callee",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\barguments\s*\.\s*(caller|callee)\b/g,a;for(a=w.exec(i);a!==null;a=w.exec(i))s.push({filePath:b.filePath,line:n+1,column:a.index+1,ruleId:"eslint/no-caller",message:`Avoid arguments.${a[1]}`,severity:"error"})}return s}};var Ut={meta:{docs:"Disallow lexical declarations in case clauses",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=!1,i=!1;for(let w=0;w<l.length;w++){let a=l[w];if(a.match(/\bcase\s+(?:\S.*)?:|default\s*:/))n=!0,i=!0;else i=!1;if(n&&!i&&(a.match(/\bbreak\b/)||a.match(/\bcase\s+(?:\S.*)?:/)))n=!1;if(n&&!i){if(a.match(/\b(let|const|function|class)\s+/))s.push({filePath:b.filePath,line:w+1,column:1,ruleId:"eslint/no-case-declarations",message:"Unexpected lexical declaration in case block",severity:"error"})}}return s}};var Ft={meta:{docs:"Disallow else blocks after return statements in if statements",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];if(!/^\s*else\b/.test(i))continue;let w=!1;for(let a=n-1;a>=0&&a>=n-10;a--){let P=l[a].trim();if(P.startsWith("return"))w=!0;if(P==="}"&&w)break;if(P.includes("{"))break}if(w)s.push({filePath:b.filePath,line:n+1,column:Math.max(1,i.indexOf("else")+1),ruleId:"eslint/no-else-return",message:"Unnecessary else after return",severity:"warning"})}return s}};var Bt={meta:{docs:"Disallow empty block statements",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\{\s*\}/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){let P=i.substring(0,a.index).trim(),E=/(?:if|else|for|while|do|try|catch|finally|function|\})\s*$/.test(P),_=/[=:]$/.test(P)||/return\s*$/.test(P);if(E&&!_)s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-empty",message:"Empty block statement",severity:"error"})}}for(let n=0;n<l.length-1;n++){let i=l[n],w=l[n+1];if(/\{\s*$/.test(i.trim()))for(let a=n+1;a<l.length;a++){let P=l[a].trim();if(P==="")continue;if(P==="}"||P.startsWith("}")){let E=i.substring(0,i.lastIndexOf("{")).trim(),_=/(?:if|else|for|while|do|try|catch|finally|function|\})\s*$/.test(E),D=/[=:]$/.test(E)||/return\s*$/.test(E);if(_&&!D)s.push({filePath:b.filePath,line:n+1,column:Math.max(1,i.lastIndexOf("{")+1),ruleId:"eslint/no-empty",message:"Empty block statement",severity:"error"})}break}}return s}};var qt={meta:{docs:"Disallow empty functions",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=[/function\s+\w+\s*\([^)]*\)\s*\{\s*\}/g,/function\s*\([^)]*\)\s*\{\s*\}/g,/\([^)]*\)\s*=>\s*\{\s*\}/g,/\w+\s*\([^)]*\)\s*\{\s*\}/g];for(let a of w){let P;for(P=a.exec(i);P!==null;P=a.exec(i)){if(i.substring(0,P.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,P.index+1),ruleId:"eslint/no-empty-function",message:"Unexpected empty function",severity:"warning"})}}}return s}};var zt={meta:{docs:"Disallow use of eval()",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\beval\s*\(/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-eval",message:"eval can be harmful",severity:"error"})}}return s}};var el=["Object","Array","String","Number","Boolean","Date","RegExp","Function","Math","JSON","Promise","Map","Set","WeakMap","WeakSet","Symbol","Proxy","Reflect","Error","TypeError","RangeError"],Zt={meta:{docs:"Disallow extending native types",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];for(let w of el){let a=new RegExp(`\\b${w}\\.prototype\\.\\w+\\s*=`,"g"),P;for(P=a.exec(i);P!==null;P=a.exec(i)){if(i.substring(0,P.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,P.index+1),ruleId:"eslint/no-extend-native",message:`${w} prototype is read only, properties should not be added`,severity:"error"})}}}return s}};var Gt={meta:{docs:"Disallow unnecessary boolean casts",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=[/\bif\s*\(\s*Boolean\s*\(/g,/\bwhile\s*\(\s*Boolean\s*\(/g,/!\s*Boolean\s*\(/g,/\?\s*Boolean\s*\(/g,/&&\s*Boolean\s*\(/g,/\|\|\s*Boolean\s*\(/g,/!!\s*\w+/g];for(let a of w){let P;for(P=a.exec(i);P!==null;P=a.exec(i)){if(i.substring(0,P.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,P.index+1),ruleId:"eslint/no-extra-boolean-cast",message:"Redundant Boolean call or double negation",severity:"error"})}}}return s},fix:(y)=>{let b=y;return b=b.replace(/\b(if|while)\s*\(\s*Boolean\s*\(([^)]+)\)\s*\)/g,"$1 ($2)"),b=b.replace(/!\s*Boolean\s*\(([^)]+)\)/g,"!$1"),b=b.replace(/!!\s*(\w+)/g,"$1"),b}};var tl=["Array","Boolean","Date","Error","Function","JSON","Math","Number","Object","RegExp","String","Symbol","undefined","NaN","Infinity","isNaN","isFinite","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","eval","Promise","Proxy","Reflect","Set","Map","WeakSet","WeakMap","ArrayBuffer","DataView","console","window","document","globalThis","global","process"],Vt={meta:{docs:"Disallow assignment to native objects or read-only global variables",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];for(let w of tl){let a=new RegExp(`\\b${w}\\s*=\\s*[^=]`,"g"),P;for(P=a.exec(i);P!==null;P=a.exec(i))if(!i.slice(P.index).match(new RegExp(`^${w}\\s*===?`)))s.push({filePath:b.filePath,line:n+1,column:P.index+1,ruleId:"eslint/no-global-assign",message:`Read-only global '${w}' should not be modified`,severity:"error"})}}return s}};var Kt={meta:{docs:"Disallow implied eval() via setTimeout/setInterval with strings",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\b(setTimeout|setInterval)\s*\(\s*(['"`])/g,a;while((a=w.exec(i))!==null){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-implied-eval",message:"Implied eval. Consider passing a function instead of a string",severity:"error"})}}return s}};var Ht={meta:{docs:"Disallow the use of the __iterator__ property",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/__iterator__/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-iterator",message:"Reserved name '__iterator__'",severity:"error"})}}return s}};var et={meta:{docs:"Disallow if statements as the only statement in else blocks",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(/^\s*else\s*(?:\{\s*)?$/.test(i)){let a=n,P=i.includes("{");if(!P){if(n+1<l.length&&l[n+1].trim()==="{")a=n+1,P=!0}if(P)for(let E=a+1;E<l.length;E++){let _=l[E].trim();if(_===""||_.startsWith("//")||_.startsWith("/*"))continue;if(_==="}")break;if(_.startsWith("if ")||_.startsWith("if(")){let D=!0,j=0,B=!1;for(let Z=E;Z<l.length;Z++){let z=l[Z];if(j+=(z.match(/\{/g)||[]).length,j-=(z.match(/\}/g)||[]).length,Z===E){B=!0;continue}if(j===0){for(let Y=Z+1;Y<l.length;Y++){let X=l[Y].trim();if(X===""||X.startsWith("//"))continue;if(X==="}"||X.startsWith("}"))break;else D=!1;break}break}}if(B&&D)s.push({filePath:b.filePath,line:E+1,column:Math.max(1,l[E].indexOf("if")+1),ruleId:"eslint/no-lonely-if",message:"Unexpected if as the only statement in an else block",severity:"warning"})}break}}}return s},fix:(y,b)=>{if(et.check(y,b).length===0)return y;return y}};var Yt={meta:{docs:"Disallow new operators outside of assignments or comparisons",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];if(/^\s*new\s+\w+\s*\(/.test(i)){if(!/[=:]/.test(i.substring(0,i.indexOf("new"))))s.push({filePath:b.filePath,line:n+1,column:Math.max(1,i.indexOf("new")+1),ruleId:"eslint/no-new",message:"Do not use 'new' for side effects",severity:"warning"})}}return s}};var Xt={meta:{docs:"Disallow new Function() declarations",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\bnew\s+Function\s*\(/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-new-func",message:"The Function constructor is eval",severity:"error"})}}return s}};var Jt={meta:{docs:"Disallow new operators with String, Number, and Boolean",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\bnew\s+(String|Number|Boolean)\s*\(/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-new-wrappers",message:`Do not use ${a[1]} as a constructor`,severity:"error"})}}return s},fix:(y)=>{let b=y.split(/\r?\n/),s=!1,l=b.map((n)=>{if(n.trim().startsWith("//")||n.trim().startsWith("/*"))return n;return n.replace(/\bnew\s+(String|Number|Boolean)\s*\(/g,(w,a)=>(s=!0,`${a}(`))});return s?l.join(`
|
|
7
|
-
`):y}};var Qt={meta:{docs:"Disallow octal literals",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\b0[0-7]+\b/g,a;for(a=w.exec(i);a!==null;a=w.exec(i))s.push({filePath:b.filePath,line:n+1,column:a.index+1,ruleId:"eslint/no-octal",message:"Octal literals should not be used",severity:"error"})}return s}};var en={meta:{docs:"Disallow reassignment of function parameters",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=new Map;for(let i=0;i<l.length;i++){let w=l[i],a=[...w.matchAll(/function\s+(?:(\w+)\s*)?\(([^)]*)\)/g),...w.matchAll(/(?:const|let|var)?\s*(\w+)\s*=\s*\(([^)]*)\)\s*=>/g),...w.matchAll(/(?:const|let|var)?\s*(\w+)\s*=\s*(\w+)\s*=>/g)];for(let P of a){let E=P[2]?P[2].split(",").map((D)=>D.trim().split(/[=:]/)[0].trim()):[],_=`line-${i}`;if(E.length>0)n.set(_,new Set(E.filter((D)=>D&&/^\w+$/.test(D))))}for(let[P,E]of n.entries())for(let _ of E){let D=new RegExp(`\\b${_}\\s*=\\s*[^=]`,"g"),j;for(j=D.exec(w);j!==null;j=D.exec(w))if(!w.slice(j.index).match(/^\w+\s*===?/))s.push({filePath:b.filePath,line:i+1,column:j.index+1,ruleId:"eslint/no-param-reassign",message:`Assignment to function parameter '${_}'`,severity:"error"})}}return s}};var tn={meta:{docs:"Disallow use of __proto__",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/__proto__/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-proto",message:"The '__proto__' property is deprecated",severity:"error"})}}return s},fix:(y)=>{let b=y.split(/\r?\n/),s=!1,l=b.map((n)=>{if(n.trim().startsWith("//")||n.trim().startsWith("/*"))return n;return n.replace(/(\w+)\.__proto__/g,(w,a)=>(s=!0,`Object.getPrototypeOf(${a})`))});return s?l.join(`
|
|
8
|
-
`):y}};var nn={meta:{docs:"Disallow assignment operators in return statements",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\breturn\s[^;]*\b\w+\s*=\s*(?!=)/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){let P=a[0];if(/===|==/.test(P))continue;if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-return-assign",message:"Return statement should not contain assignment",severity:"error"})}}return s}};var sn={meta:{docs:"Disallow comma operators",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\)\s*,\s*\w+\s*\(/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+a[0].indexOf(",")+1),ruleId:"eslint/no-sequences",message:"Unexpected use of comma operator",severity:"warning"})}}return s}};var rn={meta:{docs:"Disallow variable declarations from shadowing variables declared in the outer scope",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),i=[new Set];for(let w=0;w<l.length;w++){let a=l[w];if(a.match(/\bfunction\s+\w+\s*\(|=>\s*\{|\{\s*$/))i.push(new Set);let P=[...a.matchAll(/\b(const|let|var)\s+(\w+)/g),...a.matchAll(/function\s+(\w+)\s*\(/g)];for(let E of P){let _=E[2]||E[1];for(let D=0;D<i.length-1;D++)if(i[D].has(_)){s.push({filePath:b.filePath,line:w+1,column:1,ruleId:"eslint/no-shadow",message:`'${_}' is already declared in the upper scope`,severity:"error"});break}i[i.length-1].add(_)}if(a.match(/^\s*\}\s*$/)){if(i.length>1)i.pop()}}return s}};var on={meta:{docs:"Disallow throwing literals as exceptions",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=[{pattern:/\bthrow\s+(['"`][^'"`]*['"`])/g,type:"string"},{pattern:/\bthrow\s+(\d+)/g,type:"number"},{pattern:/\bthrow\s+(true|false|null|undefined)/g,type:"literal"}];for(let{pattern:a,type:P}of w){let E;while((E=a.exec(i))!==null){if(i.substring(0,E.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,E.index+1),ruleId:"eslint/no-throw-literal",message:`Expected an error object to be thrown, got ${P} literal`,severity:"error"})}}}return s}};var ln={meta:{docs:"Disallow the use of variables before they are defined",recommended:!1},check:(y,b)=>{let s=[],l=c(y).split(/\r?\n/),n=new Map;for(let i=0;i<l.length;i++){let w=l[i],a=[...w.matchAll(/\b(const|let|var)\s+(\w+)/g),...w.matchAll(/\bfunction\s+(\w+)\s*\(/g),...w.matchAll(/\bclass\s+(\w+)/g)];for(let P of a){let E=P[2]||P[1];if(!n.has(E))n.set(E,i+1)}}for(let i=0;i<l.length;i++){let w=l[i];if(w.match(/\b(const|let|var|function|class)\s+\w+/))continue;let a=w.matchAll(/\b(\w+)\b/g);for(let P of a){let E=P[1],_=n.get(E);if(_&&_>i+1)s.push({filePath:b.filePath,line:i+1,column:P.index+1,ruleId:"eslint/no-use-before-define",message:`'${E}' was used before it was defined`,severity:"error"})}}return s}};var cn={meta:{docs:"Disallow unnecessary .call() and .apply()",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\.\s*call\s*\(\s*(undefined|null)\s*,/g,a=/\.\s*apply\s*\(\s*(undefined|null)\s*,/g,P;for(P=w.exec(i);P!==null;P=w.exec(i))s.push({filePath:b.filePath,line:n+1,column:P.index+1,ruleId:"eslint/no-useless-call",message:"Unnecessary '.call()'",severity:"error"});for(P=a.exec(i);P!==null;P=a.exec(i))s.push({filePath:b.filePath,line:n+1,column:P.index+1,ruleId:"eslint/no-useless-call",message:"Unnecessary '.apply()'",severity:"error"})}return s}};var an={meta:{docs:"Disallow unnecessary concatenation of literals or template literals",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=[/(['"`])([^'"`]*)\1\s*\+\s*\1([^'"`]*)\1/g];for(let a of w){let P;while((P=a.exec(i))!==null){if(i.substring(0,P.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,P.index+1),ruleId:"eslint/no-useless-concat",message:"Unexpected string concatenation of literals",severity:"warning"})}}}return s},fix:(y)=>{let b=y;return b=b.replace(/(['"`])([^'"`]*)\1\s*\+\s*\1([^'"`]*)\1/g,"$1$2$3$1"),b}};var Qn=["/","(",")","[","]","{","}","<",">",":","@","#","$","%","&","=","+","-","*","?","!",";",",","|","~","`","^"],un={meta:{docs:"Disallow unnecessary escape characters",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];for(let w of Qn){let a=`\\${w}`,P=new RegExp(`(['"\`])[^'"\`]*${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`,"g"),E;while((E=P.exec(i))!==null){let _=E.index,D=i.indexOf(a,_);if(D>_)s.push({filePath:b.filePath,line:n+1,column:Math.max(1,D+1),ruleId:"eslint/no-useless-escape",message:`Unnecessary escape character: \\${w}`,severity:"warning"})}}}return s},fix:(y)=>{let b=y;for(let s of Qn){let l=`\\${s}`;b=b.replace(new RegExp(l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),s)}return b}};var fn={meta:{docs:"Disallow renaming import, export, and destructured assignments to the same name",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/import\s*\{[^}]*\b(\w+)\s+as\s+\1\b[^}]*\}/g,a;for(a=w.exec(i);a!==null;a=w.exec(i))s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-useless-rename",message:`Renaming import '${a[1]}' to '${a[1]}' is redundant`,severity:"error"});let P=/export\s*\{[^}]*\b(\w+)\s+as\s+\1\b[^}]*\}/g;for(a=P.exec(i);a!==null;a=P.exec(i))s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-useless-rename",message:`Renaming export '${a[1]}' to '${a[1]}' is redundant`,severity:"error"});let E=/\{[^}]*\b(\w+)\s*:\s*\1\b[^}]*\}\s*=/g;for(a=E.exec(i);a!==null;a=E.exec(i))s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-useless-rename",message:`Renaming destructured property '${a[1]}' to '${a[1]}' is redundant`,severity:"error"})}return s},fix:(y)=>{let b=y;return b=b.replace(/\b(\w+)\s+as\s+\1\b/g,"$1"),b=b.replace(/\{([^}]*)\b(\w+)\s*:\s*\2\b([^}]*)\}/g,"{$1$2$3}"),b}};var tt={meta:{docs:"Disallow redundant return statements",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(w==="return"||w==="return;"){let a=!1;for(let P=n+1;P<l.length;P++){let E=l[P].trim();if(E===""||E.startsWith("//")||E.startsWith("/*"))continue;if(E==="}"||E.startsWith("}"))a=!0;break}if(a)s.push({filePath:b.filePath,line:n+1,column:Math.max(1,i.indexOf("return")+1),ruleId:"eslint/no-useless-return",message:"Unnecessary return statement",severity:"warning"})}}return s},fix:(y,b)=>{let s=tt.check(y,b);if(s.length===0)return y;let l=y.split(/\r?\n/),n=new Set(s.map((w)=>w.line-1));return l.filter((w,a)=>!n.has(a)).join(`
|
|
9
|
-
`)}};var mn={meta:{docs:"Require let or const instead of var",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\bvar\s+/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-var",message:"Unexpected var, use let or const instead",severity:"error"})}}return s},fix:(y,b)=>y.split(/\r?\n/).map((n)=>{if(n.trim().startsWith("//")||n.trim().startsWith("/*"))return n;return n.replace(/\bvar\s+/g,"let ")}).join(`
|
|
10
|
-
`)};var pn={meta:{docs:"Disallow with statements",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\bwith\s*\(/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-with",message:"Unexpected use of 'with' statement",severity:"error"})}}return s}};var dn={meta:{docs:"Require using arrow functions for callbacks",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=/\.(map|filter|reduce|forEach|some|every|find|findIndex)\s*\(\s*function\s*\(/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/prefer-arrow-callback",message:"Unexpected function expression, use arrow function instead",severity:"warning"})}}return s}};var hn={meta:{docs:"Disallow async functions which have no await expression",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++)if(l[n].match(/\basync\s+(?:function\s+\w+|(?:\(|\w+)\s*(?:\(|=>))/)){let a=!1,P=0,E=!1,_=n;while(_<l.length){let D=l[_];for(let j of D){if(j==="{")P++,E=!0;if(j==="}"){if(P--,P===0&&E)break}}if(D.match(/\bawait\s+/))a=!0;if(P===0&&E){if(!a)s.push({filePath:b.filePath,line:n+1,column:1,ruleId:"eslint/require-await",message:"Async function has no await expression",severity:"error"});break}_++}}return s}};var es={name:"eslint",rules:{"array-callback-return":e(ct),"constructor-super":e(at),"for-direction":e(ut),"getter-return":e(ft),"no-async-promise-executor":e(mt),"no-compare-neg-zero":e(pt),"no-cond-assign":e(dt),"no-constant-condition":e(gt),"no-const-assign":e(ht),"no-dupe-class-members":e(yt),"no-dupe-keys":e(Je),"no-duplicate-case":e(bt),"no-empty-pattern":e(xt),"no-fallthrough":e(Rt),"no-loss-of-precision":e(wt),"no-promise-executor-return":e(kt),"no-redeclare":e(It),"no-self-assign":e(Qe),"no-self-compare":e(Pt),"no-sparse-arrays":e(Mt),"no-undef":e(vt),"no-unsafe-negation":e(Ct),"no-unreachable":e($t),"no-useless-catch":e(Lt),"use-isnan":e(St),"valid-typeof":e(Et),"default-case":e(Ot),eqeqeq:e(_t),"no-alert":e(Nt),"no-await-in-loop":e(Dt),"no-caller":e(jt),"no-case-declarations":e(Ut),"no-else-return":e(Ft),"no-empty":e(Bt),"no-empty-function":e(qt),"no-eval":e(zt),"no-extend-native":e(Zt),"no-global-assign":e(Vt),"no-implied-eval":e(Kt),"no-iterator":e(Ht),"no-new":e(Yt),"no-new-func":e(Xt),"no-new-wrappers":e(Jt),"no-octal":e(Qt),"no-param-reassign":e(en),"no-proto":e(tn),"no-return-assign":e(nn),"no-shadow":e(rn),"no-throw-literal":e(on),"no-use-before-define":e(ln),"no-useless-call":e(cn),"no-with":e(pn),"require-await":e(hn),complexity:e(At),"max-depth":e(Tt),"max-lines-per-function":e(Wt),"no-extra-boolean-cast":e(Gt),"no-lonely-if":e(et),"no-sequences":e(sn),"no-useless-concat":e(an),"no-useless-escape":e(un),"no-useless-rename":e(fn),"no-useless-return":e(tt),"no-var":e(mn),"prefer-arrow-callback":e(dn)}};var ts={meta:{docs:"Disallow return statements in constructors - constructors automatically return the instance"},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.indexOf("//");if(!(w>=0?i.slice(0,w):i).match(/\bconstructor\s*\(/))continue;let E=0,_=!1,D=-1;for(let j=n;j<l.length;j++){let B=l[j],Z=null,z=!1;for(let Y=0;Y<B.length;Y++){let X=B[Y];if(z){z=!1;continue}if(X==="\\"&&Z){z=!0;continue}if(!Z){if(X==="'")Z="single";else if(X==='"')Z="double";else if(X==="`")Z="template";else if(X==="{")E++,_=!0;else if(X==="}"){if(E--,_&&E===0){D=j;break}}}else if(Z==="single"&&X==="'"||Z==="double"&&X==='"'||Z==="template"&&X==="`")Z=null}if(D!==-1)break}if(D===-1)continue;for(let j=n;j<=D;j++){let B=l[j];if(j===n)continue;if(/^\s*\/\//.test(B))continue;let Z=B.indexOf("//"),z=Z>=0?B.slice(0,Z):B;if(z=z.replace(/(['"`])(?:(?!\1)[^\\]|\\.)*?\1/g,'""'),z.match(/\breturn\b/)){let X=z.indexOf("return"),J=X>0?z[X-1]:" ",ie=X+6<z.length?z[X+6]:" ";if(/\w/.test(J)||/\w/.test(ie))continue;let Q=z.slice(X+6).trim();if(Q.startsWith("this;")||Q==="this")continue;if(Q===";"||Q==="")continue;let ee=B.indexOf("return");s.push({filePath:b.filePath,line:j+1,column:ee+1||1,ruleId:"no-constructor-return",message:"Unexpected return statement in constructor. Constructors should not return values.",severity:"error",help:"Remove the return statement or move the logic outside of the constructor"})}}}return s}};var ns={meta:{docs:"Disallow irregular whitespace characters that may cause issues in code"},check:(y,b)=>{let s=[],l=/[\u00A0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/g,n=y.split(/\r?\n/);for(let i=0;i<n.length;i++){let w=n[i],a;l.lastIndex=0;while((a=l.exec(w))!==null){let E=a[0].charCodeAt(0),_="irregular whitespace",D={160:"NO-BREAK SPACE",5760:"OGHAM SPACE MARK",6158:"MONGOLIAN VOWEL SEPARATOR",8192:"EN QUAD",8193:"EM QUAD",8194:"EN SPACE",8195:"EM SPACE",8196:"THREE-PER-EM SPACE",8197:"FOUR-PER-EM SPACE",8198:"SIX-PER-EM SPACE",8199:"FIGURE SPACE",8200:"PUNCTUATION SPACE",8201:"THIN SPACE",8202:"HAIR SPACE",8232:"LINE SEPARATOR",8233:"PARAGRAPH SEPARATOR",8239:"NARROW NO-BREAK SPACE",8287:"MEDIUM MATHEMATICAL SPACE",12288:"IDEOGRAPHIC SPACE",65279:"ZERO WIDTH NO-BREAK SPACE"};if(D[E])_=D[E];s.push({filePath:b.filePath,line:i+1,column:a.index+1,ruleId:"no-irregular-whitespace",message:`Irregular whitespace detected: ${_} (U+${E.toString(16).toUpperCase().padStart(4,"0")})`,severity:"error",help:"Replace irregular whitespace with regular spaces or tabs"})}}return s},fix:(y)=>y.replace(/[\u00A0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/g," ")};var ss={meta:{docs:"Disallow new operators outside of assignments or comparisons",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(w.startsWith("//")||w.startsWith("/*")||w.startsWith("*"))continue;if(/^\s*new\s+\w+/.test(i)){let P=/^\s*(?:const|let|var|this\.\w+)\s*=\s*new\s+/,E=/^\s*return\s+new\s+/,_=new RegExp("^\\s*new\\s+\\w[^;]*,"),D=/[=:,(]\s*new\s+/;if(!P.test(i)&&!E.test(i)&&!_.test(i)&&!D.test(w)){let j=i.search(/new\s+/)+1;s.push({filePath:b.filePath,line:n+1,column:j,ruleId:"no-new",message:"Do not use 'new' for side effects",severity:"error",help:"Either assign the result to a variable or remove the 'new' operator if the side effect is intentional."})}}}return s}};var is={meta:{docs:"Disallow multiple spaces in regular expressions",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];if(/^\s*\/\//.test(i))continue;let w=/\/(?![*/])((?:\\.|[^/\\])+)\/[gimsuvy]*/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){let E=a[1];if(/ {2,}/.test(E)){let _=a.index+1;s.push({filePath:b.filePath,line:n+1,column:_,ruleId:"no-regex-spaces",message:"Multiple spaces in regular expression",severity:"error",help:"Use quantifiers like {2} instead of multiple spaces for clarity."})}}let P=/new\s+RegExp\s*\(\s*['"`]([^'"`]+)['"`]/g;for(a=P.exec(i);a!==null;a=P.exec(i)){let E=a[1];if(/ {2,}/.test(E)){let _=a.index+1;s.push({filePath:b.filePath,line:n+1,column:_,ruleId:"no-regex-spaces",message:"Multiple spaces in regular expression",severity:"error",help:"Use quantifiers like {2} instead of multiple spaces for clarity."})}}}return s}};var rs=new Set(["|","&",":",",","<"]);function os(y){return G(y)}function gn(y,b){if(y[b+1]==="/"||y[b+1]==="*")return!1;let s=y.slice(0,b).trimEnd();return!s||/[=([{,:;!&|?]$/.test(s)||s.endsWith("=>")||s.endsWith("return")}var Fe={meta:{docs:"Report variables and parameters that are declared/assigned but never used"},check:(y,b)=>{if(b.filePath.endsWith("/no-unused-vars.ts"))return[];if(b.filePath.endsWith(".d.ts"))return[];let s=[],l=b.options||{},n=typeof l.varsIgnorePattern==="string"?l.varsIgnorePattern:"^_",i=typeof l.argsIgnorePattern==="string"?l.argsIgnorePattern:"^_",w=new RegExp(n,"u"),a=new RegExp(i,"u"),P=g(y),E=I(y,{comments:!0},P),_=E.split(/\r?\n/),D=E,j=S(y,P),B=null,Z=[],z=(te,ue)=>{let ce=new RegExp(`\\b${te}\\b`,"g");if(te.includes("$"))return ce.test(`${_.slice(0,ue).join(`
|
|
11
|
-
`)}
|
|
12
|
-
${_.slice(ue+1).join(`
|
|
13
|
-
`)}`);if(B===null){B=_.join(`
|
|
14
|
-
`),Z=Array.from({length:_.length});let oe=0;for(let xe=0;xe<_.length;xe++)Z[xe]=oe,oe+=_[xe].length+1}let ae=Z[ue],de=ae+_[ue].length;for(let oe=ce.exec(B);oe!==null;oe=ce.exec(B)){if(oe.index<ae||oe.index>=de)return!0;if(oe[0].length===0)ce.lastIndex++}return!1},Y=new RegExp("^\\s*(?:const|let|var)\\s+(.+?);?\\s*$");for(let te=0;te<_.length;te++){if(j[te])continue;let ue=_[te],ce=ue.match(Y);if(!ce)continue;let ae=ce[1],de=[],oe="",xe=0,he=0,fe=null,ke=!1;for(let re=0;re<ae.length;re++){let se=ae[re];if(ke){ke=!1,oe+=se;continue}if(se==="\\"&&fe){ke=!0,oe+=se;continue}if(!fe){if(se==="/"&&ae[re+1]==="/")break;if(se==="/"&&ae[re+1]==="*"){re+=2;while(re<ae.length&&!(ae[re]==="*"&&ae[re+1]==="/"))re++;re++;continue}if(se==="'")fe="single";else if(se==='"')fe="double";else if(se==="`")fe="template";else if(se==="<")he++;else if(se===">")he--;else if(se==="("||se==="["||se==="{")xe++;else if(se===")"||se==="]"||se==="}")xe--;else if(se===","&&xe===0&&he===0){de.push(oe),oe="";continue}}else if(fe==="single"&&se==="'"||fe==="double"&&se==='"'||fe==="template"&&se==="`")fe=null;oe+=se}if(oe)de.push(oe);for(let re of de){let se=re.trim();if(!se)continue;let pe=se.match(/^([$A-Z_][\w$]*)/i),me=[];if(pe)me.push(pe[1]);else if(se.startsWith("{")||se.startsWith("[")){let ne=se[0],Re=ne==="{"?"}":"]",Me=0,ve=-1,Ie=null,Ae=!1;for(let Ee=0;Ee<se.length;Ee++){let Se=se[Ee];if(Ae){Ae=!1;continue}if(Se==="\\"&&Ie){Ae=!0;continue}if(!Ie){if(Se==="'"||Se==='"'||Se==="`")Ie=Se==="'"?"single":Se==='"'?"double":"template";else if(Se===ne)Me++;else if(Se===Re){if(Me--,Me===0){ve=Ee;break}}}else if(Ie==="single"&&Se==="'"||Ie==="double"&&Se==='"'||Ie==="template"&&Se==="`")Ie=null}if(ve>0){let Ee=se.slice(1,ve),Se=[],Ce="",Oe=0,_e=null,we=!1;for(let Pe=0;Pe<Ee.length;Pe++){let ye=Ee[Pe];if(we){we=!1,Ce+=ye;continue}if(ye==="\\"&&_e){we=!0,Ce+=ye;continue}if(!_e){if(ye==="'"||ye==='"'||ye==="`"){_e=ye==="'"?"single":ye==='"'?"double":"template",Ce+=ye;continue}if(ye==="("||ye==="{"||ye==="[")Oe++;if(ye===")"||ye==="}"||ye==="]")Oe--;if(ye===","&&Oe===0){Se.push(Ce.trim()),Ce="";continue}}else if(_e==="single"&&ye==="'"||_e==="double"&&ye==='"'||_e==="template"&&ye==="`")_e=null;Ce+=ye}if(Ce.trim())Se.push(Ce.trim());for(let Pe of Se){if(Pe.startsWith("...")){let $e=Pe.slice(3).match(/^([$A-Z_][\w$]*)/i);if($e)me.push($e[1]);continue}let ye=Pe.indexOf(":");if(ye!==-1){let $e=Pe.slice(ye+1).trim(),je=0;for(let Ue=0;Ue<$e.length;Ue++){let We=$e[Ue];if(We==="("||We==="{"||We==="[")je++;else if(We===")"||We==="}"||We==="]")je--;else if(We==="="&&je===0){$e=$e.slice(0,Ue).trim();break}}let Ne=$e.match(/^([$A-Z_][\w$]*)/i);if(Ne)me.push(Ne[1])}else{let $e=Pe,je=0;for(let Ue=0;Ue<$e.length;Ue++){let We=$e[Ue];if(We==="("||We==="{"||We==="[")je++;else if(We===")"||We==="}"||We==="]")je--;else if(We==="="&&je===0){$e=$e.slice(0,Ue).trim();break}}let Ne=$e.match(/^([$A-Z_][\w$]*)/i);if(Ne)me.push(Ne[1])}}}}for(let ne of me){if(w.test(ne))continue;if(!z(ne,te))s.push({filePath:b.filePath,line:te+1,column:Math.max(1,ue.indexOf(ne)+1),ruleId:"pickier/no-unused-vars",message:`'${ne}' is assigned a value but never used. Allowed unused vars must match pattern: ${n}`,severity:"error",help:`Either use this variable in your code, remove it, or prefix it with an underscore (_${ne}) to mark it as intentionally unused`})}}}let X=(te)=>{let ce=((oe)=>{let xe="",he=null,fe=!1,ke=0;for(let re=0;re<oe.length;re++){let se=oe[re];if(fe){fe=!1;continue}if(se==="\\"&&he){fe=!0;continue}if(!he){if(se==="'")he="single";else if(se==='"')he="double";else if(se==="`")he="template";else if(se==="("||se==="{"||se==="[")ke++;else if(se===")"||se==="}"||se==="]")ke--;else if(se==="="&&ke===0)return xe}else if(he==="single"&&se==="'"||he==="double"&&se==='"'||he==="template"&&se==="`")he=null;xe+=se}return xe})(te);return((oe)=>{let xe="",he=0;while(he<oe.length){let fe=oe[he];if(fe===":"){he++;while(he<oe.length&&/\s/.test(oe[he]))he++;let ke=0,re=0,se=null,pe=!1;while(he<oe.length){let me=oe[he];if(pe){pe=!1,he++;continue}if(me==="\\"&&se){pe=!0,he++;continue}if(!se){if(me==="'")se="single";else if(me==='"')se="double";else if(me==="`")se="template";else if(me==="<")re++;else if(me===">")re--;else if(me==="("||me==="{"||me==="[")ke++;else if(me===")"||me==="}"||me==="]")if(ke>0)ke--;else break;else if(me===","&&ke===0&&re===0)break}else if(se==="single"&&me==="'"||se==="double"&&me==='"'||se==="template"&&me==="`")se=null;he++}continue}xe+=fe,he++}return xe})(ce).split(/[^$\w]+/).filter((oe)=>oe&&oe!=="undefined")},J=(te,ue)=>{let ce=/^\s*(?:export\s+)?(?:default\s+)?(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function\b|class\b|const\b|let\b|var\b|interface\b|type\b)/;for(let ae=te;ae<_.length;ae++){let oe=(ae===te?_[ae].slice(ue+1):_[ae]).replace(/\/\/.*$/,"");if(ae!==te&&ce.test(oe))return!0;if(oe.includes("{"))return!1;if(oe.includes(";"))return!0}return!0},ie=(te,ue)=>{let ce=0,ae=!1,de=0,oe=0,xe=!1,he=0,fe=null,ke=!1,re=!0,se="",pe=!1,me=!1,ne=[],Re=!1;for(let Me=te;Me<_.length;Me++){let ve=_[Me],Ie=ve,Ae=ne.length>0&&ne[ne.length-1]===-1,Ee=-1,Se=null,Ce=!1;if(!Ae)for(let we=0;we<ve.length-1;we++){let Pe=ve[we],ye=ve[we+1];if(Ce){Ce=!1;continue}if(Pe==="\\"&&Se){Ce=!0;continue}if(!Se){if(Pe==="'")Se="single";else if(Pe==='"')Se="double";else if(Pe==="`")Se="template";else if(Pe==="/"&&ye==="/"){Ee=we;break}}else if(Se==="single"&&Pe==="'"||Se==="double"&&Pe==='"'||Se==="template"&&Pe==="`")Se=null}if(Ee>=0)Ie=ve.slice(0,Ee);let Oe=(we)=>{let Pe="",ye=0,$e=null,je=!1;while(ye<we.length){let Ne=we[ye];if(je){je=!1,Pe+=Ne,ye++;continue}if(Ne==="\\"&&$e){je=!0,Pe+=Ne,ye++;continue}if(!$e){if(Ne==="'")$e="single";else if(Ne==='"')$e="double";else if(Ne==="`")$e="template";else if(Ne==="/"){if(gn(we,ye)){let Ue=ye,We=!1;ye++;while(ye<we.length){if(we[ye]==="\\"){ye+=2;continue}if(we[ye]==="[")We=!0;else if(we[ye]==="]")We=!1;if(we[ye]==="/"&&!We){ye++;while(ye<we.length&&/[gimsuvy]/.test(we[ye]))ye++;break}ye++}Pe+=" ".repeat(Math.min(ye,we.length)-Ue);continue}}}else if($e==="single"&&Ne==="'"||$e==="double"&&Ne==='"'||$e==="template"&&Ne==="`")$e=null;Pe+=Ne,ye++}return Pe};if(!Ae)Ie=Oe(Ie);let _e=0;if(!ae){let we=-1,Pe=re?typeof ue==="number"?ue:0:0;if(re=!1,Pe>=Ie.length){let ye=Ie.indexOf("=>");Pe=ye>=0?ye+2:0}for(let ye=Pe;ye<Ie.length;ye++){let $e=Ie[ye];if(ke){ke=!1;continue}if($e==="\\"&&fe){ke=!0;continue}if(!fe){if($e!==" "&&$e!=="\t"&&$e!==`
|
|
15
|
-
`&&$e!=="\r"&&$e!=="{"&&$e!=="}"&&oe===0)se=$e;if($e==="'")fe="single";else if($e==='"')fe="double";else if($e==="`")fe="template";else if($e==="<")he++;else if($e===">")he=Math.max(0,he-1);else if($e==="{"){if(oe===0){if(xe&&he===0&&!rs.has(se)){we=ye;break}}oe++}else if($e==="}"){if(oe>0){if(oe--,oe===0)xe=!0,se="}"}}}else if(fe==="single"&&$e==="'"||fe==="double"&&$e==='"'||fe==="template"&&$e==="`")fe=null}if(we===-1){if(he>0)continue;if(oe>0&&rs.has(se))continue;for(let ye=Pe;ye<Ie.length;ye++)if(Ie[ye]==="{"&&!fe){we=ye;break}}if(we===-1)continue;ae=!0,de=1,_e=we+1,ce=we,te=Me}for(let we=_e;we<Ie.length;we++){let Pe=Ie[we];if(Re){Re=!1;continue}let ye=ne.length>0&&ne[ne.length-1]===-1,$e=ne.length>0&&ne[ne.length-1]>=0;if(Pe==="\\"&&(pe||me||ye)){Re=!0;continue}if(pe){if(Pe==="'")pe=!1;continue}if(me){if(Pe==='"')me=!1;continue}if(ye){if(Pe==="`")ne.pop();else if(Pe==="$"&&we+1<Ie.length&&Ie[we+1]==="{")ne[ne.length-1]=0,we++;continue}if($e){if(Pe==="/"){if(gn(Ie,we)){we++;while(we<Ie.length){if(Ie[we]==="\\"){we+=2;continue}if(Ie[we]==="/"){while(we+1<Ie.length&&/[gimsuvy]/.test(Ie[we+1]))we++;break}we++}continue}}if(Pe==="`"){ne.push(-1);continue}if(Pe==="'"){pe=!0;continue}if(Pe==='"'){me=!0;continue}if(Pe==="{"){ne[ne.length-1]++;continue}if(Pe==="}")if(ne[ne.length-1]>0)ne[ne.length-1]--;else ne[ne.length-1]=-1;continue}if(Pe==="'")pe=!0;else if(Pe==='"')me=!0;else if(Pe==="`")ne.push(-1);else if(Pe==="{")de++;else if(Pe==="}"){if(de--,de===0)return{from:te,to:Me,openCol:ce}}}}return null},Q=(te,ue)=>{let ce={parenDepth:0,braceDepth:0,bracketDepth:0,inTemplate:!1},ae=(re)=>{for(let se=0;se<re.length;se++){let pe=re[se];if(pe==="`")ce.inTemplate=!ce.inTemplate;else if(pe==="(")ce.parenDepth++;else if(pe===")")ce.parenDepth--;else if(pe==="{")ce.braceDepth++;else if(pe==="}")ce.braceDepth--;else if(pe==="[")ce.bracketDepth++;else if(pe==="]")ce.bracketDepth--}},de=()=>ce.parenDepth>0||ce.braceDepth>0||ce.bracketDepth>0||ce.inTemplate,oe=(re)=>/(?:\?|:|\.|,|&&|\|\||\?\?|\+|-|\*|\/|%|\*\*)$/.test(re.trimEnd()),xe=(re)=>/^(?:\?|:|\.|,|&&|\|\||\?\?|\+|-|\*|\/|%|\*\*)/.test(re.trimStart()),he=_[te].slice(ue+2);ae(he);let fe=he.trim()!=="",ke=te+1;while(ke<_.length){let re=ke===te+1?he:_[ke-1];if(!(!fe||de()||oe(re)||xe(_[ke])))break;he+=`
|
|
16
|
-
${_[ke]}`,fe||=_[ke].trim()!=="",ae(_[ke]),ke++}return he},ee=[],le=!1,ge=!1,be=!1;for(let te=0;te<_.length;te++){let ue=_[te];if(/^\s*\/\//.test(ue))continue;if(j[te])continue;let ce=ue,ae=null,de=!1,oe=!1;for(let pe=0;pe<ue.length-1;pe++){let me=ue[pe],ne=ue[pe+1];if(oe){oe=!1;continue}if(me==="\\"&&(ae||de)){oe=!0;continue}if(!ae&&!de){if(me==="'")ae="single";else if(me==='"')ae="double";else if(me==="`")ae="template";else if(me==="/"){if(gn(ue,pe))de=!0;else if(ne==="/"){ce=ue.slice(0,pe);break}}}else if(ae){if(ae==="single"&&me==="'"||ae==="double"&&me==='"'||ae==="template"&&me==="`")ae=null}else if(de&&me==="/")de=!1}let fe=((pe)=>{let me="",ne=0;while(ne<pe.length){if(pe[ne]==="/"){if(gn(pe,ne)){ne++;while(ne<pe.length){if(pe[ne]==="\\"){ne+=2;continue}if(pe[ne]==="/"){ne++;while(ne<pe.length&&/[gimsuvy]/.test(pe[ne]))ne++;break}ne++}continue}}me+=pe[ne],ne++}return me})(ce).replace(/'(?:[^'\\]|\\.)*'/g,"''").replace(/"(?:[^"\\]|\\.)*"/g,'""');if(!(!be&&!le&&!ge&&ee.length===0&&!fe.includes("`")&&!fe.includes("'")&&!fe.includes('"'))){let pe="";for(let me=0;me<fe.length;me++){let ne=fe[me];if(be){be=!1;let ve=ee.length>0&&ee[ee.length-1]===-1;pe+=ve?" ":ne;continue}let Re=ee.length>0&&ee[ee.length-1]===-1,Me=ee.length>0&&ee[ee.length-1]>=0;if(ne==="\\"&&(le||ge||Re)){be=!0,pe+=Re?" ":ne;continue}if(le){if(ne==="'")le=!1;pe+=ne;continue}if(ge){if(ne==='"')ge=!1;pe+=ne;continue}if(Re){if(ne==="`")ee.pop();else if(ne==="$"&&me+1<fe.length&&fe[me+1]==="{")ee[ee.length-1]=0,pe+=" ",me++;else pe+=" ";continue}if(Me){if(ne==="`")ee.push(-1),pe+=" ";else if(ne==="'")le=!0,pe+=ne;else if(ne==='"')ge=!0,pe+=ne;else if(ne==="{")ee[ee.length-1]++,pe+=ne;else if(ne==="}")if(ee[ee.length-1]>0)ee[ee.length-1]--,pe+=ne;else ee[ee.length-1]=-1,pe+=" ";else pe+=ne;continue}if(ne==="`")ee.push(-1),pe+=" ";else if(ne==="'")le=!0,pe+=ne;else if(ne==='"')ge=!0,pe+=ne;else pe+=ne}fe=pe}let re=fe.match(/\bfunction\b/);if(re){if(ue.includes("function scanContent")||ue.includes("function findMatching"))continue;if(fe.slice(re.index+8).trimStart().startsWith(":"))continue;let me=fe.slice(0,re.index).trimEnd();if(me.endsWith(".")||me.endsWith("?."))continue;let ne=re.index,Re=ue.indexOf("(",ne);if(Re===-1)continue;let Me=0,ve=-1,Ie=te,Ae="";for(let Oe=te;Oe<_.length;Oe++){let _e=Oe===te?_[Oe]:_[Oe],we=Oe===te?Re:0;for(let Pe=we;Pe<_e.length;Pe++)if(_e[Pe]==="(")Me++;else if(_e[Pe]===")"){if(Me--,Me===0){if(ve=Pe,Ie=Oe,te===Oe)Ae=ue.slice(Re+1,ve);else{Ae=ue.slice(Re+1);for(let ye=te+1;ye<Oe;ye++)Ae+=` ${_[ye]}`;Ae+=` ${_e.slice(0,ve)}`}break}}if(ve!==-1)break}if(ve===-1)continue;if(J(Ie,ve))continue;let Ee=X(Ae),Se=ie(Ie,ve),Ce="";if(Se)if(Se.from===Ie){let Oe=_[Se.from],_e=Se.openCol,we=_e>=0?Oe.slice(_e+1):"";if(Se.to>Se.from)Ce=`${we}
|
|
17
|
-
${_.slice(Se.from+1,Se.to+1).join(`
|
|
18
|
-
`)}`;else Ce=we}else Ce=_.slice(Se.from,Se.to+1).join(`
|
|
19
|
-
`);for(let Oe of Ee){if(!Oe||a.test(Oe)||Oe==="undefined")continue;if(!new RegExp(`\\b${Oe}\\b`,"g").test(Ce))s.push({filePath:b.filePath,line:te+1,column:Math.max(1,ue.indexOf(Oe)+1),ruleId:"pickier/no-unused-vars",message:`'${Oe}' is defined but never used (function parameter). Allowed unused args must match pattern: ${i}`,severity:"error"})}continue}let se=ue.indexOf("=>");if(se!==-1&&fe.includes("=>")){let pe=-1;for(let me=se-1;me>=0;me--){let ne=ue[me];if(ne===")"){pe=me;break}if(ne!==" "&&ne!=="\t"&&ne!==`
|
|
20
|
-
`&&ne!==":"&&ne!==">"&&!/\w/.test(ne))break}if(pe!==-1){let me=-1,ne=1;for(let Re=pe-1;Re>=0;Re--){let Me=ue[Re];if(Me===")")ne++;else if(Me==="("){if(ne--,ne===0){me=Re;break}}}if(me!==-1){let Re=!1,Me=0,ve=0;for(let Ae=me-1;Ae>=0;Ae--){let Ee=ue[Ae];if(Ee===">"){Me++;continue}if(Ee==="<"){if(Me>0){Me--;continue}if(ve<=0){Re=!0;break}continue}if(Ee===":"&&Me===0&&ve<=0){Re=!0;break}if(Me>0)continue;if(Ee===",")continue;if(Ee===")"){ve++;continue}if(Ee==="("){ve--;continue}if(Ee==="|"||Ee==="&"){Re=!0;break}if(Ee==="="||Ee==="{"||Ee==="["){if(ve>=0)break;continue}if(Ee!==" "&&Ee!=="\t"&&!/[\w.]/.test(Ee)){if(ve>=0)break}}if(!Re){let Ae=ue.slice(0,me);if(/^\s*(?:export\s+)?(?:declare\s+)?type\s+\w[\w$]*\s*(?:<[^>]*>)?\s*=\s*$/.test(Ae))Re=!0;else if(/\bas\s+$/.test(Ae))Re=!0}if(Re)continue;let Ie=ue.slice(me+1,pe);if(!(Ie.trim()===""&&ue.slice(Math.max(0,me-10),me).includes("async"))){let Ae=X(Ie);if(Ae.length>0){let Ee="";if(ue.slice(se+2).trimStart().startsWith("{")){let Ce=ie(te,se);if(Ce)if(Ce.from===te){let Oe=_[Ce.from],_e=Oe.indexOf("{",se),we=_e>=0?Oe.slice(_e+1):"";if(Ce.to>Ce.from)Ee=`${we}
|
|
21
|
-
${_.slice(Ce.from+1,Ce.to+1).join(`
|
|
22
|
-
`)}`;else Ee=we}else Ee=_.slice(Ce.from,Ce.to+1).join(`
|
|
23
|
-
`)}else Ee=Q(te,se);for(let Ce of Ae){if(!Ce||a.test(Ce)||Ce==="undefined")continue;if(!new RegExp(`\\b${Ce}\\b`,"g").test(Ee))s.push({filePath:b.filePath,line:te+1,column:Math.max(1,ue.indexOf(Ce)+1),ruleId:"pickier/no-unused-vars",message:`'${Ce}' is defined but never used (function parameter). Allowed unused args must match pattern: ${i}`,severity:"error"})}continue}}}}}{let pe=/(?:^|[=,:({\s])\s*([$A-Z_][\w$]*)\s*=>/gi,me;while((me=pe.exec(fe))!==null){let ne=me[1];if(!ne||a.test(ne)||ne==="undefined")continue;let Re=fe.slice(0,me.index+me[0].indexOf(ne)).trimEnd();if(/\)\s*:$/.test(Re)||/\)\s*:\s*$/.test(Re))continue;if(/\)\s*:\s*[$A-Z_][\w$]*\s+is$/i.test(Re))continue;if(/^(?:string|number|boolean|void|never|any|unknown|object|bigint|symbol|undefined|null)$/.test(ne))continue;let Me=new RegExp(`\\b${ne}\\s*=>`),ve=ue.match(Me);if(!ve)continue;let Ie=ue.indexOf(ve[0])+ve[0].lastIndexOf("=>"),Ae="";if(ue.slice(Ie+2).trimStart().startsWith("{")){let Ce=ie(te,Ie);if(Ce)if(Ce.from===te){let Oe=_[Ce.from],_e=Oe.indexOf("{",Ie),we=_e>=0?Oe.slice(_e+1):"";if(Ce.to>Ce.from)Ae=`${we}
|
|
24
|
-
${_.slice(Ce.from+1,Ce.to+1).join(`
|
|
25
|
-
`)}`;else Ae=we}else Ae=_.slice(Ce.from,Ce.to+1).join(`
|
|
26
|
-
`)}else Ae=Q(te,Ie);if(!new RegExp(`\\b${ne}\\b`,"g").test(Ae))s.push({filePath:b.filePath,line:te+1,column:Math.max(1,ue.indexOf(ne)+1),ruleId:"pickier/no-unused-vars",message:`'${ne}' is defined but never used (function parameter). Allowed unused args must match pattern: ${i}`,severity:"error"})}}}return s},fix:(y,b)=>{let s=Fe.check(y,b);if(s.length===0)return y;let l=s.filter((B)=>B.message.includes("(function parameter)"));if(l.length===0)return y;let n=y.split(/\r?\n/),i=new Set,w=/(?:eslint|pickier)-disable-next-line\b([^*\n]*)/;for(let B=0;B<n.length;B++){let Z=n[B].match(w);if(!Z)continue;let z=Z[1].trim();if(z===""||/\bno-unused-vars\b/.test(z)||/\bpickier\/no-unused-vars\b/.test(z))i.add(B+2)}let a=new Map;for(let B of l){if(i.has(B.line))continue;let Z=B.message.match(/^'([^']+)'/);if(!Z)continue;let z=Z[1];if(z.startsWith("_"))continue;let Y=a.get(B.line);if(!Y)Y=new Set,a.set(B.line,Y);Y.add(z)}if(a.size===0)return y;let P=y.split(/\r?\n/),E=g(y),_=[0];for(let B=0;B<y.length;B++)if(y[B]===`
|
|
27
|
-
`)_.push(B+1);let D=(B)=>E.templates.some(([Z,z])=>B>Z&&B<z)||E.regions.some((Z)=>Z.kind!=="template"&&B>=Z.start&&B<Z.end),j=!1;for(let[B,Z]of a){let z=B-1,Y=P[z];if(Y===void 0)continue;let X=_[z]??0,J=[];for(let Q of Z){let ee=Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),le=new RegExp(`(?<=[(,]\\s*)\\b${ee}\\b(?=\\s*[,):=])`,"g"),ge;while((ge=le.exec(Y))!==null){if(D(X+ge.index))continue;J.push({start:ge.index,end:ge.index+Q.length,name:Q})}}if(J.length===0)continue;J.sort((Q,ee)=>ee.start-Q.start);let ie=Y;for(let Q of J)ie=`${ie.slice(0,Q.start)}_${Q.name}${ie.slice(Q.end)}`;if(ie!==Y)P[z]=ie,j=!0}return j?P.join(`
|
|
28
|
-
`):y}};function Be(y){return S(y)}function nl(y,b){let s=[],l=0,n=0,i=null,w=!1;for(let a=0;a<y.length;a++){let P=y[a];if(w){w=!1;continue}if(P==="\\"&&i){w=!0;continue}if(!i){if(P==="'")i="single";else if(P==='"')i="double";else if(P==="`")i="template";else if(P==="("||P==="{"||P==="[")l++;else if(P===")"||P==="}"||P==="]")l--;else if(P===b&&l===0)s.push(y.slice(n,a)),n=a+1}else if(i==="single"&&P==="'"||i==="double"&&P==='"'||i==="template"&&P==="`")i=null}return s.push(y.slice(n)),s}function sl(y){let b=0;for(let s=0;s<y.length;s++){let l=y[s];if(l==="{"||l==="("||l==="["||l==="<")b++;else if(l==="}"||l===")"||l==="]"||l===">")b--;else if(l==="="&&b===0&&y[s+1]!=="="&&y[s-1]!=="!"&&y[s-1]!=="<"&&y[s-1]!==">")return s}return-1}function il(y,b){let s=new RegExp(`\\b${b}\\b`),l=0,n=null,i=!1;while(l<y.length){let w=y[l];if(i){i=!1,l++;continue}if(w==="\\"&&n){i=!0,l++;continue}if(n){if(n==="single"&&w==="'"||n==="double"&&w==='"'||n==="template"&&w==="`")n=null;l++;continue}if(w==="'"){n="single",l++;continue}if(w==='"'){n="double",l++;continue}if(w==="`"){n="template",l++;continue}if(w==="["||w==="{"){let a=w,P=w==="["?"]":"}",E=1,_=l+1;while(_<y.length&&E>0){let D=y[_];if(D==="\\"){_+=2;continue}if(D===a)E++;else if(D===P)E--;if(E===0)break;_++}if(E===0&&_<y.length){let D=_+1;while(D<y.length&&(y[D]===" "||y[D]==="\t"||y[D]==="\r"||y[D]===`
|
|
29
|
-
`))D++;if(y[D]==="="&&y[D+1]!=="="&&y[D+1]!==">"){let j=y.slice(l+1,_);if(s.test(j)){let B=new RegExp(`\\b${b}\\b\\s*:`),Z=new RegExp(`:\\s*\\b${b}\\b`);if(a==="{"){if(!(B.test(j)&&!Z.test(j)&&!new RegExp(`(?:^|[\\s,{])\\s*${b}\\s*(?:,|\\s*=|\\s*})`).test(j)))return!0}else return!0}}}l=_+1;continue}l++}return!1}function ls(y,b){let s=new RegExp("^\\s*(?:let|var)\\s+(.+?);?\\s*$"),l=y.match(s);if(!l)return null;let n=l[1],i=sl(n);if(i>=0){let P=n.indexOf(":");if(P>=0&&P<i)n=n.slice(0,P)+n.slice(i)}let w=nl(n,","),a=[];for(let P of w){let E=P.trim();if(!E)continue;if(E.match(/^[{[]/))return null;let D=E.match(/^([$A-Z_][\w$]*)/i);if(!D)return null;let j=D[1];if(!/=/.test(E))return null;let Z=b.indexOf(y),Y=`\\b${j}\\s*(?:${[">>>=","**=","<<=",">>=","??=","||=","&&=","+=","-=","*=","/=","%=","&=","^=","|=","="].map((Q)=>Q.replace(/[|\\^$*+?.(){}[\]]/g,(ee)=>`\\${ee}`)).join("|")})`,X=E.indexOf("="),J=X>=0?E.slice(X+1):"",ie=new RegExp(Y).test(J);if(!ie){let Q=`${b.slice(0,Math.max(0,Z))}
|
|
30
|
-
${b.slice(Z+y.length)}`;ie=new RegExp(Y).test(Q)||new RegExp(`(?:^|[^$w])(?:\\+\\+|--)\\s*${j}\\b|\\b${j}\\s*(?:\\+\\+|--)`).test(Q)||il(Q,j)}a.push({name:j,fixable:!ie})}return a}var yn={meta:{docs:"Suggest 'const' for variables that are never reassigned (heuristic)"},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=Be(y);for(let i=0;i<l.length;i++){if(n[i])continue;let w=l[i],a=ls(w,y);if(!a)continue;for(let{name:P,fixable:E}of a){if(!E)continue;let _=w.search(new RegExp(`\\b${P.replace(/\$/g,"\\$")}\\b`)),D=_!==-1?_:w.indexOf(P);s.push({filePath:b.filePath,line:i+1,column:Math.max(1,D+1),ruleId:"prefer-const",message:`'${P}' is never reassigned. Use 'const' instead`,severity:"error",help:`Change 'let ${P}' to 'const ${P}' since the variable is never reassigned. This makes your code more predictable and prevents accidental mutations`})}}return s},fix:(y)=>{let b=y.split(/\r?\n/),s=Be(y),l=new Set,n=/(?:eslint|pickier)-disable-next-line\b([^*\n]*)/;for(let w=0;w<b.length;w++){let a=b[w].match(n);if(!a)continue;let P=a[1].trim();if(P===""||/\bprefer-const\b/.test(P))l.add(w+2)}let i=!1;for(let w=0;w<b.length;w++){if(l.has(w+1))continue;if(s[w])continue;let a=b[w];if(!/^\s*let\b/.test(a))continue;let P=ls(a,y);if(!P||P.length===0)continue;if(!P.every((_)=>_.fixable))continue;let E=a.replace(/^(\s*)let(\s+)/,"$1const$2");if(E!==a)b[w]=E,i=!0}return i?b.join(`
|
|
31
|
-
`):y}};var cs={meta:{docs:"Prefer object spread ({...obj}) over Object.assign() for object composition"},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];if(/^\s*\/\//.test(i))continue;let w=i.indexOf("//"),a=w>=0?i.slice(0,w):i,P=a.matchAll(/\bObject\.assign\s*\(/g);for(let E of P){let _=E.index,D=a.slice(0,_),j=(D.match(/'/g)||[]).length,B=(D.match(/"/g)||[]).length,Z=(D.match(/`/g)||[]).length;if(j%2!==0||B%2!==0||Z%2!==0)continue;let z=_+13,Y=a.slice(z),X=-1,J=1,ie=0,Q=0,ee=null,le=!1;for(let be=1;be<Y.length;be++){let te=Y[be];if(le){le=!1;continue}if(te==="\\"&&ee){le=!0;continue}if(!ee){if(te==="'")ee="single";else if(te==='"')ee="double";else if(te==="`")ee="template";else if(te==="(")J++;else if(te===")"){if(J--,J===0)break}else if(te==="{")ie++;else if(te==="}")ie--;else if(te==="[")Q++;else if(te==="]")Q--;else if(te===","&&J===1&&ie===0&&Q===0){X=be;break}}else if(ee==="single"&&te==="'"||ee==="double"&&te==='"'||ee==="template"&&te==="`")ee=null}if(X===-1)continue;let ge=Y.slice(1,X).trim();if(ge==="{}")s.push({filePath:b.filePath,line:n+1,column:_+1,ruleId:"prefer-object-spread",message:"Prefer object spread over Object.assign",severity:"error",help:"Use object spread syntax: {...obj} instead of Object.assign({}, obj)"});else if(ge==="{}"||/^\{.*\}$/.test(ge))s.push({filePath:b.filePath,line:n+1,column:_+1,ruleId:"prefer-object-spread",message:"Prefer object spread over Object.assign for object literals",severity:"error",help:"Use object spread syntax: {...obj1, ...obj2}"})}}return s},fix:(y)=>{let b=y.split(/\r?\n/),s=[];for(let l=0;l<b.length;l++){let n=b[l];n=n.replace(/\bObject\.assign\s*\(\s*\{\}\s*,\s*([^)]+)\)/g,(i,w)=>`{${w.split(",").map((P)=>P.trim()).map((P)=>`...${P}`).join(", ")}}`),s.push(n)}return s.join(`
|
|
32
|
-
`)}};var bn={meta:{docs:"Prefer template literals over string concatenation",recommended:!0},check(y,b){let s=[],l=c(y).split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(w.startsWith("//")||w.startsWith("/*")||w.startsWith("*")||w.startsWith("import"))continue;let a=/(['"`][^'"`]*['"`])\s*\+\s*([a-z_$][\w$]*)/i,P=/([a-z_$][\w$]*)\s*\+\s*(['"`][^'"`]*['"`])/i,E=w.match(a)||w.match(P);if(E){let _=i.indexOf(E[0]),D=!!w.match(P),j=!!w.match(a);if(D&&!j){if(w.slice(w.indexOf(E[0])+E[0].length).startsWith("."))continue}s.push({filePath:b.filePath,line:n+1,column:_+1,ruleId:"general/prefer-template",message:"Unexpected string concatenation. Use template literals instead",severity:"warning",help:"Use template literals (backticks) instead of string concatenation. Example: `hello ${name}!` instead of 'hello ' + name + '!'"})}}return s}};var as={name:"general",rules:{"array-callback-return":e(ct),"constructor-super":e(at),"for-direction":e(ut),"getter-return":e(ft),"no-async-promise-executor":e(mt),"no-compare-neg-zero":e(pt),"no-cond-assign":e(dt),"no-const-assign":e(ht),"no-constant-condition":e(gt),"no-constructor-return":e(ts),"no-dupe-class-members":e(yt),"no-dupe-keys":e(Je),"no-duplicate-case":e(bt),"no-empty-pattern":e(xt),"no-fallthrough":e(Rt),"no-irregular-whitespace":e(ns),"no-loss-of-precision":e(wt),"no-new":e(ss),"no-regex-spaces":e(is),"no-promise-executor-return":e(kt),"no-redeclare":e(It),"no-self-assign":e(Qe),"no-self-compare":e(Pt),"no-sparse-arrays":e(Mt),"no-undef":e(vt),"no-unsafe-negation":e(Ct),"no-unreachable":e($t),"no-unused-vars":e(Fe),"no-useless-catch":e(Lt),"prefer-const":e(yn),"prefer-object-spread":e(cs),"prefer-template":e(bn),"use-isnan":e(St),"valid-typeof":e(Et)}};var us={markdown:{"heading-increment":!0,"heading-style":!0,"no-missing-space-atx":!0,"no-multiple-space-atx":!0,"no-missing-space-closed-atx":!1,"no-multiple-space-closed-atx":!1,"blanks-around-headings":!0,"heading-start-left":!0,"no-duplicate-heading":!1,"single-title":!0,"no-trailing-punctuation":!0,"ul-style":!0,"list-indent":!1,"ul-indent":!1,"ol-prefix":!0,"list-marker-space":!0,"blanks-around-lists":!0,"no-trailing-spaces":!0,"no-hard-tabs":!0,"no-multiple-blanks":!0,"no-multiple-space-blockquote":!0,"no-blanks-blockquote":!0,"blanks-around-fences":!0,"single-trailing-newline":!0,"blanks-around-tables":!0,"no-reversed-links":!1,"no-bare-urls":!0,"no-space-in-links":!1,"no-empty-links":!1,"link-fragments":!1,"reference-links-images":!1,"link-image-reference-definitions":!0,"link-image-style":!0,"descriptive-link-text":!1,"line-length":!1,"commands-show-output":!1,"fenced-code-language":!1,"code-block-style":!1,"code-fence-style":!0,"no-emphasis-as-heading":!0,"no-space-in-emphasis":!0,"no-space-in-code":!0,"emphasis-style":!0,"strong-style":!0,"no-inline-html":!1,"hr-style":!1,"first-line-heading":!1,"required-headings":!1,"proper-names":!1,"no-alt-text":!1,"table-pipe-style":!1,"table-column-count":!1,"table-column-style":!1},shell:{"command-substitution":!0,"quote-variables":!1,"no-cd-without-check":!1,"no-eval":!1,"no-useless-cat":!1,"no-ls-parsing":!1,"no-variable-in-single-quotes":!1,"no-exit-in-subshell":!1,shebang:!1,indent:!0,"function-style":!0,"operator-spacing":!0,"keyword-spacing":!1,"no-trailing-semicolons":!0,"no-trailing-whitespace":!0,"prefer-double-brackets":!0,"set-options":!1,"prefer-printf":!1,"consistent-case-terminators":!1,"no-broken-redirect":!1,"heredoc-indent":!1},spell:{check:!1,"check-comments":!1,"check-markdown":!1},lockfile:{"validate-host":!1,"validate-https":!1,"validate-integrity":!1,"validate-package-names":!1,"validate-scheme":!1},publint:{"use-type":!1,"local-dependency":!1,"deprecated-field-jsnext":!1,"has-module-but-no-exports":!1,"field-invalid-value-type":!1,"exports-types-should-be-first":!1,"exports-default-should-be-last":!1,"exports-module-should-precede-require":!1,"exports-value-invalid":!1,"exports-missing-root-entrypoint":!1,"exports-fallback-array-use":!1,"imports-key-invalid":!1,"imports-value-invalid":!1,"imports-default-should-be-last":!1,"imports-module-should-precede-require":!1,"file-does-not-exist":!1,"file-invalid-format":!1,"module-should-be-esm":!1,"bin-file-not-executable":!1,"exports-module-should-be-esm":!1}};var fs={meta:{docs:"Prefer using global Buffer instead of requiring it",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/),n=/(?:import\b[^;\n]*\bfrom\s*|require\s*\(\s*)['"](?:node:)?buffer['"]/;for(let i=0;i<l.length;i++){let w=l[i],a=w.trim();if(a.startsWith("//")||a.startsWith("/*")||a.startsWith("*"))continue;let P=w.match(n);if(!P||P.index===void 0)continue;if(!/\bBuffer\b/.test(w))continue;s.push({filePath:b.filePath,line:i+1,column:P.index+1,ruleId:"node/prefer-global/buffer",message:"Unexpected import of 'Buffer'. Use the global 'Buffer' instead",severity:"error",help:"`Buffer` is a global in Node.js \u2014 remove the import and use it directly."})}return s}};var ms={meta:{docs:"Prefer using global process instead of requiring it",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/),n=/(?:import\b[^;\n]*\bfrom\s*|require\s*\(\s*)['"](?:node:)?process['"]/;for(let i=0;i<l.length;i++){let w=l[i],a=w.trim();if(a.startsWith("//")||a.startsWith("/*")||a.startsWith("*"))continue;let P=w.match(n);if(!P||P.index===void 0)continue;s.push({filePath:b.filePath,line:i+1,column:P.index+1,ruleId:"node/prefer-global/process",message:"Unexpected import of 'process'. Use the global 'process' instead",severity:"error",help:"`process` is a global in Node.js \u2014 remove the import and use it directly."})}return s}};var ps={name:"node",rules:{"prefer-global/buffer":e(fs),"prefer-global/process":e(ms)}};var xn={meta:{docs:"Enforce sorted imports (delegates to formatter check only)"},check:(y,b)=>{let s=y.split(/\r?\n/),l=0;while(l<s.length&&(/^\s*$/.test(s[l])||/^\s*\/.\/.*/.test(s[l])||/^\s*\/.\*/.test(s[l])))l++;let n=l,i=[];while(l<s.length&&/^\s*import\b/.test(s[l]))i.push(s[l].trim()),l++;if(i.length===0)return[];let w=i.join(`
|
|
33
|
-
`),a=s.slice(l).join(`
|
|
34
|
-
`),P=`${w}
|
|
35
|
-
${a}`;if(C(P)!==P)return[{filePath:b.filePath,line:n+1,column:1,ruleId:"sort-imports",message:"Imports are not sorted/grouped consistently",severity:"warning"}];return[]},fix:(y)=>C(y)};var ds={name:"perfectionist",rules:{"sort-imports":e(xn)}};var hs={meta:{docs:"Ensure all imports appear before other statements",recommended:!1},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=!1,i=0;for(let w=0;w<l.length;w++){let a=l[w].trim();if(!a||a.startsWith("//")||a.startsWith("/*")||a.startsWith("*"))continue;let P=a.match(/^\s*import\s+/);if(!P&&a.length>0){if(n=!0,i===0)i=w+1}if(n&&P)s.push({filePath:b.filePath,line:w+1,column:1,ruleId:"import/first",message:"Import statement must appear before other statements",severity:"error"})}return s}};var gs={meta:{docs:"Disallow duplicate specifier names in a single import declaration"},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];if(!i.includes("import"))continue;let w=i.match(/^\s*import\s*\{([^}]*)\}\s*from\s*['"][^'"]+['"]/);if(!w)continue;let P=w[1].split(",").map((_)=>_.trim()).filter(Boolean).map((_)=>_.split(/\s+as\s+/i)[0].trim()),E=new Set;for(let _ of P){if(E.has(_)){s.push({filePath:b.filePath,line:n+1,column:Math.max(1,i.indexOf(_)+1),ruleId:"pickier/import-dedupe",message:"Expect no duplication in imports",severity:"warning"});break}E.add(_)}}return s}};function ys(y){let b=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(?<![\\w$])${b}(?![\\w$])`)}function rl(y,b,s){let l=[],n=/^\s*import\s+type\b/.test(y),i=y.replace(/^\s*import\s+/,"").replace(/\s+from\s+['"][^'"]+['"].*$/s,"");if(/^['"]/.test(i))return l;let w=(E,_)=>{let D=E.trim();if(!D||D==="type")return;if(!/^[A-Z_$][\w$]*$/i.test(D))return;for(let j=b;j<s.length;j++){let B=s[j].search(ys(D));if(B!==-1){l.push({name:D,line:j+1,column:B,typeOnly:_});return}if(/\bfrom\b/.test(s[j]))break}l.push({name:D,line:b+1,column:0,typeOnly:_})},a=i.match(/\{([\s\S]*)\}/);if(a)for(let E of a[1].split(",")){let _=E.trim();if(!_)continue;let D=/^type\s+/.test(_),B=_.replace(/^type\s+/,"").split(/\s+as\s+/);w(B[B.length-1],n||D)}let P=a?i.slice(0,i.indexOf("{")):i;for(let E of P.split(",")){let _=E.trim().replace(/^type\s+/,"");if(!_)continue;let D=_.match(/^\*\s+as\s+(\w+)$/);w(D?D[1]:_,n)}return l}var bs={meta:{docs:"Disallow imports that nothing in the file uses"},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=[],i=new Set;for(let P=0;P<l.length;P++){if(!/^\s*import(?![\w$])\s*(?![(.])/.test(l[P]))continue;let E=l[P],_=P,D=Math.min(l.length-1,P+40);while(_<D&&!/\bfrom\s*['"][^'"]*['"]/.test(E)&&!/^\s*import\s*['"]/.test(E))_++,E+=`
|
|
36
|
-
${l[_]}`;if(!/\bfrom\s*['"][^'"]*['"]/.test(E)&&!/^\s*import\s*['"]/.test(E))continue;for(let j=P;j<=_;j++)i.add(j);n.push(...rl(E,P,l)),P=_}if(n.length===0)return s;let w=l.map((P,E)=>i.has(E)?"":P).join(`
|
|
37
|
-
`),a=os(w);for(let P of n){if(ys(P.name).test(a))continue;s.push({filePath:b.filePath,line:P.line,column:P.column+1,ruleId:"pickier/no-unused-imports",message:P.typeOnly?`'${P.name}' is imported as a type but never used`:`'${P.name}' is imported but never used`,severity:"error"})}return s}};import{readFileSync as ol,statSync as ll}from"fs";import{dirname as cl,join as al,resolve as ul}from"path";var xs=[".ts",".tsx",".js",".jsx"];function Rs(y){return ll(y,{throwIfNoEntry:!1})?.isFile()??!1}function fl(y,b){let s=ul(y,b);for(let l of[...xs,""])if(Rs(s+l))return s+l;for(let l of xs){let n=al(s,`index${l}`);if(Rs(n))return n}return null}var ws={meta:{docs:"Ensure named imports correspond to a named export in the remote file",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=cl(b.filePath);for(let i=0;i<l.length;i++){let a=l[i].match(/\bimport\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/);if(a){let P=a[1].split(",").map((j)=>j.trim().split(/\s+as\s+/)[0].trim()),E=a[2];if(!E.startsWith(".")&&!E.startsWith("/"))continue;let _=fl(n,E),D="";if(_)try{D=ol(_,"utf8")}catch{}if(D)for(let j of P){let B=new RegExp(`\\bexport\\s+(?:const|let|var|function|class)\\s+${j}\\b`),Z=new RegExp(`\\bexport\\s+\\{[^}]*\\b${j}\\b[^}]*\\}`);if(![B,Z].some((X)=>X.test(D)))s.push({filePath:b.filePath,line:i+1,column:1,ruleId:"import/named",message:`'${j}' not found in '${E}'`,severity:"error"})}}}return s}};import{existsSync as ks,readFileSync as ml}from"fs";import{dirname as Is,resolve as Ps}from"path";var Ms={meta:{docs:"Ensure imports don't create circular dependencies",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=b.filePath,i=new Set,w=new Set;function a(E,_){if(w.has(E))return!0;if(i.has(E))return!1;i.add(E),w.add(E);try{let D=ml(E,"utf8"),j=P(D,Is(E));for(let B of j)if(a(B,[..._,B]))return!0}catch{}return w.delete(E),!1}function P(E,_){let D=[],j=/\bimport(?:\s{2,}|\s+\S.*?(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))from\s+['"]([^'"]+)['"]/g,B;for(B=j.exec(E);B!==null;B=j.exec(E)){let Z=B[1];if(Z.startsWith(".")||Z.startsWith("/")){let z=[".ts",".tsx",".js",".jsx",""];for(let Y of z){let X=Ps(_,Z+Y);if(ks(X)){D.push(X);break}}}}return D}for(let E=0;E<l.length;E++){let D=l[E].match(/\bimport(?:\s{2,}|\s+\S.*?(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))from\s+['"]([^'"]+)['"]/);if(D){let j=D[1];if(j.startsWith(".")||j.startsWith("/")){let B=[".ts",".tsx",".js",".jsx",""],Z="";for(let z of B){let Y=Ps(Is(n),j+z);if(ks(Y)){Z=Y;break}}if(Z){if(i.clear(),w.clear(),w.add(n),a(Z,[n,Z]))s.push({filePath:b.filePath,line:E+1,column:1,ruleId:"import/no-cycle",message:"Dependency cycle detected",severity:"error"})}}}}return s}};var vs={meta:{docs:"Disallow duplicate module imports - all imports from the same module should be combined"},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=new Map,i=!1;for(let w=0;w<l.length;w++){let a=l[w];if(i){let B=a.indexOf("*/");if(B>=0)a=a.slice(B+2),i=!1;else continue}let P=a.indexOf("/*"),E=a.indexOf("//");if(P>=0&&(E===-1||P<E)){let B=a.indexOf("*/",P+2);if(B>=0)a=a.slice(0,P)+a.slice(B+2);else i=!0,a=a.slice(0,P)}if(E>=0)a=a.slice(0,E);let _=a.trim();if(!_)continue;let D=_.match(/^import\s+(?:type\s+)?(?:\{[^}]*\}|[\w$]+(?:\s*,\s*\{[^}]*\})?|\*\s+as\s+[\w$]+)\s+from\s+(['"`])(.+?)\1/);if(D){let B=D[2];if(n.has(B)){let Z=n.get(B);s.push({filePath:b.filePath,line:w+1,column:1,ruleId:"no-duplicate-imports",message:`'${B}' imported multiple times (also imported on line${Z.length>1?"s":""} ${Z.join(", ")})`,severity:"error",help:`Combine all imports from '${B}' into a single import statement`}),Z.push(w+1)}else n.set(B,[w+1])}let j=_.match(/^export\s+(?:type\s+)?(?:\{[^}]*\}|\*(?:\s+as\s+[\w$]+)?)\s+from\s+(['"`])(.+?)\1/);if(j){let B=j[2],Z=`export:${B}`;if(n.has(Z)){let z=n.get(Z);s.push({filePath:b.filePath,line:w+1,column:1,ruleId:"no-duplicate-imports",message:`'${B}' re-exported multiple times (also exported on line${z.length>1?"s":""} ${z.join(", ")})`,severity:"error",help:`Combine all re-exports from '${B}' into a single export statement`}),z.push(w+1)}else n.set(Z,[w+1])}}return s}};var $s={meta:{docs:"Disallow importing from dist directories"},check:(y,b)=>{let s=[],l=new RegExp(`^\\s*import\\s[^;]*?from\\s*['"]([^'"]+)['"]`,"m"),n=y.split(/\r?\n/);for(let i=0;i<n.length;i++){let w=n[i],a=w.match(l);if(!a)continue;let P=a[1];if(P==="dist"||(P.startsWith(".")||P.startsWith("/"))&&/(?:^|\/)dist(?:\/.|$)/.test(P))s.push({filePath:b.filePath,line:i+1,column:Math.max(1,w.indexOf(P)+1),ruleId:"pickier/no-import-dist",message:`Do not import modules in \`dist\` folder, got ${P}`,severity:"error"})}return s}};var Cs={meta:{docs:"Disallow importing from node_modules by explicit path"},check:(y,b)=>{let s=[],l=new RegExp(`^\\s*import\\s[^;]*?from\\s*['"]([^'"]+)['"]`,"m"),n=/require\(\s*['"]([^'"]+)['"]\s*\)/,i=y.split(/\r?\n/);for(let w=0;w<i.length;w++){let a=i[w],P=a.match(l),E=a.match(n),_=P?.[1]||E?.[1];if(!_)continue;if(_.includes("/node_modules/")){let D=Math.max(1,a.indexOf(_)+1);s.push({filePath:b.filePath,line:w+1,column:D,ruleId:"pickier/no-import-node-modules-by-path",message:"Do not import modules in `node_modules` folder by path",severity:"error"})}}return s}};import{existsSync as pl}from"fs";import{dirname as dl,join as hl,resolve as gl}from"path";var Ls={meta:{docs:"Ensure imports point to a file/module that can be resolved",recommended:!0},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=dl(b.filePath);for(let i=0;i<l.length;i++){let w=l[i],a=[...w.matchAll(/\bimport(?:\s{2,}|\s+\S.*?(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))from\s+['"]([^'"]+)['"]/g),...w.matchAll(/\bimport\s*\(\s*['"]([^'"]+)['"]\s*\)/g),...w.matchAll(/\brequire\s*\(\s*['"]([^'"]+)['"]\s*\)/g)];for(let P of a){let E=P[1];if(!E.startsWith(".")&&!E.startsWith("/"))continue;let _=[],D=[".ts",".tsx",".js",".jsx",".mjs",".cjs",""];for(let B of D){let Z=gl(n,E+B);_.push(Z),_.push(hl(Z,`index${B}`))}if(!_.some((B)=>pl(B)))s.push({filePath:b.filePath,line:i+1,column:1,ruleId:"import/no-unresolved",message:`Unable to resolve path to module '${E}'`,severity:"error"})}}return s}};function Ss(y,b,s){let l=s.order==="desc"?-1:1,n=s.type||"alphabetical",i=s.ignoreCase?y.toLowerCase():y,w=s.ignoreCase?b.toLowerCase():b;if(n==="line-length")return(i.length-w.length)*l;if(n==="natural")return i.localeCompare(w,void 0,{numeric:!0,sensitivity:"base"})*l;if(n==="unsorted")return 0;return i.localeCompare(w)*l}var yl=new RegExp(`^export\\s+\\{[^}]*\\}\\s+from\\s+['"][^'"]+['"];?\\s*$`);function Rn(y){return yl.test(y)}var Es={meta:{docs:"Ensure contiguous export statements are sorted consistently."},check:(y,b)=>{let s=[],l=b.config.pluginRules?.["pickier/sort-exports"]?.[1]||{},n=y.split(/\r?\n/),i=0;while(i<n.length){while(i<n.length&&!Rn(n[i]))i++;if(i>=n.length)break;let w=[],a=i;while(a<n.length){let P=n[a];if(Rn(P)){w.push({idx:a,line:P}),a++;continue}if(l.partitionByNewLine&&P.trim()==="")break;else break}if(w.length>1){let P=w.map((D)=>D.line),E=[...P].sort((D,j)=>Ss(D,j,l));if(!P.every((D,j)=>D===E[j])){let D=P.findIndex((B,Z)=>B!==E[Z]),j=w[D]?.idx??w[0].idx;s.push({filePath:b.filePath,line:j+1,column:1,ruleId:"pickier/sort-exports",message:"Export statements are not sorted.",severity:"warning"})}}i=a+1}return s},fix:(y,b)=>{let s=b.config.pluginRules?.["pickier/sort-exports"]?.[1]||{},n=[...y.split(/\r?\n/)],i=0;while(i<n.length){while(i<n.length&&!Rn(n[i]))i++;if(i>=n.length)break;let w=[],a=i;while(a<n.length){let P=n[a];if(Rn(P)){w.push(a),a++;continue}if(s.partitionByNewLine&&P.trim()==="")break;else break}if(w.length>1){let P=w.map((D)=>n[D]),E=[...P].sort((D,j)=>Ss(D,j,s));if(!P.every((D,j)=>D===E[j]))w.forEach((D,j)=>{n[D]=E[j]})}i=a+1}return n.join(`
|
|
38
|
-
`)}};var As={meta:{docs:"Enforce sorted TypeScript heritage clauses (extends/implements lists)"},check:(y,b)=>{let s=b.options||{},l=s.type||"alphabetical",n=s.order||"asc",i=s.ignoreCase!==!1,w=Array.isArray(s.groups)?s.groups:[],a=s.customGroups||{},P=y.split(/\r?\n/),E=[],_=(Q)=>n==="asc"?Q:-Q,D=(Q,ee)=>(i?Q.toLowerCase():Q).localeCompare(i?ee.toLowerCase():ee),j=(Q,ee)=>(i?Q.toLowerCase():Q).localeCompare(i?ee.toLowerCase():ee,void 0,{numeric:!0}),B=(Q,ee)=>{if(l==="line-length")return _(Q.length-ee.length);if(l==="natural")return _(j(Q,ee));if(l==="unsorted")return 0;return _(D(Q,ee))},Z=Object.fromEntries(Object.entries(a).map(([Q,ee])=>{let ge=(Array.isArray(ee)?ee:[ee]).map((be)=>new RegExp(be));return[Q,ge]})),z=[];for(let Q of w)if(Array.isArray(Q))z.push(...Q);else z.push(Q);if(!z.includes("unknown"))z.push("unknown");let Y=(Q)=>{for(let[ee,le]of Object.entries(Z))if(le.some((ge)=>ge.test(Q)))return ee;return"unknown"},X=(Q)=>{let ee=[],le=0,ge="";for(let be=0;be<Q.length;be++){let te=Q[be];if(te==="<")le++;else if(te===">")le=Math.max(0,le-1);if(te===","&&le===0){ee.push(ge.trim()),ge="";continue}ge+=te}if(ge.trim())ee.push(ge.trim());return ee},J=(Q)=>{let ee=Q.trim(),le=ee.match(/^([A-Z_$][\w$.]*)/i);return le?le[1]:ee},ie=(Q,ee)=>{let le=X(ee);if(le.length<=1)return;let ge=le.map(J),be=ge.map(Y),te=ge.map((ce,ae)=>({n:ce,g:be[ae],i:ae})).sort((ce,ae)=>{let de=z.indexOf(ce.g),oe=z.indexOf(ae.g);if(de!==oe)return de-oe;return B(ce.n,ae.n)}).map((ce)=>ce.n);if(!ge.every((ce,ae)=>ce===te[ae]))E.push({filePath:b.filePath,line:Q,column:1,ruleId:"sort-heritage-clauses",message:"Heritage clauses are not sorted",severity:"warning"})};for(let Q=0;Q<P.length;Q++){let ee=P[Q],le=ee.match(/^\s*interface\s+[A-Za-z_$][^{]*\bextends\s+(.+?)\s*\{/);if(le)ie(Q+1,le[1]);let ge=ee.match(/^\s*class\s+[A-Za-z_$][^{]*\bimplements\s+(.+?)\s*\{/);if(ge)ie(Q+1,ge[1])}return E}};var Os={meta:{docs:"Require object keys to be sorted (ESLint-compatible core rule subset)"},check:()=>[]};var _s={meta:{docs:"Enforce sorted named imports within each import statement"},check:(y,b)=>{let s=b.options||{},l=s.type||"alphabetical",n=s.order||"asc",i=s.ignoreCase!==!1,w=Boolean(s.ignoreAlias),a=y.split(/\r?\n/),P=[],E=(_,D)=>{let j=0;if(l==="line-length")j=_.length-D.length;else{let B=i?_.toLowerCase():_,Z=i?D.toLowerCase():D;j=B.localeCompare(Z)}return n==="asc"?j:-j};for(let _=0;_<a.length;_++){let j=a[_].match(/^\s*import\s+\{([^}]*)\}\s+from\s+['"][^'"]+['"]/);if(!j)continue;let Z=j[1].split(",").map((J)=>J.trim()).filter(Boolean);if(Z.length<=1)continue;let z=Z.map((J)=>{let ie=J.replace(/^type\s+/,""),Q=ie.match(/^([\w$]+)\s+as\s+([\w$]+)$/);if(Q)return w?Q[2]:Q[1];let ee=ie.match(/^([\w$]+)$/);return ee?ee[1]:ie}),Y=[...z].sort(E);if(!z.every((J,ie)=>J===Y[ie]))P.push({filePath:b.filePath,line:_+1,column:1,ruleId:"sort-named-imports",message:"Named imports are not sorted",severity:"warning"})}return P}};var Ts={meta:{docs:"Enforce sorted object keys"},check:(y,b)=>{let s=b.options||{},l=s.type||"alphabetical",n=s.order||"asc",i=s.ignoreCase!==!1,w=Boolean(s.partitionByNewLine),a=y.split(/\r?\n/),P=[],E=(D,j)=>{let B=0;if(l==="line-length")B=D.length-j.length;else{let Z=i?D.toLowerCase():D,z=i?j.toLowerCase():j;B=Z.localeCompare(z)}return n==="asc"?B:-B},_=0;while(_<a.length){let D=a[_],j=D.indexOf("{");if(j!==-1){let B=D.slice(0,j);if(/=\s*$|\(\s*$|\breturn\s*$/.test(B)){let Z=0,z=_,Y=_;for(;Y<a.length;Y++){for(let X of a[Y])if(X==="{")Z++;else if(X==="}")Z--;if(Z===0)break}if(Y>z){let X=a.slice(z+1,Y),J=[],ie={startLine:z+2,props:[]},Q=()=>{if(ie.props.length)J.push(ie);ie={startLine:0,props:[]}};for(let ee=0;ee<X.length;ee++){let le=X[ee];if(w&&/^\s*$/.test(le)){Q();continue}if(/^\s*\.\.\./.test(le))continue;if(/\{|\}/.test(le))continue;let ge=le.match(/^\s*['"]?([\w$-]+)['"]?\s*:/);if(ge){if(ie.startLine===0)ie.startLine=z+2+ee;ie.props.push({key:ge[1],line:z+2+ee})}}Q();for(let ee of J){let le=ee.props.map((te)=>te.key),ge=[...le].sort(E);if(!(le.length<=1||le.every((te,ue)=>te===ge[ue]))&&ee.props.length>0){let te=ee.props[0];P.push({filePath:b.filePath,line:te.line,column:1,ruleId:"sort-objects",message:"Object keys are not sorted",severity:"warning"})}}_=Y+1;continue}}}_++}return P}};var Ws={meta:{docs:"Enforce top-level functions to use function declarations"},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];if(/^\s+/.test(i))continue;if(/^\s*(?:\/\/|\/\*)/.test(i))continue;let w=i.match(/^const\s+([A-Za-z_$][\w$]*)\s*=(.*)$/);if(!w)continue;let a=w[2].trim();if(/^\(?[A-Z_$,]*(?:\)\s*)?=>/i.test(a)||/^function\b/.test(a)){let P=i.indexOf("const")+1;s.push({filePath:b.filePath,line:n+1,column:P,ruleId:"pickier/top-level-function",message:"Top-level functions should be declared with function keyword",severity:"warning"});continue}if(a.trim().length===0||/[,({]$/.test(a.trim())){let P=l[n+1]||"";if(/^\s*(?:\(?[A-Za-z_$,]*(?:\)\s*)?=>|function\b)/.test(P)){let E=i.indexOf("const")+1;s.push({filePath:b.filePath,line:n+1,column:E,ruleId:"pickier/top-level-function",message:"Top-level functions should be declared with function keyword",severity:"warning"})}}}return s}};var bl=[[/^(block|inline|inline-block|flex|inline-flex|grid|inline-grid|flow-root|contents|hidden|table|table-caption|table-cell|table-column|table-column-group|table-footer-group|table-header-group|table-row-group|table-row|list-item|subgrid)$/,0],[/^(container|columns|break-after|break-before|break-inside|box-decoration|box-border|box-content|float|clear|isolation|object|overflow|overscroll|position|inset|top|right|bottom|left|start|end|z-|aspect|order)/,1],[/^(static|fixed|absolute|relative|sticky)$/,1],[/^(visible|invisible|collapse)$/,1],[/^(basis|flex-|grow|shrink|order|grid-|col-|row-|auto-cols|auto-rows|gap|justify|items|content|self|place)/,2],[/^(p|px|py|ps|pe|pt|pr|pb|pl|m|mx|my|ms|me|mt|mr|mb|ml|space|indent)-/,3],[/^(-?(p|px|py|ps|pe|pt|pr|pb|pl|m|mx|my|ms|me|mt|mr|mb|ml|space|indent)-)/,3],[/^(w-|h-|min-w|max-w|min-h|max-h|size-)/,4],[/^(font|text|tracking|leading|list|placeholder|vertical|whitespace|break|hyphens|content|truncate|overflow-ellipsis|overflow-clip|line-clamp|underline|overline|line-through|no-underline|uppercase|lowercase|capitalize|normal-case|italic|not-italic|ordinal|slashed-zero|lining-nums|oldstyle-nums|proportional-nums|tabular-nums|diagonal-fractions|stacked-fractions|normal-nums|antialiased|subpixel-antialiased)/,5],[/^(bg-|from-|via-|to-|gradient-)/,6],[/^(border|rounded|outline|ring|divide|accent)/,7],[/^(shadow|opacity|mix-blend|bg-blend)/,8],[/^(blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|saturate|sepia|backdrop)/,9],[/^(border-collapse|border-separate|border-spacing|table-auto|table-fixed|caption)/,10],[/^(transition|duration|ease|delay|animate)/,11],[/^(scale|rotate|translate|skew|origin|transform|perspective)/,12],[/^(appearance|cursor|caret|pointer-events|resize|scroll|snap|touch|select|will-change)/,13],[/^(fill|stroke)/,14],[/^(sr-only|not-sr-only)$/,15]],xl=/^([a-z0-9][-a-z0-9]{0,50}:)+(?!\[)/;function Rl(y){let b=0;while(b<y.length){if(y[b]==="[")break;let s=y.indexOf(":",b);if(s===-1)break;if(y[s+1]==="[")break;b=s+1}return y.slice(b)}function wl(y){let b=Rl(y);if(b.startsWith("!"))b=b.slice(1);for(let[s,l]of bl)if(s.test(b))return l;return 99}function kl(y){let b=y.match(xl);if(!b)return 0;let s=b[0].slice(0,-1).split(":"),l={sm:1,md:2,lg:3,xl:4,"2xl":5},n=10;for(let i of s)if(l[i]!==void 0)n+=l[i];else n+=20;return n}var Ns=new Map;function Ds(y){let b=Ns.get(y);if(b)return b;let s={group:wl(y),variant:kl(y)};return Ns.set(y,s),s}function _n(y){return[...y].sort((b,s)=>{let l=Ds(b),n=Ds(s),i=l.group,w=n.group;if(i!==w)return i-w;let a=l.variant,P=n.variant;if(a!==P)return a-P;return b.localeCompare(s)})}var Il=/\b(?:class|className|:class)\s*=\s*(?:"([^"]*?)"|'([^']*?)')/g,Pl=/\b(?:class|className|:class)\s*=\s*\{`([^`]*?)`\}/g,Ml=/\b(?:clsx|cn|tw|cva|tv)\s*\(\s*(?:"([^"]*?)"|'([^']*?)')/g;function vl(y){let b=y.replace(/\[[^\]]*\]/g,"");if(/['"`]/.test(b))return!0;if(/[{}()=]/.test(b))return!0;if(/ \? | && | \|\| /.test(b))return!0;if(/\b(?:true|false|null|undefined|function|return|typeof|instanceof)\b/.test(b))return!0;return!1}function js(y){let b=[];if(!y.includes("class")&&!y.includes("clsx")&&!y.includes("cn(")&&!y.includes("tw(")&&!y.includes("cva(")&&!y.includes("tv("))return b;for(let s of[Il,Pl,Ml]){s.lastIndex=0;let l;while((l=s.exec(y))!==null){let n=l[1]??l[2]??"";if(!n.trim())continue;if(vl(n))continue;let i=y.indexOf(n,l.index);if(i===-1)continue;b.push({value:n,start:i,end:i+n.length})}}return b.sort((s,l)=>s.start-l.start),b}function Us(y){let b=[],s="",l=0;for(let n of y)if(n==="[")l++,s+=n;else if(n==="]")l=Math.max(0,l-1),s+=n;else if(/\s/.test(n)&&l===0){if(s)b.push(s),s=""}else s+=n;if(s)b.push(s);return b}function Fs(y){let b=_n(y);return y.every((s,l)=>s===b[l])}var Bs={meta:{docs:"Enforce consistent Tailwind CSS class ordering (layout \u2192 spacing \u2192 typography \u2192 etc.).",recommended:!0,editsStringContent:!0},check:(y,b)=>{let s=[],l=js(y);for(let{value:n,start:i}of l){let w=Us(n);if(w.length<2)continue;if(!Fs(w)){let a=y.slice(0,i),P=(a.match(/\n/g)??[]).length+1,E=a.lastIndexOf(`
|
|
39
|
-
`),_=E===-1?i+1:i-E;s.push({filePath:b.filePath,line:P,column:_,ruleId:"pickier/sort-tailwind-classes",message:`Tailwind classes are not in the recommended order. Expected: "${_n(w).join(" ")}"`,severity:"warning",help:"Run with --fix to automatically sort Tailwind classes, or reorder them manually."})}}return s},fix:(y)=>{let b=js(y);if(b.length===0)return y;let s=[...b].reverse(),l=y;for(let{value:n,start:i,end:w}of s){let a=Us(n);if(a.length<2||Fs(a))continue;let P=_n(a).join(" ");l=l.slice(0,i)+P+l.slice(w)}return l}};var qs={name:"pickier",rules:{"sort-exports":e(Es),"sort-objects":e(Ts),"sort-imports":e(xn),"sort-named-imports":e(_s),"sort-heritage-clauses":e(As),"sort-keys":e(Os),"import-dedupe":e(gs),"no-unused-imports":e(bs),"import-first":e(hs),"import-named":e(ws),"import-no-cycle":e(Ms),"import-no-unresolved":e(Ls),"no-import-dist":e($s),"no-import-node-modules-by-path":e(Cs),"no-duplicate-imports":e(vs),"top-level-function":e(Ws),"sort-tailwind-classes":k(Bs),"prefer-const":e(yn),"prefer-template":e(bn),"no-unused-vars":e(Fe)}};var zs={name:"quality",rules:{"default-case":e(Ot),eqeqeq:e(_t),"no-alert":e(Nt),"no-await-in-loop":e(Dt),"no-caller":e(jt),"no-case-declarations":e(Ut),"no-else-return":e(Ft),"no-empty":e(Bt),"no-empty-function":e(qt),"no-eval":e(zt),"no-extend-native":e(Zt),"no-global-assign":e(Vt),"no-implied-eval":e(Kt),"no-iterator":e(Ht),"no-new":e(Yt),"no-new-func":e(Xt),"no-new-wrappers":e(Jt),"no-octal":e(Qt),"no-param-reassign":e(en),"no-proto":e(tn),"no-return-assign":e(nn),"no-shadow":e(rn),"no-throw-literal":e(on),"no-use-before-define":e(ln),"no-useless-call":e(cn),"no-with":e(pn),"require-await":e(hn),complexity:e(At),"max-depth":e(Tt),"max-lines-per-function":e(Wt),"no-extra-boolean-cast":e(Gt),"no-lonely-if":e(et),"no-sequences":e(sn),"no-useless-concat":e(an),"no-useless-escape":e(un),"no-useless-rename":e(fn),"no-useless-return":e(tt),"no-var":e(mn),"prefer-arrow-callback":e(dn)}};var Zs={meta:{docs:"Detects potentially super-linear backtracking patterns in regex literals (heuristic)"},check:(y,b)=>{let s=[],l=(n,i,w)=>{let a=y.slice(0,n),P=(a.match(/\n/g)||[]).length+1,E=n-a.lastIndexOf(`
|
|
40
|
-
`);s.push({filePath:b.filePath,line:P,column:E,ruleId:"no-super-linear-backtracking",message:w,severity:"error"})};for(let n of g(y).regions){if(n.kind!=="regex")continue;let i=n.start-1,w=y.slice(i,n.end+1),a=w.slice(1,w.lastIndexOf("/")),P=a.replace(/\[.*?\]/g,"");if(P.includes(".+?\\s*")||P.includes("\\s*.+?")||P.includes(".*\\s*")||P.includes("\\s*.*")){l(i,w.length,"The combination of ' .*' or ' .+?' with '\\s*' can cause super-linear backtracking due to exchangeable characters");continue}let _=P.replace(/\s+/g,"");if(/(?:\.\*\??){2,}/.test(_)||/(?:\.\+\??){2,}/.test(_)||/\.\*\??\.\+\?|\.\+\??\.\*\?/.test(_)){l(i,w.length,"Multiple adjacent unlimited wildcard quantifiers can cause super-linear backtracking");continue}let D=a.replace(/\\./g,"_").replace(/\[[^\]]*\]/g,"_");if(/\((?:\?:)?[^)]*?[+*][^)]*\)\s*[+*]/.test(D)){l(i,w.length,"Nested unlimited quantifiers detected (e.g., (.+)+) which can cause catastrophic backtracking");continue}}return s}};function $l(y,b){let s=b-1;while(s>=0&&(y[s]===" "||y[s]==="\t"))s--;let l=s>=0?y[s]:"",n="=(<>!&|?:;,{[+(~^%*/";if(!(s<0||n.includes(l)||/\b(?:return|typeof|void|delete|throw|new|in|of|case)\s*$/.test(y.slice(Math.max(0,s-5),s+1))))return null;let w=b+1,a=!1,P=!1,E=-1;while(w<y.length){let z=y[w];if(P)P=!1;else if(z==="\\")P=!0;else if(z==="["){if(!a)a=!0}else if(z==="]"){if(a)a=!1}else if(z==="/"&&!a){E=w;break}else if(z===`
|
|
41
|
-
`)break;w++}if(E<=b)return null;let _=y.slice(b+1,E),D=E+1;while(D<y.length&&/[gimsuvy]/.test(y[D]))D++;if(/\\[1-9]/.test(_))return null;let j=0,B=-1,Z=!1;for(let z=0;z<_.length;z++){if(_[z]==="\\"){z++;continue}if(_[z]==="["&&!Z){Z=!0;continue}if(_[z]==="]"&&Z){Z=!1;continue}if(Z)continue;if(_[z]==="("&&_.slice(z+1,z+3)!=="?:"&&_.slice(z+1,z+3)!=="?="&&_.slice(z+1,z+3)!=="?!"&&_.slice(z+1,z+4)!=="?<="&&_.slice(z+1,z+4)!=="?<!"){if(B<0)B=z;j++}}if(j===0)return null;return{patternStart:b,patternEnd:D,pattern:_,capCount:j,firstCapOffset:B}}function Cl(y,b,s){let l=s;while(l<y.length&&(y[l]===" "||y[l]==="\t"))l++;if(y[l]==="."){let P=y.slice(l+1,l+20);if(/^test\s*\(/.test(P))return!1;if(/^exec\s*\(/.test(P))return!0}let n=b-1;while(n>=0&&(y[n]===" "||y[n]==="\t"))n--;if(y[n]==="("){let E=n-1;while(E>=0&&(y[E]===" "||y[E]==="\t"))E--;let _=y.slice(Math.max(0,E-20),E+1);if(/\.match\s*$/.test(_))return!0;if(/\.matchAll\s*$/.test(_))return!0;if(/\.exec\s*$/.test(_))return!0;if(/\.replace\s*$/.test(_))return!0;if(/\.replaceAll\s*$/.test(_))return!0;if(/\.split\s*$/.test(_))return!0;if(/\.search\s*$/.test(_))return!1;if(/\.test\s*$/.test(_))return!1}let i=y.lastIndexOf(`
|
|
42
|
-
`,b)+1,a=y.slice(i,b).trim().match(/(?:const|let|var)\s+(\w+)\s*=\s*$/);if(a){let P=a[1],E=y.slice(s),_=new RegExp(`\\b${P}\\.exec\\s*\\(`),D=new RegExp(`\\b${P}\\.test\\s*\\(`),j=new RegExp(`\\.match(?:All)?\\s*\\(\\s*${P}\\s*\\)`),B=new RegExp(`\\.replace(?:All)?\\s*\\(\\s*${P}`),Z=_.test(E),z=j.test(E),Y=B.test(E),X=D.test(E);if(Z||z||Y)return!0;if(X)return!1;return!0}return!0}function Ll(y,b){let s=b-1;while(s>=0&&(y[s]===" "||y[s]==="\t"))s--;let l=s>=0?y[s]:"",n="=(<>!&|?:;,{[+(~^%*/";if(!(s<0||n.includes(l)||/\b(?:return|typeof|void|delete|throw|new|in|of|case)\s*$/.test(y.slice(Math.max(0,s-5),s+1))))return b+1;let w=b+1,a=!1,P=!1;while(w<y.length){let E=y[w];if(P)P=!1;else if(E==="\\")P=!0;else if(E==="["){if(!a)a=!0}else if(E==="]"){if(a)a=!1}else if(E==="/"&&!a){w++;while(w<y.length&&/[gimsuvy]/.test(y[w]))w++;return w}else if(E===`
|
|
43
|
-
`)break;w++}return b+1}function Sl(y,b){let s=[],l=b.filePath,n=0;while(n<y.length){let i=y[n];if(i==="/"&&y[n+1]==="/"){while(n<y.length&&y[n]!==`
|
|
44
|
-
`)n++;continue}if(i==="/"&&y[n+1]==="*"){n+=2;while(n<y.length-1&&!(y[n]==="*"&&y[n+1]==="/"))n++;n+=2;continue}if(i==="'"||i==='"'||i==="`"){let w=i;n++;while(n<y.length){if(y[n]==="\\"){n+=2;continue}if(y[n]===w){n++;break}n++}continue}if(i==="/"){let w=$l(y,n);if(!w){let a=Ll(y,n);if(a>n+1)n=a;else n++;continue}if(!Cl(y,w.patternStart,w.patternEnd)){let a=w.patternStart+1+(w.firstCapOffset>=0?w.firstCapOffset:0),P=y.slice(0,a),E=(P.match(/\r?\n/g)||[]).length+1,_=a-(P.lastIndexOf(`
|
|
45
|
-
`)+1)+1;s.push({filePath:l,line:E,column:_,ruleId:"regexp/no-unused-capturing-group",message:"Unused capturing group in regular expression; use non-capturing group (?:...) instead",severity:"error"})}n=w.patternEnd;continue}n++}return s}var Gs={meta:{docs:"Flags regex literals with unused capturing groups (context-aware)",recommended:!1},check(y,b){return Sl(y,b)}};var Vs={meta:{docs:"Disallow lazy quantifiers that don't affect the matching behavior",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];if(i.trim().startsWith("//")||i.trim().startsWith("/*")||i.trim().startsWith("*"))continue;let w=/\/(?![/*])([^/\n\r\\]|\\.)+\/[gimsuvy]*/g,a;for(a=w.exec(i);a!==null;a=w.exec(i)){let P=a[0],E=P.slice(1,P.lastIndexOf("/"));if(/[+*?]\?\$$/.test(E))s.push({filePath:b.filePath,line:n+1,column:a.index+E.search(/[+*?]\?\$$/)+2,ruleId:"regexp/no-useless-lazy",message:"Lazy quantifier is useless before end-of-string anchor",severity:"error"});if(/[+*?]\?$/.test(E))s.push({filePath:b.filePath,line:n+1,column:a.index+E.length-1,ruleId:"regexp/no-useless-lazy",message:"Lazy quantifier is useless at the end of the pattern",severity:"error"})}}return s}};var Ks={name:"regexp",rules:{"no-super-linear-backtracking":e(Zs),"no-unused-capturing-group":e(Gs),"no-useless-lazy":e(Vs)}};function Hs(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var Ys={meta:{docs:"Disallow spaces inside array brackets",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]==="["&&!Hs(i,a)){let P=i[a+1];if(P==="]"||P===void 0||P===`
|
|
46
|
-
`)continue;if(P===" "||P==="\t"){if(i.indexOf("]",a+1)!==-1)s.push({filePath:b.filePath,line:n+1,column:a+2,ruleId:"style/array-bracket-spacing",message:"Unexpected space after '['",severity:"warning"})}}if(i[a]==="]"&&!Hs(i,a)){let P=a>0?i[a-1]:void 0;if(P==="["||P===void 0)continue;if(P===" "||P==="\t"){if(i.lastIndexOf("[",a-1)!==-1)s.push({filePath:b.filePath,line:n+1,column:a,ruleId:"style/array-bracket-spacing",message:"Unexpected space before ']'",severity:"warning"})}}}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l;n=n.replace(/\[\s+(\S)/g,(i,w)=>{if(w==="]")return i;return`[${w}`}),n=n.replace(/(\S)\s+\]/g,"$1]"),s.push(n)}return s.join(`
|
|
47
|
-
`)}};var Xs=/(?<![(\[{,=:?&|+\-*/])\b([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=>/g;function El(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var Js={meta:{docs:"Require parentheses around arrow function parameters",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;Xs.lastIndex=0;while((a=Xs.exec(i))!==null){let P=a.index;if(El(i,P))continue;let E=a[1];if(i.slice(0,P).trimEnd().endsWith("("))continue;if(E==="async")continue;s.push({filePath:b.filePath,line:n+1,column:P+1,ruleId:"style/arrow-parens",message:`Arrow function parameter '${E}' should be wrapped in parentheses`,severity:"warning"})}}return s},fix(y){return y.replace(/(?<![(\[{,=:?&|+\-*/])\b([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=>/g,(b,s)=>{if(s==="async")return b;return b.replace(s,`(${s})`)})}};var wn=/=>/g;function Qs(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var ei={meta:{docs:"Require space before and after => in arrow functions",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;wn.lastIndex=0;while((a=wn.exec(i))!==null){let P=a.index;if(Qs(i,P))continue;if(P>0&&i[P-1]!==" "&&i[P-1]!=="\t")s.push({filePath:b.filePath,line:n+1,column:P+1,ruleId:"style/arrow-spacing",message:"Missing space before =>",severity:"warning"});let E=P+2;if(E<i.length&&i[E]!==" "&&i[E]!=="\t"&&i[E]!==`
|
|
48
|
-
`)s.push({filePath:b.filePath,line:n+1,column:E+1,ruleId:"style/arrow-spacing",message:"Missing space after =>",severity:"warning"})}}return s},fix(y){let b=y.split(`
|
|
49
|
-
`);for(let s=0;s<b.length;s++){let l=b[s],n=l.trim();if(!n||n.startsWith("//")||n.startsWith("*")||n.startsWith("/*"))continue;let i="",w=0;wn.lastIndex=0;let a;while((a=wn.exec(l))!==null){let P=a.index;if(Qs(l,P))continue;let E=l[P-1],_=l[P+2],D=P>0&&E!==" "&&E!=="\t",j=_!==void 0&&_!==" "&&_!=="\t";if(!D&&!j)continue;i+=l.slice(w,P),i+=`${D?" ":""}=>${j?" ":""}`,w=P+2}if(w>0)b[s]=i+l.slice(w)}return b.join(`
|
|
50
|
-
`)}};function Tn(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var ti={meta:{docs:"Require spaces inside single-line blocks",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]!=="{")continue;if(Tn(i,a))continue;if(a>0&&i[a-1]==="$")continue;let P=1,E=-1;for(let D=a+1;D<i.length;D++){if(i[D]==="{"&&!Tn(i,D))P++;if(i[D]==="}"&&!Tn(i,D)){if(P--,P===0){E=D;break}}}if(E===-1)continue;let _=i.slice(a+1,E);if(!_.trim())continue;if(_[0]!==" "&&_[0]!=="\t")s.push({filePath:b.filePath,line:n+1,column:a+2,ruleId:"style/block-spacing",message:"Missing space after '{'",severity:"warning"});if(_[_.length-1]!==" "&&_[_.length-1]!=="\t")s.push({filePath:b.filePath,line:n+1,column:E+1,ruleId:"style/block-spacing",message:"Missing space before '}'",severity:"warning"});break}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l.replace(/(?<!\$)\{(\S)([^}]*?)(\S)\}/g,(i,w,a,P)=>`{ ${w}${a}${P} }`);n=n.replace(/(?<!\$)\{(\S)([^}]*?)\s\}/g,(i,w,a)=>`{ ${w}${a} }`),n=n.replace(/(?<!\$)\{\s([^}]*?)(\S)\}/g,(i,w,a)=>`{ ${w}${a} }`),s.push(n)}return s.join(`
|
|
51
|
-
`)}};var ni={meta:{docs:"Enforce consistent brace style for blocks",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let w=l[n].trim();if(w.startsWith("//")||w.startsWith("/*"))continue;if(/\}\s+(?:else|catch|finally)\b/.test(w))s.push({filePath:b.filePath,line:n+1,column:w.indexOf("}")+1,ruleId:"style/brace-style",message:"Closing curly brace appears on the same line as the subsequent block",severity:"error"});if(w==="{"&&n>0){let P=l[n-1].trim();if(!P||P.startsWith("//")||P.startsWith("/*")||P.endsWith("*/"))continue;if(P&&!P.endsWith("{")&&!P.endsWith(",")&&!P.endsWith("(")){if(!P.match(/[=:]\s*$/)&&!P.endsWith("["))s.push({filePath:b.filePath,line:n+1,column:1,ruleId:"style/brace-style",message:"Opening curly brace should be on the same line",severity:"error"})}}}return s}};var si=/,\s*$/,ii=new RegExp("^\\s*[}\\])](?:\\s*;?\\s*)?$"),ri={meta:{docs:"Require trailing commas in multiline constructs",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=1;n<l.length;n++){let w=l[n].trim();if(!ii.test(w))continue;let a=l[n-1],P=a.trim();if(!P||P==="{"||P==="["||P==="(")continue;if(P.startsWith("//")||P.startsWith("*")||P.startsWith("/*"))continue;if(si.test(P))continue;if(P.endsWith("{")||P.endsWith("[")||P.endsWith("("))continue;if(P.endsWith("=>"))continue;s.push({filePath:b.filePath,line:n,column:a.length+1,ruleId:"style/comma-dangle",message:"Missing trailing comma",severity:"warning",help:"Add a trailing comma after the last element in multiline constructs."})}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l=0;l<b.length;l++){let n=b[l];if(l+1<b.length){let i=b[l+1].trim(),w=n.trim();if(ii.test(i)&&w&&w!=="{"&&w!=="["&&w!=="("&&!w.startsWith("//")&&!w.startsWith("*")&&!w.startsWith("/*")&&!si.test(w)&&!w.endsWith("{")&&!w.endsWith("[")&&!w.endsWith("(")&&!w.endsWith("=>")){s.push(n.replace(/(\s*)$/,",$1"));continue}}s.push(n)}return s.join(`
|
|
52
|
-
`)}};function Al(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var oi={meta:{docs:"Require space after commas, disallow space before commas",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]!==",")continue;if(Al(i,a))continue;if(a>0&&i[a-1]===" "){if(i.slice(0,a).trim().length>0)s.push({filePath:b.filePath,line:n+1,column:a+1,ruleId:"style/comma-spacing",message:"Unexpected space before comma",severity:"warning"})}if(a+1<i.length&&i[a+1]!==" "&&i[a+1]!=="\t"&&i[a+1]!==`
|
|
53
|
-
`&&i[a+1]!=="\r")s.push({filePath:b.filePath,line:n+1,column:a+2,ruleId:"style/comma-spacing",message:"Missing space after comma",severity:"warning"})}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l;n=n.replace(/ ,/g,","),n=n.replace(/,(\S)/g,", $1"),s.push(n)}return s.join(`
|
|
54
|
-
`)}};var li={meta:{docs:"Enforce comma-last style (commas at the end of lines, not the beginning)",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;if(w.startsWith(","))s.push({filePath:b.filePath,line:n+1,column:i.indexOf(",")+1,ruleId:"style/comma-style",message:"Comma should be placed at the end of the previous line",severity:"warning"})}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l=0;l<b.length;l++){let n=b[l],i=n.trim();if(i.startsWith(",")&&s.length>0){let w=s.length-1;s[w]=s[w].replace(/\s*$/,",");let a=n.match(/^(\s*)/)?.[1]||"";s.push(a+i.slice(1).trim())}else s.push(n)}return s.join(`
|
|
55
|
-
`)}};function Ol(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var ci={meta:{docs:"Disallow spaces inside computed property brackets [expr]",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]!=="[")continue;if(Ol(i,a))continue;if(a===0)continue;let P=i[a-1];if(!/[a-zA-Z0-9_$)\]]/.test(P))continue;if(a+1<i.length&&(i[a+1]===" "||i[a+1]==="\t"))s.push({filePath:b.filePath,line:n+1,column:a+2,ruleId:"style/computed-property-spacing",message:"Unexpected space after '['",severity:"warning"});let E=1,_=a+1;while(_<i.length&&E>0){if(i[_]==="[")E++;if(i[_]==="]")E--;if(E>0)_++}if(E===0&&_>0){if(i[_-1]===" "||i[_-1]==="\t")s.push({filePath:b.filePath,line:n+1,column:_,ruleId:"style/computed-property-spacing",message:"Unexpected space before ']'",severity:"warning"})}}}return s},fix(y){return y.replace(/([a-zA-Z0-9_$)\]])\[\s+([\s\S]*?)\s+\]/g,"$1[$2]")}};function _l(y){let b=[],s=y.split(/\r?\n/),l=0;for(let n=0;n<s.length;n++){let i=s[n],w=/\b[\w$)\]]+\s*\./.test(i),a=n+1<s.length&&/^\s*\./.test(s[n+1]);if(w||a){let P=n,E=n;while(P+1<s.length&&/^\s*\./.test(s[P+1]))P++,E=P;if(E>n){let _=l,D=l+s[n].length+1+s.slice(n+1,E+1).join(`
|
|
56
|
-
`).length;b.push({start:_,end:D}),n=E}}l+=i.length+1}return b}var ai={meta:{docs:"Enforce consistent line breaks in member-access/call chains"},check:(y,b)=>{let s=[],l=y.split(/\r?\n/),n=_l(y);for(let{start:i,end:w}of n){let P=y.slice(i,w).split(/\r?\n/),E=[];for(let B=0;B<P.length;B++){let Z=P[B],z=[...Z.matchAll(/\./g)].map((Y)=>Y.index||0);for(let Y of z){if(Y>0&&Z[Y-1]==="?")continue;if(/^\s*\./.test(Z)&&Y===Z.indexOf(".")&&Z.slice(0,Y).trim()==="")E.push("newline");else E.push("inline")}}if(E.length<=1)continue;let _=E[0];if(E.every((B)=>B===_))continue;let D=E.findIndex((B)=>B!==_),j=0;for(let B=0;B<P.length;B++){let Z=P[B],z=[...Z.matchAll(/\./g)].map((Y)=>Y.index||0);for(let Y of z){if(Y>0&&Z[Y-1]==="?")continue;if(j===D){let J=y.slice(0,i).split(/\r?\n/),ie=J.length,Q=(J[J.length-1]||"").length;s.push({filePath:b.filePath,line:ie+B,column:(B===0?Q:0)+Y+1,ruleId:"style/consistent-chaining",message:`Inconsistent chaining style: mix of ${_} and ${_==="inline"?"newline":"inline"}.`,severity:"warning"}),B=P.length;break}j++}}}return s}};function ui(y){let b=[0];for(let l=0;l<y.length;l++)if(y[l]===`
|
|
57
|
-
`)b.push(l+1);function s(l){let n=0,i=b.length-1;while(n<=i){let a=n+i>>1,P=b[a],E=a+1<b.length?b[a+1]:1/0;if(l<P)i=a-1;else if(l>=E)n=a+1;else return{line:a+1,column:l-P+1}}let w=b[b.length-1];return{line:b.length,column:Math.max(1,l-w+1)}}return{lineStarts:b,indexToLoc:s}}function fi(y){let b=[],s=(i,w,a)=>b.push({type:i,value:y.slice(w,a),start:w,end:a}),l=0,n=y.length;while(l<n){let i=y[l];if(i<=" "){l++;continue}if(i==="/"&&y[l+1]==="/"){let P=l;l+=2;while(l<n&&y[l]!==`
|
|
58
|
-
`)l++;s("LineComment",P,l);continue}if(i==="/"&&y[l+1]==="*"){let P=l;l+=2;while(l<n&&!(y[l]==="*"&&y[l+1]==="/"))l++;l=Math.min(n,l+2),s("BlockComment",P,l);continue}if(i==='"'||i==="'"){let P=i,E=l;l++;while(l<n){let _=y[l];if(_==="\\"){l+=2;continue}if(_===P){l++;break}l++}s("String",E,l);continue}if(i==="`"){let P=l;l++;let E=0;while(l<n){let _=y[l];if(_==="\\"){l+=2;continue}if(_==="`"&&E===0){l++;break}if(_==="$"&&y[l+1]==="{"){E++,l+=2;continue}if(_==="}"&&E>0){E--,l++;continue}l++}s("Template",P,l);continue}if(i==="/"){if(y[l+1]==="/"){let P=l;l+=2;while(l<n&&y[l]!==`
|
|
59
|
-
`)l++;s("LineComment",P,l);continue}if(y[l+1]==="*"){let P=l;l+=2;while(l<n&&!(y[l]==="*"&&y[l+1]==="/"))l++;l=Math.min(n,l+2),s("BlockComment",P,l);continue}if(Tl(b)){let P=l;l++;while(l<n){let E=y[l];if(E==="\\"){l+=2;continue}if(E==="/"){l++;break}l++}while(l<n&&/[a-z]/i.test(y[l]))l++;s("Regex",P,l);continue}s("Punct",l,l+1),l++;continue}if("(){}[];:,.<>+-*%&|^!?=~".includes(i)){s("Punct",l,l+1),l++;continue}let w=l,a=new RegExp("[^\\s(){}[\\];:,.<>+\\-*%&|^!?=~'\"`/]");while(l<n&&a.test(y[l]))l++;if(l>w)s("Word",w,l);else s("Word",l,l+1),l++}return b}function Tl(y){if(y.length===0)return!0;let b=y[y.length-1],s=new RegExp("[(!,{;:?=]");return b.type==="Punct"&&s.test(b.value)||b.type==="Word"&&/^(?:return|throw|case|of|in|instanceof|typeof|void|new)$/.test(b.value)}function mi(y,b,s,l){let n=0,i=(D)=>D<=" ",w=(D)=>{while(D<y.length&&y[D]!==`
|
|
60
|
-
`)D++;return D},a=(D)=>{D+=2;while(D<y.length&&!(y[D]==="*"&&y[D+1]==="/"))D++;return Math.min(y.length,D+2)},P=(D,j)=>{let B=y.length;if(j==="`"){D++;let Z=0;while(D<B){let z=y[D];if(z==="\\"){D+=2;continue}if(z==="`"&&Z===0){D++;break}if(z==="$"&&y[D+1]==="{"){Z++,D+=2;continue}if(z==="}"&&Z>0){Z--,D++;continue}if(z==='"'||z==="'"){D=P(D,z);continue}if(z==="/"&&y[D+1]==="/"){D=w(D+2);continue}if(z==="/"&&y[D+1]==="*"){D=a(D);continue}D++}return D}D++;while(D<B){let Z=y[D];if(Z==="\\"){D+=2;continue}if(Z===j){D++;break}D++}return D},E=(D)=>{let j=D-1;while(j>=0&&i(y[j]))j--;let B=j>=0?y[j]:"";if(new RegExp("[(:[{;?,=!&|^~+\\-*%<>]").test(B))return!0;if(B==="")return!0;return!1},_=(D)=>{D++;let j=y.length;while(D<j){let B=y[D];if(B==="\\"){D+=2;continue}if(B==="/"){D++;break}D++}while(D<j&&/[a-z]/i.test(y[D]))D++;return D};for(let D=b;D<y.length;D++){let j=y[D];if(j===s){n++;continue}if(j===l){if(n--,n===0)return D;continue}if(j==='"'||j==="'"||j==="`"){D=P(D,j)-1;continue}if(j==="/"&&y[D+1]==="/"){D=w(D+2)-1;continue}if(j==="/"&&y[D+1]==="*"){D=a(D)-1;continue}if(j==="/"&&E(D)){D=_(D)-1;continue}}return-1}var Wl=new Set(["const","let","var","return","if","for","while","do","switch","throw","try","break","continue","function","class","debugger"]);function Nl(y){let b=0;for(let n of y){if(n.type!=="Punct")continue;if(n.value==="("||n.value==="["||n.value==="{")b++;else if((n.value===")"||n.value==="]"||n.value==="}")&&b>0)b--;else if(n.value===";"&&b===0)return!0}let[s,l]=y;return s?.type==="Word"&&Wl.has(s.value)&&!(l?.type==="Punct"&&[":",",","(","}","?"].includes(l.value))}function Dl(y,b,s,l,n,i,w,a){let P=mi(y,l,n,i);if(P<=l)return;let E=fi(y.slice(l+1,P));if(n==="{"&&Nl(E))return;let _=[],D=0,j=0,B=l+1,Z;for(let X of E){if(X.type==="Punct"){let J=X.value,ie=Z!==void 0&&Z.end===X.start;if(J==="("||J==="["||J==="{")D++;else if((J===")"||J==="]"||J==="}")&&D>0)D--;else if(J==="<"&&ie&&Z.type==="Word")j++;else if(J===">"&&j>0&&!(ie&&Z.value==="="))j--;else if(J===","&&D===0&&j===0)_.push({start:B,end:l+1+X.start}),B=l+1+X.end}Z=X}_.push({start:B,end:P});let z=_.map((X)=>({p:X,gap:jl(y,X.start,X.end)})).filter((X)=>X.gap.at<X.p.end);if(z.length<2)return;let Y=z[0].gap.newline;for(let X=1;X<z.length;X++)if(z[X].gap.newline!==Y){let J=a().indexToLoc(z[X].gap.at);s.push({filePath:b,line:J.line,column:J.column,ruleId:w,message:Y?"Should have line breaks between items":"Should not have line breaks between items",severity:"warning"});return}}function jl(y,b,s){let l=b,n=!1;while(l<s){let i=y[l];if(i===`
|
|
61
|
-
`)n=!0,l++;else if(i===" "||i==="\t"||i==="\r")l++;else if(i==="/"&&y[l+1]==="/")while(l<s&&y[l]!==`
|
|
62
|
-
`)l++;else if(i==="/"&&y[l+1]==="*"){let w=y.indexOf("*/",l+2);l=w===-1||w+2>s?s:w+2}else break}return{at:l,newline:n}}var pi={meta:{docs:"Enforce consistent newlines for list-like constructs (objects, arrays, named imports/exports)"},check:(y,b)=>{let s=c(y),l=[],n="style/consistent-list-newline",i,w=()=>i??=ui(s),a=new Set,P=(E,_,D)=>{if(a.has(E))return;a.add(E),Dl(s,b.filePath,l,E,_,D,"style/consistent-list-newline",w)};for(let E=0;E<s.length;E++){let _=s[E];if(_==="{"){let D=E-1;while(D>=0&&/[ \t]/.test(s[D]))D--;if(D>=0&&s[D]===")")continue;if(D>=1&&s[D]===">"&&s[D-1]==="=")continue;let j=s.slice(Math.max(0,E-60),E);if(/\b(?:function|class|interface|type|enum|try|catch|finally|if|else|for|while|switch)\b[\s\S]*$/.test(j))continue;P(E,"{","}")}else if(_==="[")P(E,"[","]");else if(_==="i"&&s.startsWith("import",E)){let D=s.indexOf("{",E);if(D>-1)P(D,"{","}")}else if(_==="e"&&s.startsWith("export",E)){let D=s.indexOf("{",E);if(D>-1)P(D,"{","}")}}return l}};function Ul(y){let b=y.trim();return b===""||b.startsWith("//")||b.startsWith("/*")}function Wn(y,b){for(let s=b;s<y.length;s++)if(!Ul(y[s]))return s;return-1}function Ge(y,b,s){if(y[b].slice(s).includes("{"))return!0;let n=Wn(y,b+1);if(n>=0){if(y[n].trim().startsWith("{"))return!0}return!1}function kn(y,b,s){let l=y[b].slice(s);if(/\bif\b|\bfor\b|\bwhile\b|\bdo\b/.test(l))return!0;return!1}var di={meta:{docs:"Enforce curly brackets similar to src-2: require braces when any branch/body requires them"},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let i=0;i<l.length;i++){let w=l[i],a=w.match(/^(\s*)if\s*\(([^)]*)\)/);if(a){let E=a[0].length,_=Ge(l,i,E),D=kn(l,i,E),j=i,B=_,Z=D;while(!0){let z=Wn(l,j+1);if(z<0)break;let Y=l[z].trim();if(!Y.startsWith("else"))break;let X=Y.match(/^else\s+if\s*\(([^)]*)\)/);if(X){let J=l[z].indexOf(X[0])+X[0].length;B=B||Ge(l,z,J),Z=Z||kn(l,z,J),j=z;continue}else{let J=l[z].indexOf("else")+4;B=B||Ge(l,z,J),Z=Z||kn(l,z,J),j=z;break}}if(B||Z){if(!_)s.push({filePath:b.filePath,line:i+1,column:Math.max(1,w.indexOf("if")+1),ruleId:"style/curly",message:"Expect curly brackets",severity:"warning"});let z=i;while(!0){let Y=Wn(l,z+1);if(Y<0)break;let X=l[Y],J=X.trim();if(!J.startsWith("else"))break;let ie=J.match(/^else\s+if\s*\(([^)]*)\)/);if(ie){let Q=X.indexOf(ie[0])+ie[0].length;if(!Ge(l,Y,Q))s.push({filePath:b.filePath,line:Y+1,column:Math.max(1,X.indexOf("else")+1),ruleId:"style/curly",message:"Expect curly brackets",severity:"warning"});z=Y;continue}else{let Q=X.indexOf("else")+4;if(!Ge(l,Y,Q))s.push({filePath:b.filePath,line:Y+1,column:Math.max(1,X.indexOf("else")+1),ruleId:"style/curly",message:"Expect curly brackets",severity:"warning"});break}}}}let P=w.match(/^(\s*)(while|do|for|for\s+await)\b/);if(P){let E=P[0].length,_=Ge(l,i,E),D=kn(l,i,E);if((_||D)&&!_)s.push({filePath:b.filePath,line:i+1,column:Math.max(1,w.indexOf(P[2])+1),ruleId:"style/curly",message:"Expect curly brackets",severity:"warning"})}}let n=Fl(y,b.filePath);for(let i of n)s.push({filePath:b.filePath,line:i.line,column:i.column,ruleId:"style/curly",message:i.message,severity:"warning"});return s}};function Fl(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim(),a=/^if\s*\(/.test(w)?"if":/^else\s+if\s*\(/.test(w)?"else-if":/^else\b/.test(w)?"else":null;if(!a)continue;let P=0;if(a==="if"){let Z=i.match(/if\s*\([^)]*\)/);P=Z?i.indexOf(Z[0])+Z[0].length:i.indexOf("if")+2}else if(a==="else-if"){let Z=i.match(/else\s+if\s*\([^)]*\)/);P=Z?i.indexOf(Z[0])+Z[0].length:i.indexOf("else")+4}else P=i.indexOf("else")+4;let E=n,_=i.indexOf("{",P);if(_<0){let Z=function(Y){for(let X=Y;X<l.length;X++)if(l[X].trim()!=="")return X;return-1}(n+1);if(Z<0)continue;if(_=l[Z].indexOf("{"),_<0)continue;E=Z}let D=0,j=-1;for(let Z=E;Z<l.length;Z++){let z=l[Z],Y=Z===E?Math.max(0,_):0;for(let X=Y;X<z.length;X++){let J=z[X];if(J==="{")D++;else if(J==="}"){if(D--,D===0){j=Z;break}}}if(j>=0)break}if(j<0)continue;let B=[];for(let Z=E+1;Z<j;Z++){let z=l[Z].trim();if(z===""||/^\/\//.test(z))continue;if(B.push(z),B.length>1)break}if(B.length===1&&j===E+2){let Z=B[0],z=/^(?:if|for|while|do|switch|try|catch|else)\b/.test(Z),Y=/[{}]/.test(Z),X=(Z.match(/\(/g)||[]).length,J=(Z.match(/\)/g)||[]).length,ie=X!==J,Q=!1;for(let ee=n+1;ee<l.length;ee++){let le=l[ee].trim();if(le===""||le==="}"||/^\/\//.test(le))continue;if(!/^else\b/.test(le))break;let ge=l[ee].indexOf("else")+4,be=le.match(/^else\s+if\s*\([^)]*\)/);if(be)ge=l[ee].indexOf(be[0])+be[0].length;let te=ee,ue=l[ee].indexOf("{",ge);if(ue<0){let de=function(xe){for(let he=xe;he<l.length;he++)if(l[he].trim()!=="")return he;return-1}(ee+1);if(de<0)break;if(ue=l[de].indexOf("{"),ue<0)continue;te=de}let ce=0,ae=-1;for(let de=te;de<l.length;de++){let oe=l[de],xe=de===te?Math.max(0,ue):0;for(let he=xe;he<oe.length;he++){let fe=oe[he];if(fe==="{")ce++;else if(fe==="}"){if(ce--,ce===0){ae=de;break}}}if(ae>=0)break}if(ae>=0){let de=0;for(let oe=te+1;oe<ae;oe++){let xe=l[oe].trim();if(xe===""||/^\/\//.test(xe))continue;if(de++,de>1){Q=!0;break}}}if(Q)break}if(!Q&&a==="if"){let ee=function(ge){for(let be=ge;be<l.length;be++){let te=l[be].trim();if(te!==""&&te!=="}"&&!/^\/\//.test(te))return be}return-1}(j+1);if(ee>=0&&/^else\b/.test(l[ee].trim())){let le=l[ee].indexOf("else")+4,ge=l[ee].trim().match(/^else\s+if\s*\([^)]*\)/);if(ge)le=l[ee].indexOf(ge[0])+ge[0].length;let be=ee,te=l[ee].indexOf("{",le);if(te<0){let ue=function(ae){for(let de=ae;de<l.length;de++)if(l[de].trim()!=="")return de;return-1}(ee+1);if(ue>=0)te=l[ue].indexOf("{"),be=te>=0?ue:be}if(te>=0){let ue=0,ce=-1;for(let ae=be;ae<l.length;ae++){let de=l[ae],oe=ae===be?Math.max(0,te):0;for(let xe=oe;xe<de.length;xe++){let he=de[xe];if(he==="{")ue++;else if(he==="}"){if(ue--,ue===0){ce=ae;break}}}if(ce>=0)break}if(ce>=0){let ae=0;for(let de=be+1;de<ce;de++){let oe=l[de].trim();if(oe===""||/^\/\//.test(oe))continue;if(++ae>1){Q=!0;break}}}}}}if(!z&&!Y&&!ie&&!Q)s.push({line:E+1,column:Math.max(1,l[E].indexOf("{")+1),message:"Unnecessary curly braces around single statement"})}}return s}var hi={meta:{docs:"Enforce dot on the property line in chained method calls",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/),n=Be(y);for(let i=0;i<l.length;i++){let w=l[i],a=w.trim();if(!a||a.startsWith("//")||a.startsWith("*")||a.startsWith("/*"))continue;if(n[i+1])continue;if(a.endsWith(".")&&i+1<l.length){let P=l[i+1].trim();if(P&&/^[a-zA-Z_$]/.test(P))s.push({filePath:b.filePath,line:i+1,column:w.length,ruleId:"style/dot-location",message:"Dot should be on the same line as the property",severity:"warning"})}}return s},fix(y){let b=y.split(/\r?\n/),s=[],l=Be(y);for(let n=0;n<b.length;n++){let i=b[n];if(i.trim().endsWith(".")&&!l[n+1]&&n+1<b.length){let a=b[n+1],P=a.trim();if(P&&/^[a-zA-Z_$]/.test(P)){s.push(i.replace(/\.\s*$/,""));let E=a.match(/^(\s*)/)?.[1]||"";b[n+1]=`${E}.${P}`;continue}}s.push(i)}return s.join(`
|
|
63
|
-
`)}};function gi(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var yi=["===","!==",">>>","==","!=",">=","<=","&&","||","??","**","<<",">>","+","-","*","/","%","|","&","^",">","<","instanceof","in"],Wd=new RegExp(`^(${yi.map((y)=>y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")})\\s`),Bl=new Set(["in","instanceof"]),ql=/^(?:instanceof|in)\s/;function In(y){if(ql.test(y))return!0;for(let b of yi){if(Bl.has(b))continue;if(y.startsWith(b)){let s=y[b.length];if(s===void 0||s===" "||s==="\t")return!0}}return!1}function Nn(y){let b=y.match(/^(\s*)/);return b?b[1].length:0}var bi={meta:{docs:"Enforce consistent indentation of continuation lines in multiline binary expressions",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;if(!In(w))continue;if(gi(i,0))continue;let a=n-1;while(a>=0){let _=l[a].trim();if(!_||_.startsWith("//")||_.startsWith("*")||_.startsWith("/*")){a--;continue}if(In(_)){a--;continue}break}if(a<0)continue;let P=Nn(l[a])+2,E=Nn(i);if(E!==P)s.push({filePath:b.filePath,line:n+1,column:E+1,ruleId:"style/indent-binary-ops",message:`Expected indentation of ${P} spaces for binary operator continuation, but found ${E}`,severity:"warning"})}return s},fix(y,b){let s=y.split(/\r?\n/),l=[];for(let n=0;n<s.length;n++){let i=s[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*")){l.push(i);continue}if(!In(w)||gi(i,0)){l.push(i);continue}let a=-1;for(let _=l.length-1;_>=0;_--){let D=l[_].trim();if(!D||D.startsWith("//")||D.startsWith("*")||D.startsWith("/*"))continue;if(In(D))continue;a=_;break}if(a<0){l.push(i);continue}let P=Nn(l[a])+2,E=" ".repeat(P)+w;l.push(E);continue}return l.join(`
|
|
64
|
-
`)}};var xi=new Set(["if","for","while","switch","catch","function","return","typeof","void","delete","throw","new","await","class","import","export","from","of","in","case","default","yield","else","do","try","finally","with","async","super","this","extends","implements","instanceof"]),Pn=/([a-zA-Z_$][a-zA-Z0-9_$]*)\s+\(/g;function Ri(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var wi={meta:{docs:"Disallow spaces between function name and opening parenthesis in calls",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;Pn.lastIndex=0;while((a=Pn.exec(i))!==null){let P=a[1],E=a.index;if(Ri(i,E))continue;if(xi.has(P))continue;let _=i.slice(0,E).trimEnd();if(_.endsWith("function")||_.endsWith("function*"))continue;if(/\b(?:get|set)\s*$/.test(_))continue;let D=E+P.length;s.push({filePath:b.filePath,line:n+1,column:D+1,ruleId:"style/function-call-spacing",message:"Unexpected space between function name and parenthesis",severity:"warning"})}}return s},fix(y,b){let s=y.split(/\r?\n/),l=[];for(let n=0;n<s.length;n++){let i=s[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*")){l.push(i);continue}let a=i,P=[],E;Pn.lastIndex=0;while((E=Pn.exec(i))!==null){let _=E[1],D=E.index;if(Ri(i,D))continue;if(xi.has(_))continue;let j=i.slice(0,D).trimEnd();if(j.endsWith("function")||j.endsWith("function*"))continue;if(/\b(?:get|set)\s*$/.test(j))continue;P.push({index:D,fullMatch:E[0],identifier:_})}for(let _=P.length-1;_>=0;_--){let D=P[_],j=D.index,B=j+D.fullMatch.length;a=`${a.slice(0,j)}${D.identifier}(${a.slice(B)}`}l.push(a)}return l.join(`
|
|
65
|
-
`)}};var ki=/\bfunction\s*\*/g;function Ii(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var Pi={meta:{docs:"Enforce spacing around * in generator functions (space after, no space before)",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;ki.lastIndex=0;while((a=ki.exec(i))!==null){let E=a.index;if(Ii(i,E))continue;let _=a[0],D=E+_.indexOf("*"),j=D+1;if(_!=="function*")s.push({filePath:b.filePath,line:n+1,column:D+1,ruleId:"style/generator-star-spacing",message:"Unexpected space before * in generator function",severity:"warning"});if(j<i.length&&i[j]!==" "&&i[j]!=="\t"&&i[j]!==`
|
|
66
|
-
`&&i[j]!=="(")s.push({filePath:b.filePath,line:n+1,column:j+1,ruleId:"style/generator-star-spacing",message:"Missing space after * in generator function",severity:"warning"})}if(w.match(/^(?:async\s+)?\*\s*([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/)){let E=i.indexOf("*",i.indexOf(w.charAt(0)));if(!Ii(i,E)){let _=E+1;if(_<i.length&&i[_]!==" "&&i[_]!=="\t")s.push({filePath:b.filePath,line:n+1,column:_+1,ruleId:"style/generator-star-spacing",message:"Missing space after * in generator method",severity:"warning"})}}}return s},fix(y,b){let s=y;return s=s.replace(/\bfunction\s+\*/g,"function*"),s=s.replace(/\bfunction\*([a-zA-Z_$])/g,"function* $1"),s=s.replace(/(^\s*(?:async\s+)?)\*([a-zA-Z_$])/gm,"$1* $2"),s}};var Mi={meta:{docs:"Enforce newline after if when without braces"},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];if(!i.match(/^\s*if\s*\([^)]*\)\s*([^\s{/].*)$/))continue;s.push({filePath:b.filePath,line:n+1,column:Math.max(1,i.indexOf("if")+1),ruleId:"style/if-newline",message:"Expect newline after if",severity:"warning"})}return s}};var zl=["$","unindent","unIndent"],vi={meta:{docs:"Enforce consistent indentation inside unindent-style tagged templates"},check:(y,b)=>{let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.match(/^\s*/)?.[0]??"",a=/([$A-Z_][\w$]*)\s*`/gi,P;while(P=a.exec(i)){let E=P[1];if(!zl.includes(E))continue;if(i.slice(P.index+P[0].length).includes("`"))continue;let D=-1;for(let B=n+1;B<l.length;B++)if(l[B].includes("`")){D=B;break}if(D<0)continue;let j=`${w} `;for(let B=n+1;B<D;B++){let Z=l[B];if(Z.trim()==="")continue;let z=Z.match(/^\s*/)?.[0]??"";if(!z.startsWith(j)){s.push({filePath:b.filePath,line:B+1,column:(z.length||0)+1,ruleId:"style/indent-unindent",message:"Consistent indentation in unindent tag",severity:"warning"});break}}}}return s}};var Zl=/^(\s*)(["']?[a-zA-Z_$][a-zA-Z0-9_$]*["']?\s*(?:\?)?):(\S)/;function $i(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var Ci={meta:{docs:"Require space after colon in object properties",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a=i.match(Zl);if(a){let E=i.indexOf(":",a[1].length);if(E!==-1&&!$i(i,E)){let _=i[E+1];if(_&&_!==" "&&_!=="\t"&&_!==`
|
|
67
|
-
`)s.push({filePath:b.filePath,line:n+1,column:E+2,ruleId:"style/key-spacing",message:"Missing space after colon in property",severity:"warning"})}}let P=w.match(/^(["']?[a-zA-Z_$][a-zA-Z0-9_$]*["']?)\s+:/);if(P&&!w.match(/^\s*(case|default)\b/)){let E=i.indexOf(":",i.indexOf(P[1])+P[1].length);if(E!==-1&&!$i(i,E))s.push({filePath:b.filePath,line:n+1,column:E+1,ruleId:"style/key-spacing",message:"Unexpected space before colon in property",severity:"warning"})}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l;n=n.replace(/^(\s*)(["']?[a-zA-Z_$][a-zA-Z0-9_$]*["']?\s*(?:\?)?):(\S)/,"$1$2: $3"),s.push(n)}return s.join(`
|
|
68
|
-
`)}};var Gl=["if","else","for","while","do","switch","case","return","throw","try","catch","finally","const","let","var","typeof","instanceof","in","of","new","delete","void","yield","await","async","from","import","export","default","class","extends","as","break","continue"],Li=new RegExp(`(?:^|[^\\w$.])(${Gl.join("|")})(?=[^\\w$]|$)`,"g");function Vl(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var Si={meta:{docs:"Require space before and after keywords",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;Li.lastIndex=0;while((a=Li.exec(i))!==null){let P=a[0].charAt(0)===a[1].charAt(0)?"":a[0].charAt(0),E=a.index+P.length,_=E+a[1].length;if(Vl(i,E))continue;if(E>0){let D=i[E-1];if(D===")"||D==="}")s.push({filePath:b.filePath,line:n+1,column:E+1,ruleId:"style/keyword-spacing",message:`Missing space before keyword '${a[1]}'`,severity:"warning"})}if(_<i.length){let D=i[_];if(D!==" "&&D!=="\t"&&D!==";"&&D!==","&&D!==":"&&D!=="."){if(D==="("&&(a[1]==="if"||a[1]==="for"||a[1]==="while"||a[1]==="switch"||a[1]==="catch"))s.push({filePath:b.filePath,line:n+1,column:_+1,ruleId:"style/keyword-spacing",message:`Missing space after keyword '${a[1]}'`,severity:"warning"})}}}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l;for(let i of["if","for","while","switch","catch"]){let w=new RegExp(`(\\b${i})\\(`,"g");n=n.replace(w,"$1 (")}for(let i of["else","catch","finally"])n=n.replace(new RegExp(`\\)${i}\\b`,"g"),`) ${i}`),n=n.replace(new RegExp(`\\}${i}\\b`,"g"),`} ${i}`);s.push(n)}return s.join(`
|
|
69
|
-
`)}};var Ei=/^\s*(?:public|private|protected|static|readonly|abstract|override|async|get|set|\*|#|[a-zA-Z_$])/,Ai={meta:{docs:"Require blank line between class members",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/),n=!1,i=0,w=0,a=-1;for(let P=0;P<l.length;P++){let _=l[P].trim();if(_.match(/\bclass\b/)&&(_.includes("{")||P+1<l.length&&l[P+1].trim()==="{"))n=!0,w=i+1;let D=i;for(let j of _){if(j==="{")i++;if(j==="}")i--}if(n&&i<w){n=!1,a=-1;continue}if(!n)continue;if(D>w&&i===w&&_.endsWith("}")){a=P;continue}if(D===w){if(!_||_.startsWith("//")||_.startsWith("*")||_.startsWith("/*")||_==="}")continue;if(Ei.test(_)){if(a!==-1&&P===a+1)s.push({filePath:b.filePath,line:P+1,column:1,ruleId:"style/lines-between-class-members",message:"Missing blank line between class members",severity:"warning"});if(!_.endsWith("{"))a=P}}}return s},fix(y,b){let s=y.split(/\r?\n/),l=[],n=!1,i=0,w=0,a=-1;for(let P=0;P<s.length;P++){let E=s[P],_=E.trim();if(_.match(/\bclass\b/)&&(_.includes("{")||P+1<s.length&&s[P+1].trim()==="{"))n=!0,w=i+1;let D=i;for(let j of _){if(j==="{")i++;if(j==="}")i--}if(n&&i<w){n=!1,a=-1,l.push(E);continue}if(n&&D>w&&i===w&&_.endsWith("}")){a=P,l.push(E);continue}if(n&&D===w&&_&&!_.startsWith("//")&&!_.startsWith("*")&&!_.startsWith("/*")&&_!=="}"&&Ei.test(_)){if(a!==-1&&P===a+1)l.push("");if(!_.endsWith("{"))a=P}l.push(E)}return l.join(`
|
|
70
|
-
`)}};var Oi={meta:{docs:"Limit the number of statements allowed on a single line"},check:(y,b)=>{let s=b.options&&typeof b.options.max==="number"?b.options.max:1,l=[],n=c(y).split(/\r?\n/),i=(w)=>{let a=Kl(w),P=(a>=0?w.slice(0,a):w).replace(/^\s*;+/,""),E=0,_=!1,D=!1,j=!1,B=!1,Z=!1,z=!1,Y=0,X="",J=(ee)=>{if(ee===" "||ee==="\t")return;X=ee};for(let ee=0;ee<P.length;ee++){let le=P[ee];if(Z){Z=!1;continue}if(le==="\\"){Z=!0;continue}if(j){if(B){if(le==="]")B=!1;continue}if(le==="["){B=!0;continue}if(le==="/"){j=!1;while(ee+1<P.length&&/[a-z]/i.test(P[ee+1]))ee++;X="/"}continue}if(!D&&le==="'"){_=!_,J(_?"'":"x");continue}if(!_&&le==='"'){D=!D,J(D?'"':"x");continue}if(_||D)continue;if(le==="/"&&_i(X,P,ee)){j=!0;continue}if(!z){if(le==="f"&&P.slice(ee,ee+4).match(/^for\b/)){let ge=P.slice(ee+3).trimStart(),be=P.length-ge.length;if(P[be]==="("){z=!0,Y=1,ee=be,X="(";continue}}}else if(le==="(")Y++;else if(le===")"){if(Y--,Y<=0)z=!1}else if(le===";"){J(le);continue}if(le===";")E++;J(le)}if(E===0)return 1;return P.trimEnd().endsWith(";")?E:E+1};for(let w=0;w<n.length;w++){let a=n[w];if(/^\s*$/.test(a))continue;let P=a.includes(";")?i(a):1;if(P>s)l.push({filePath:b.filePath,line:w+1,column:1,ruleId:"max-statements-per-line",message:`This line has ${P} statements. Maximum allowed is ${s}`,severity:"warning"})}return l}};function Kl(y){let b=!1,s=!1,l=!1,n=!1,i=!1,w=!1,a="";for(let P=0;P<y.length;P++){let E=y[P];if(w){w=!1;continue}if(E==="\\"){w=!0;continue}if(n){if(i){if(E==="]")i=!1;continue}if(E==="["){i=!0;continue}if(E==="/"){n=!1;while(P+1<y.length&&/[a-z]/i.test(y[P+1]))P++;a="/"}continue}if(!s&&!l&&E==="'"){b=!b,a=E;continue}if(!b&&!l&&E==='"'){s=!s,a=E;continue}if(!b&&!s&&E==="`"){l=!l,a=E;continue}if(b||s||l)continue;if(E==="/"&&y[P+1]==="/")return P;if(E==="/"&&_i(a,y,P)){n=!0;continue}if(E!==" "&&E!=="\t")a=E}return-1}function _i(y,b,s){if(y==="")return!0;if("([{,:;!?&|=<>~^+*%-".includes(y))return!0;if(/[A-Za-z_$]/.test(y)){if(b.slice(0,s).trimEnd().match(/(?:^|[^A-Za-z0-9_$])(return|typeof|instanceof|new|delete|void|in|of|yield|await|throw|case)$/))return!0}return!1}function Ti(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var Wi={meta:{docs:"Enforce consistent multiline ternary expressions",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a=i.indexOf("?");if(a===-1)continue;if(i[a+1]==="."||i[a+1]==="?")continue;if(Ti(i,a))continue;if(i.indexOf(":",a+1)!==-1)continue;for(let E=n+1;E<Math.min(n+10,l.length);E++){let _=l[E].trim();if(_.startsWith(":"))break;let D=_.indexOf(":");if(D>0&&!Ti(l[E],D)){if(_.match(/^\w+\s*:/)||_.match(/^case\b/))continue;s.push({filePath:b.filePath,line:E+1,column:l[E].indexOf(":")+1,ruleId:"style/multiline-ternary",message:"In multiline ternary, ':' should be at the start of the line",severity:"warning"});break}}}return s}};var Ni=new RegExp("\\bnew\\s+([A-Z][a-zA-Z0-9_$.]+)(?![a-zA-Z0-9_$])(?:\\s*<[^>]*>)?\\s*(?=[^(;\\n]|$)","g");function Hl(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var Di={meta:{docs:"Require parentheses when invoking a constructor with no arguments",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;Ni.lastIndex=0;while((a=Ni.exec(i))!==null){if(Hl(i,a.index))continue;if(i.slice(a.index+a[0].length).startsWith("("))continue;if(a[0].includes("new."))continue;s.push({filePath:b.filePath,line:n+1,column:a.index+1,ruleId:"style/new-parens",message:`Missing parentheses invoking constructor '${a[1]}'`,severity:"warning",help:"Add () after the constructor name."})}}return s},fix(y){return y.replace(/\bnew\s+([A-Z][a-zA-Z0-9_$.]+)(?![a-zA-Z0-9_$])(\s*<[^>]*>)?\s*(?=[^(]|$)/g,(b,s,l)=>{if(b.slice(b.indexOf(s)+s.length+(l?.length||0)).trim().startsWith("("))return b;return`new ${s}${l||""}()`})}};var Hd=new RegExp("\\breturn\\s+\\(([^()]*)\\)\\s*[;\\n]","g"),ji=/^[a-zA-Z_$][a-zA-Z0-9_$.[\]'"`]*$/;var Ui={meta:{docs:"Remove redundant parentheses in return statements",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a=new RegExp("^return\\s+\\(([^()]*)\\)\\s*;?\\s*$"),P=w.match(a);if(P){let E=P[1].trim();if(ji.test(E)||/^['"`]/.test(E)||/^\d/.test(E)||E==="true"||E==="false"||E==="null"||E==="undefined")s.push({filePath:b.filePath,line:n+1,column:i.indexOf("(")+1,ruleId:"style/no-extra-parens",message:"Unnecessary parentheses around return value",severity:"warning",help:"Remove the outer parentheses."})}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l.trim(),i=new RegExp("^return\\s+\\(([^()]*)\\)\\s*(;?)\\s*$"),w=n.match(i);if(w){let a=w[1].trim(),P=w[2];if(ji.test(a)||/^['"`]/.test(a)||/^\d/.test(a)||a==="true"||a==="false"||a==="null"||a==="undefined"){let E=l.match(/^(\s*)/)?.[1]||"";s.push(`${E}return ${a}${P}`);continue}}s.push(l)}return s.join(`
|
|
71
|
-
`)}};var Fi=/(\S)\s+(\.)[a-zA-Z_$]/g,Bi=/(\S)\s+(\?\.)[a-zA-Z_$]/g;function Mn(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var qi={meta:{docs:"Disallow whitespace before . or ?. in property access",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;Fi.lastIndex=0;while((a=Fi.exec(i))!==null){let P=a.index+a[0].indexOf(".");if(Mn(i,a.index))continue;if(P+1<i.length&&i[P+1]===".")continue;if(P>0&&i[P-1]===".")continue;s.push({filePath:b.filePath,line:n+1,column:P+1,ruleId:"style/no-whitespace-before-property",message:"Unexpected whitespace before property access dot",severity:"warning"})}Bi.lastIndex=0;while((a=Bi.exec(i))!==null){let P=a.index+a[0].indexOf("?.");if(Mn(i,a.index))continue;s.push({filePath:b.filePath,line:n+1,column:P+1,ruleId:"style/no-whitespace-before-property",message:"Unexpected whitespace before optional chaining operator",severity:"warning"})}}return s},fix(y,b){let s=y.split(/\r?\n/),l=[];for(let n=0;n<s.length;n++){let i=s[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*")){l.push(i);continue}let a=i;a=a.replace(/(\S)\s+(\?\.[a-zA-Z_$])/g,(P,E,_,D)=>{if(Mn(i,D))return P;return E+_}),a=a.replace(/(\S)\s+(\.[a-zA-Z_$])/g,(P,E,_,D)=>{if(Mn(i,D))return P;let j=D+P.indexOf(".");if(j+1<a.length&&a[j+1]===".")return P;return E+_}),l.push(a)}return l.join(`
|
|
72
|
-
`)}};function Ve(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var zi=/&&/g,Zi=/\|\|/g,Gi=/\?\?/g,Vi=/(?<![&])&(?![&=])/g,Ki=/(?<![|])\|(?![|=])/g,Hi=/\^(?!=)/g;function Yl(y){let b=[];zi.lastIndex=0;let s;while((s=zi.exec(y))!==null)if(!Ve(y,s.index))b.push({op:"&&",group:0,index:s.index});Zi.lastIndex=0;while((s=Zi.exec(y))!==null)if(!Ve(y,s.index))b.push({op:"||",group:1,index:s.index});Gi.lastIndex=0;while((s=Gi.exec(y))!==null)if(!Ve(y,s.index))b.push({op:"??",group:2,index:s.index});Vi.lastIndex=0;while((s=Vi.exec(y))!==null)if(!Ve(y,s.index))b.push({op:"&",group:3,index:s.index});Ki.lastIndex=0;while((s=Ki.exec(y))!==null)if(!Ve(y,s.index))b.push({op:"|",group:4,index:s.index});Hi.lastIndex=0;while((s=Hi.exec(y))!==null)if(!Ve(y,s.index))b.push({op:"^",group:5,index:s.index});return b.sort((l,n)=>l.index-n.index)}function Xl(y,b){if(b.length<2)return!0;let s=[];for(let i of b){let w=0;for(let a=0;a<i.index;a++)if(y[a]==="(")w++;else if(y[a]===")")w--;s.push(w)}let l=new Map;for(let i=0;i<b.length;i++){let w=b[i].group;if(!l.has(w))l.set(w,[]);l.get(w).push(s[i])}let n=[...l.entries()];if(n.length===2){let[,i]=n[0],[,w]=n[1],a=Math.min(...i),P=Math.max(...i),E=Math.min(...w),_=Math.max(...w);if(a>_||E>P)return!0}return!1}var Jl=[{groups:[0,1],label:"&& and ||"},{groups:[0,2],label:"&& and ??"},{groups:[1,2],label:"|| and ??"},{groups:[3,4],label:"& and |"},{groups:[3,5],label:"& and ^"},{groups:[4,5],label:"| and ^"}],Yi={meta:{docs:"Disallow mixed logical/bitwise operators without parentheses",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a=Yl(i);if(a.length<2)continue;let P=new Set(a.map((E)=>E.group));for(let E of Jl)if(P.has(E.groups[0])&&P.has(E.groups[1])){let _=a.filter((D)=>D.group===E.groups[0]||D.group===E.groups[1]);if(!Xl(i,_)){let D=_.find((j)=>j.group===E.groups[1]);if(D)s.push({filePath:b.filePath,line:n+1,column:D.index+1,ruleId:"style/no-mixed-operators",message:`Unexpected mix of ${E.label} without parentheses`,severity:"warning"})}}}return s}};var Xi=/(?<![0-9.])\.\d/g,Ji=/\d\.(?!\d|\.|\w)/g;function Qi(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var er={meta:{docs:"Disallow floating decimals like .5 or 2.",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;Xi.lastIndex=0;while((a=Xi.exec(i))!==null){if(Qi(i,a.index))continue;if(a.index>0){let P=i[a.index-1];if(/[a-zA-Z_$)\]]/.test(P))continue}s.push({filePath:b.filePath,line:n+1,column:a.index+1,ruleId:"style/no-floating-decimal",message:"Unexpected leading decimal point",severity:"warning",help:"Add a leading 0 before the decimal point: 0.5 instead of .5"})}Ji.lastIndex=0;while((a=Ji.exec(i))!==null){if(Qi(i,a.index))continue;s.push({filePath:b.filePath,line:n+1,column:a.index+1,ruleId:"style/no-floating-decimal",message:"Unexpected trailing decimal point",severity:"warning",help:"Add a trailing 0 after the decimal point: 2.0 instead of 2."})}}return s},fix(y){let b=y;return b=b.replace(/(?<![a-zA-Z_$0-9.)\]])\.\d/g,(s)=>`0${s}`),b=b.replace(/(\d)\.(?!\d|\.|\w)/g,(s,l)=>`${l}.0`),b}};var tr={meta:{docs:"Disallow mixed spaces and tabs for indentation",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let w=l[n].match(/^(\s*)/)?.[1]||"";if(!w)continue;let a=w.includes("\t"),P=w.includes(" ");if(a&&P)s.push({filePath:b.filePath,line:n+1,column:1,ruleId:"style/no-mixed-spaces-and-tabs",message:"Mixed spaces and tabs in indentation",severity:"warning",help:"Use either spaces or tabs for indentation, not both."})}return s}};var nr={meta:{docs:"Disallow multiple consecutive spaces",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];if(!i.trim())continue;let w=i.match(/^(\s*)/)?.[1]||"",a=i.slice(w.length),P=/ {2,}/g,E;for(E=P.exec(a);E!==null;E=P.exec(a)){let _=w.length+E.index+1,D=a.slice(0,E.index),j=(D.match(/'/g)||[]).length,B=(D.match(/"/g)||[]).length,Z=(D.match(/`/g)||[]).length;if(j%2===1||B%2===1||Z%2===1)continue;if(D.includes("//"))continue;if(i.trim().startsWith("*")||i.trim().startsWith("/*"))continue;s.push({filePath:b.filePath,line:n+1,column:_,ruleId:"style/no-multi-spaces",message:"Multiple spaces found",severity:"warning",help:"Remove extra spaces. Use single spaces between tokens."})}}return s}};var sr={meta:{docs:"Disallow multiple consecutive blank lines",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/),n=0,i=-1;for(let w=0;w<l.length;w++)if(l[w].trim()===""){if(n++,i===-1)i=w;if(n>1&&w===i+n-1)s.push({filePath:b.filePath,line:w+1,column:1,ruleId:"style/no-multiple-empty-lines",message:"More than 1 blank line not allowed",severity:"error",help:"Remove extra blank lines. Maximum 1 consecutive blank line allowed."})}else n=0,i=-1;return s}};var ir={meta:{docs:"Disallow tab characters (when using spaces for indentation)",recommended:!1},check(y,b){let s=[];if(b.config.format?.indentStyle==="tabs")return s;let l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let w=l[n].indexOf("\t");if(w!==-1)s.push({filePath:b.filePath,line:n+1,column:w+1,ruleId:"style/no-tabs",message:"Unexpected tab character",severity:"warning",help:"Use spaces for indentation instead of tabs."})}return s},fix(y,b){let s=b.config.format?.indent??2;return y.replace(/\t/g," ".repeat(s))}};var rr={meta:{docs:"Disallow trailing whitespace at the end of lines",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.match(/(\s+)$/);if(w){let a=i.length-w[1].length+1;s.push({filePath:b.filePath,line:n+1,column:a,ruleId:"style/no-trailing-spaces",message:"Trailing spaces not allowed",severity:"error",help:"Remove trailing whitespace from the end of this line."})}}return s}};function or(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var lr={meta:{docs:"Require spaces inside curly braces in objects and destructuring",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]==="{"&&!or(i,a)){let P=i[a+1];if(P==="}"||P===void 0||P===`
|
|
73
|
-
`)continue;if(a>0&&i[a-1]==="$")continue;if(P!==" "&&P!=="\t")s.push({filePath:b.filePath,line:n+1,column:a+2,ruleId:"style/object-curly-spacing",message:"Missing space after '{'",severity:"warning"})}if(i[a]==="}"&&!or(i,a)){let P=a>0?i[a-1]:void 0;if(P==="{"||P===void 0||P===`
|
|
74
|
-
`)continue;if(a+1<i.length&&i.slice(a+1).match(/^[^}]*\$\{/))continue;if(P!==" "&&P!=="\t")s.push({filePath:b.filePath,line:n+1,column:a+1,ruleId:"style/object-curly-spacing",message:"Missing space before '}'",severity:"warning"})}}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l;n=n.replace(/(?<!\$)\{(\S)/g,(i,w)=>{if(w==="}")return i;return`{ ${w}`}),n=n.replace(/(\S)\}/g,(i,w)=>{if(w==="{"||w==="$")return i;return`${w} }`}),s.push(n)}return s.join(`
|
|
75
|
-
`)}};var cr=/(\&\&|\|\||\?\?|\?|\+|(?<!=)-(?!=)|\*|\/|%|\*\*|\|(?!\|)|&(?!&)|\^|<<|>>>?)\s*$/;function ar(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var ur={meta:{docs:"Enforce operators at the beginning of continued lines",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a=w.match(cr);if(a&&n+1<l.length){let P=l[n+1].trim();if(P&&!P.startsWith("//")&&!P.startsWith("*")){let E=i.lastIndexOf(a[1]);if(!ar(i,E)){if(a[1]==="?"||a[1]===":")continue;s.push({filePath:b.filePath,line:n+1,column:E+1,ruleId:"style/operator-linebreak",message:`Operator '${a[1]}' should be at the beginning of the next line`,severity:"warning"})}}}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l=0;l<b.length;l++){let n=b[l],i=n.trim();if(!i||i.startsWith("//")||i.startsWith("*")||i.startsWith("/*")||i.endsWith("*/")){s.push(n);continue}let w=i.match(cr);if(w&&l+1<b.length&&w[1]!=="?"&&w[1]!==":"){let a=b[l+1],P=a.trim();if(P&&!P.startsWith("//")&&!P.startsWith("*")){let E=w[1],_=n.lastIndexOf(w[1]);if(ar(n,_)){s.push(n);continue}s.push(n.replace(new RegExp(`\\s*${E.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let D=a.match(/^(\s*)/)?.[1]||"";b[l+1]=`${D}${E} ${P}`;continue}}s.push(n)}return s.join(`
|
|
76
|
-
`)}};var fr={meta:{docs:"Disallow empty lines at the beginning and end of blocks",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let w=l[n].trim();if(w.endsWith("{")&&n+1<l.length){if(l[n+1].trim()==="")s.push({filePath:b.filePath,line:n+2,column:1,ruleId:"style/padded-blocks",message:"Unexpected empty line after opening brace",severity:"warning"})}if(w==="}"&&n>0){if(l[n-1].trim()==="")s.push({filePath:b.filePath,line:n,column:1,ruleId:"style/padded-blocks",message:"Unexpected empty line before closing brace",severity:"warning"})}}return s},fix(y){let b=y.split(/\r?\n/),s=new Set;for(let l=0;l<b.length;l++){let n=b[l].trim();if(n.endsWith("{")&&l+1<b.length&&b[l+1].trim()==="")s.add(l+1);if(n==="}"&&l>0&&b[l-1].trim()==="")s.add(l-1)}return b.filter((l,n)=>!s.has(n)).join(`
|
|
77
|
-
`)}};var Dn=/^(\s*)(["'])([a-zA-Z_$][a-zA-Z0-9_$]*)\2\s*:/;var mr={meta:{docs:"Remove unnecessary quotes from object property keys",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a=i.match(Dn);if(a){let P=a[3];if(["class","return","function","var","let","const","delete","typeof","void","in","instanceof","new","this","throw","try","catch","finally","switch","case","default","break","continue","do","while","for","if","else","with","import","export","extends","super","yield","await","enum","implements","interface","package","private","protected","public","static"].includes(P))continue;s.push({filePath:b.filePath,line:n+1,column:i.indexOf(a[2])+1,ruleId:"style/quote-props",message:`Unnecessarily quoted property '${P}'`,severity:"warning",help:"Remove quotes from this property key."})}}return s},fix(y){let b=y.split(/\r?\n/),s=[],l=new Set(["class","return","function","var","let","const","delete","typeof","void","in","instanceof","new","this","throw","try","catch","finally","switch","case","default","break","continue","do","while","for","if","else","with","import","export","extends","super","yield","await","enum","implements","interface","package","private","protected","public","static"]);for(let n of b){let i=n,w=n.match(Dn);if(w&&!l.has(w[3]))i=n.replace(Dn,"$1$3:");s.push(i)}return s.join(`
|
|
78
|
-
`)}};function Ql(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var pr=/\.\.\.\s+([a-zA-Z_$])/g,dr={meta:{docs:"Disallow space after spread/rest operator (...)",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;pr.lastIndex=0;while((a=pr.exec(i))!==null){if(Ql(i,a.index))continue;s.push({filePath:b.filePath,line:n+1,column:a.index+4,ruleId:"style/rest-spread-spacing",message:"Unexpected space after spread operator",severity:"warning"})}}return s},fix(y){return y.replace(/\.\.\.\s+([a-zA-Z_$\[{])/g,"...$1")}};function ec(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var hr={meta:{docs:"Disallow space before semicolons, require space after",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]!==";")continue;if(ec(i,a))continue;if(a>0&&i[a-1]===" "){if(i.slice(0,a).trim().length>0)s.push({filePath:b.filePath,line:n+1,column:a+1,ruleId:"style/semi-spacing",message:"Unexpected space before semicolon",severity:"warning"})}if(a+1<i.length&&i[a+1]!==" "&&i[a+1]!=="\t"&&i[a+1]!==`
|
|
79
|
-
`&&i[a+1]!=="\r"&&i[a+1]!==")"){let P=i.slice(a+1);if(i.slice(0,a).includes(";")||P.includes(";"))s.push({filePath:b.filePath,line:n+1,column:a+2,ruleId:"style/semi-spacing",message:"Missing space after semicolon",severity:"warning"})}}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l,i=new RegExp(" ;","g");n=n.replace(i,String.fromCharCode(59));let w=new RegExp(";(\\S)","g");n=n.replace(w,(a,P)=>{if(P===";"||P===")")return a;return`; ${P}`}),s.push(n)}return s.join(`
|
|
80
|
-
`)}};var gr=/(\S)\{/g;function tc(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var yr={meta:{docs:"Require space before opening brace of blocks",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;gr.lastIndex=0;while((a=gr.exec(i))!==null){let P=a.index,E=a[1];if(tc(i,P))continue;if(E==="$")continue;if(E==="="||E===":"||E==="("||E===","||E==="[")continue;if(E==="{")continue;if(E===")"||/[a-zA-Z0-9_]/.test(E))s.push({filePath:b.filePath,line:n+1,column:a.index+2,ruleId:"style/space-before-blocks",message:"Missing space before '{'",severity:"warning"})}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l.replace(/([)a-zA-Z0-9_])\{/g,"$1 {");s.push(n)}return s.join(`
|
|
81
|
-
`)}};var br=/\bfunction\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s+\(/g,xr=/\bfunction\(/g;function Rr(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var wr={meta:{docs:"Control spacing before ( in function declarations",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;br.lastIndex=0;while((a=br.exec(i))!==null){if(Rr(i,a.index))continue;s.push({filePath:b.filePath,line:n+1,column:a.index+a[0].length,ruleId:"style/space-before-function-paren",message:"Unexpected space before function parentheses",severity:"warning"})}xr.lastIndex=0;while((a=xr.exec(i))!==null){if(Rr(i,a.index))continue;if(i.slice(0,a.index+8).match(/function\s+[a-zA-Z_$]/))continue;s.push({filePath:b.filePath,line:n+1,column:a.index+9,ruleId:"style/space-before-function-paren",message:"Missing space before function parentheses",severity:"warning"})}}return s},fix(y){let b=y;return b=b.replace(/\bfunction\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s+\(/g,"function $1("),b=b.replace(/\bfunction\(/g,"function ("),b}};function kr(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var Ir={meta:{docs:"Disallow spaces inside parentheses",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]==="("&&!kr(i,a)){let P=i[a+1];if(P===")"||P===void 0||P===`
|
|
82
|
-
`)continue;if(P===" ")s.push({filePath:b.filePath,line:n+1,column:a+2,ruleId:"style/space-in-parens",message:"Unexpected space after '('",severity:"warning"})}if(i[a]===")"&&!kr(i,a)){if(a===0)continue;let P=i[a-1];if(P==="(")continue;if(P===" "){if(i.slice(0,a).includes("("))s.push({filePath:b.filePath,line:n+1,column:a,ruleId:"style/space-in-parens",message:"Unexpected space before ')'",severity:"warning"})}}}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l;n=n.replace(/\(\s+(\S)/g,"($1"),n=n.replace(/(\S)\s+\)/g,"$1)"),s.push(n)}return s.join(`
|
|
83
|
-
`)}};var Pr=["&&","||","??","+=","-=","*=","/=","%=","**=","<<=",">>=",">>>=","&=","|=","^=","??=","||=","&&="];function nc(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var Mr={meta:{docs:"Require spacing around infix operators (&&, ||, ??, assignment operators)",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;for(let a of Pr){let P=0,E;while((E=i.indexOf(a,P))!==-1){if(P=E+a.length,nc(i,E))continue;if(a==="&&"&&i[E+2]==="=")continue;if(a==="||"&&i[E+2]==="=")continue;if(a==="??"&&i[E+2]==="=")continue;let _=E>0?i[E-1]:" ",D=E+a.length<i.length?i[E+a.length]:" ";if(_!==" "&&_!=="\t")s.push({filePath:b.filePath,line:n+1,column:E+1,ruleId:"style/space-infix-ops",message:`Missing space before '${a}'`,severity:"warning"});if(D!==" "&&D!=="\t"&&D!==`
|
|
84
|
-
`&&D!=="\r")s.push({filePath:b.filePath,line:n+1,column:E+a.length+1,ruleId:"style/space-infix-ops",message:`Missing space after '${a}'`,severity:"warning"})}}}return s},fix(y){let b=y,s=[...Pr].sort((l,n)=>n.length-l.length);for(let l of s){let n=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");b=b.replace(new RegExp(`(\\S)${n}`,"g"),`$1 ${l}`),b=b.replace(new RegExp(`${n}(\\S)`,"g"),`${l} $1`)}return b}};var vr=["typeof","void","delete","new","throw","yield","await"];function jn(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var $r={meta:{docs:"Require space after word unary operators, disallow space after symbol unary operators",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;for(let _ of vr){let D=new RegExp(`\\b${_}([^\\s;,)])`,"g"),j;while((j=D.exec(i))!==null){if(jn(i,j.index))continue;s.push({filePath:b.filePath,line:n+1,column:j.index+_.length+1,ruleId:"style/space-unary-ops",message:`Missing space after '${_}'`,severity:"warning"})}}let a=/!\s+([a-zA-Z_$({[])/g,P;while((P=a.exec(i))!==null){if(jn(i,P.index))continue;let _=i.slice(0,P.index),D=_.trimEnd().slice(-1),j=new RegExp("[=(<[{,;|&?:+\\-*/!~^%]");if(!D||j.test(D)||_.trimEnd().endsWith("return")||_.trimEnd().endsWith("case"))s.push({filePath:b.filePath,line:n+1,column:P.index+2,ruleId:"style/space-unary-ops",message:"Unexpected space after '!'",severity:"warning"})}let E=/~\s+([a-zA-Z_$({[])/g;while((P=E.exec(i))!==null){if(jn(i,P.index))continue;s.push({filePath:b.filePath,line:n+1,column:P.index+2,ruleId:"style/space-unary-ops",message:"Unexpected space after '~'",severity:"warning"})}}return s},fix(y){let b=y;for(let s of vr)b=b.replace(new RegExp(`\\b${s}([^\\s;,)])`,"g"),`${s} $1`);return b=b.replace(/!\s+([a-zA-Z_$({[])/g,"!$1"),b=b.replace(/~\s+([a-zA-Z_$({[])/g,"~$1"),b}};var Cr={meta:{docs:"Require space after // and /* in comments",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim(),a=i.indexOf("//");if(a!==-1){let E=i.slice(0,a),_=(E.match(/'/g)||[]).length,D=(E.match(/"/g)||[]).length,j=(E.match(/`/g)||[]).length;if(_%2===0&&D%2===0&&j%2===0){if(!E.match(/https?:$/)){let B=i.slice(a+2);if(B.length>0&&B[0]!==" "&&B[0]!=="\t"&&B[0]!=="/"&&B[0]!=="!")s.push({filePath:b.filePath,line:n+1,column:a+3,ruleId:"style/spaced-comment",message:"Missing space after '//'",severity:"warning",help:"Add a space after // in comments."})}}}let P=i.indexOf("/*");if(P!==-1&&i[P+2]!=="*"&&i[P+2]!=="!"){let E=i.slice(0,P),_=(E.match(/'/g)||[]).length,D=(E.match(/"/g)||[]).length,j=(E.match(/`/g)||[]).length;if(_%2===0&&D%2===0&&j%2===0){let B=i.slice(P+2);if(B.length>0&&B[0]!==" "&&B[0]!=="\t"&&B[0]!==`
|
|
85
|
-
`)s.push({filePath:b.filePath,line:n+1,column:P+3,ruleId:"style/spaced-comment",message:"Missing space after '/*'",severity:"warning",help:"Add a space after /* in comments."})}}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l;n=n.replace(/(\/\/)([^\s/!])/,"$1 $2"),n=n.replace(/(\/\*)([^\s*!])/,"$1 $2"),s.push(n)}return s.join(`
|
|
86
|
-
`)}};var Lr=/^\s*(case\b.+?|default)\s*:/,Sr={meta:{docs:"Enforce spacing around colon in switch case/default clauses",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w)continue;let a=w.match(Lr);if(!a)continue;let P=a[1],E=i.indexOf(":",i.indexOf(P)+P.length);if(E===-1)continue;if(E>0&&i[E-1]===" ")s.push({filePath:b.filePath,line:n+1,column:E+1,ruleId:"style/switch-colon-spacing",message:"Unexpected space before colon in switch case",severity:"warning"});if(E+1<i.length&&i[E+1]!==" "&&i[E+1]!=="\t"&&i[E+1]!==`
|
|
87
|
-
`)s.push({filePath:b.filePath,line:n+1,column:E+2,ruleId:"style/switch-colon-spacing",message:"Missing space after colon in switch case",severity:"warning"})}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l,i=l.trim();if(Lr.test(i))n=n.replace(/(case\b.+?|default)\s+:/,"$1:"),n=n.replace(/(case\b.+?:|default:)(\S)/,"$1 $2");s.push(n)}return s.join(`
|
|
88
|
-
`)}};var Er="${",Ar={meta:{docs:"Disallow spaces inside template literal interpolation curly braces",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n];for(let w=i.indexOf(Er,0);w!==-1;w=i.indexOf(Er,w)){let a=w+2;if(a<i.length&&(i[a]===" "||i[a]==="\t")){if((i.slice(0,w).match(/`/g)||[]).length%2===1)s.push({filePath:b.filePath,line:n+1,column:a+1,ruleId:"style/template-curly-spacing",message:"Unexpected space after '${'",severity:"warning"})}let P=1,E=a;while(E<i.length&&P>0){if(i[E]==="{")P++;if(i[E]==="}")P--;if(P>0)E++}if(P===0&&E>0){let _=i[E-1];if(_===" "||_==="\t"){if((i.slice(0,w).match(/`/g)||[]).length%2===1)s.push({filePath:b.filePath,line:n+1,column:E,ruleId:"style/template-curly-spacing",message:"Unexpected space before '}'",severity:"warning"})}}w=a}}return s},fix(y){return y.replace(/\$\{\s+([^}]*?)\s+\}/g,"${$1}")}};var Ke=/([a-zA-Z_$][a-zA-Z0-9_$]*)\s+`/g;function Or(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var _r=new Set(["return","case","typeof","void","delete","throw","new","in","of","await","yield","export","default","extends","else","instanceof"]),Tr={meta:{docs:"Disallow space between tag function and template literal",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;Ke.lastIndex=0;for(a=Ke.exec(i);a!==null;a=Ke.exec(i)){let P=a[1],E=a.index;if(Or(i,E))continue;if(_r.has(P))continue;let _=E+P.length;s.push({filePath:b.filePath,line:n+1,column:_+1,ruleId:"style/template-tag-spacing",message:"Unexpected space between tag function and template literal",severity:"warning"})}}return s},fix(y,b){let s=y.split(/\r?\n/),l=[];for(let n=0;n<s.length;n++){let i=s[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*")){l.push(i);continue}let a=i,P=[],E;Ke.lastIndex=0;for(E=Ke.exec(i);E!==null;E=Ke.exec(i)){let _=E[1],D=E.index;if(Or(i,D))continue;if(_r.has(_))continue;P.push({index:D,fullMatch:E[0],identifier:_})}for(let _=P.length-1;_>=0;_--){let D=P[_],j=D.index,B=j+D.fullMatch.length;a=`${a.slice(0,j)}${D.identifier}\`${a.slice(B)}`}l.push(a)}return l.join(`
|
|
89
|
-
`)}};var Wr={meta:{docs:"Require parentheses around immediately invoked function expressions (IIFEs)",recommended:!0},check(y,b){let s=[],l=/[^a-zA-Z_$](function\s*\([^)]*\)\s*\{[^}]*\})\s*\(/g,n;for(n=l.exec(y);n!==null;n=l.exec(y)){if(n.index>0&&y[n.index]==="(")continue;let i=y.slice(0,n.index).split(`
|
|
90
|
-
`).length,w=y.lastIndexOf(`
|
|
91
|
-
`,n.index),a=n.index-w;s.push({filePath:b.filePath,line:i,column:a,ruleId:"style/wrap-iife",message:"Wrap immediately invoked function expressions in parentheses",severity:"warning"})}return s},fix(y){return y.replace(/([^a-zA-Z_$(\n])(function\s*\([^)]*\)\s*\{[^}]*\})\s*\(/g,"$1($2)(")}};var Nr=/\byield\s*\*/g;function sc(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var Dr={meta:{docs:"Enforce spacing around * in yield* expressions (no space before *, space after)",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;Nr.lastIndex=0;while((a=Nr.exec(i))!==null){let P=a.index;if(sc(i,P))continue;let E=a[0],_=P+E.length-1,D=_+1;if(E!=="yield*")s.push({filePath:b.filePath,line:n+1,column:_+1,ruleId:"style/yield-star-spacing",message:"Unexpected space before * in yield expression",severity:"warning"});if(D<i.length&&i[D]!==" "&&i[D]!=="\t"&&i[D]!==`
|
|
92
|
-
`)s.push({filePath:b.filePath,line:n+1,column:D+1,ruleId:"style/yield-star-spacing",message:"Missing space after * in yield expression",severity:"warning"})}}return s},fix(y,b){let s=y;return s=s.replace(/\byield\s+\*/g,"yield*"),s=s.replace(/\byield\*(\S)/g,"yield* $1"),s}};var jr={name:"style",rules:{"brace-style":e(ni),curly:e(di),"max-statements-per-line":e(Oi),"if-newline":e(Mi),"consistent-chaining":e(ai),"consistent-list-newline":e(pi),"indent-unindent":e(vi),"no-multi-spaces":k(nr),"no-multiple-empty-lines":k(sr),"no-trailing-spaces":k(rr),"keyword-spacing":e(Si),"arrow-spacing":e(ei),"space-infix-ops":e(Mr),"object-curly-spacing":e(lr),"spaced-comment":e(Cr),"block-spacing":e(ti),"space-before-blocks":e(yr),"comma-spacing":e(oi),"semi-spacing":e(hr),"rest-spread-spacing":e(dr),"generator-star-spacing":e(Pi),"yield-star-spacing":e(Dr),"function-call-spacing":e(wi),"template-tag-spacing":e(Tr),"no-whitespace-before-property":e(qi),"key-spacing":e(Ci),"computed-property-spacing":e(ci),"array-bracket-spacing":e(Ys),"space-in-parens":e(Ir),"template-curly-spacing":e(Ar),"space-unary-ops":e($r),"switch-colon-spacing":e(Sr),"comma-dangle":e(ri),"arrow-parens":e(Js),"space-before-function-paren":e(wr),"quote-props":e(mr),"no-floating-decimal":e(er),"new-parens":e(Di),"no-extra-parens":e(Ui),"wrap-iife":e(Wr),"comma-style":e(li),"dot-location":e(hi),"operator-linebreak":e(ur),"multiline-ternary":e(Wi),"padded-blocks":e(fr),"lines-between-class-members":e(Ai),"no-mixed-operators":e(Yi),"indent-binary-ops":e(bi),"no-tabs":e(ir),"no-mixed-spaces-and-tabs":e(tr)}};var Ur={meta:{docs:"Enforce consistent member delimiter style in interfaces and type literals",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/),n=!1,i=0,w=0;for(let a=0;a<l.length;a++){let P=l[a],E=P.trim();if(!E||E.startsWith("//")||E.startsWith("*")||E.startsWith("/*"))continue;if(E.match(/\b(interface|type)\b.*\{/))n=!0,w=i+1;for(let _ of E){if(_==="{")i++;if(_==="}")i--}if(n&&i<w){n=!1;continue}if(!n||i!==w)continue;if(E==="}"||E==="};"||E==="},")continue;if(E.endsWith(",")){if(E.startsWith("|")||E.startsWith("&"))continue;s.push({filePath:b.filePath,line:a+1,column:P.length,ruleId:"ts/member-delimiter-style",message:"Expected semicolon delimiter in interface, found comma",severity:"warning"})}if(!E.endsWith(";")&&!E.endsWith(",")&&!E.endsWith("{")&&!E.endsWith("(")){if(E.match(/^\w+[\s?]*:/)||E.match(/^\[/)||E.match(/^readonly\b/))s.push({filePath:b.filePath,line:a+1,column:P.length+1,ruleId:"ts/member-delimiter-style",message:"Missing semicolon delimiter in interface member",severity:"warning"})}}return s},fix(y){let b=y.split(/\r?\n/),s=[],l=!1,n=0,i=0;for(let w=0;w<b.length;w++){let a=b[w],P=a.trim();if(P.match(/\b(interface|type)\b.*\{/))l=!0,i=n+1;let E=n;for(let _ of P){if(_==="{")n++;if(_==="}")n--}if(l&&n<i){l=!1,s.push(a);continue}if(l&&E===i&&P!=="}"&&P!=="};"&&P!=="},"){let _=a;if(P.endsWith(","))_=a.replace(/,\s*$/,";");s.push(_);continue}s.push(a)}return s.join(`
|
|
93
|
-
`)}};var Fr={meta:{docs:"Disallow the use of the `any` type - it defeats the purpose of TypeScript type safety"},check:(y,b)=>{let s=[];if(!/\.tsx?$/.test(b.filePath))return s;let l=y.split(/\r?\n/),n=!1;for(let i=0;i<l.length;i++){let w=l[i],a=w;if(n){let B=w.indexOf("*/");if(B>=0)w=w.slice(B+2),n=!1;else continue}let P=w.indexOf("/*"),E=w.indexOf("//");if(P>=0&&(E===-1||P<E)){let B=w.indexOf("*/",P+2);if(B>=0)w=w.slice(0,P)+w.slice(B+2);else n=!0,w=w.slice(0,P)}if(E>=0)w=w.slice(0,E);let _=w.replace(/(['"`])(?:(?!\1)[^\\]|\\.)*?\1/g,'""'),D=/\b(any)\b/g,j;while((j=D.exec(_))!==null){let B=j.index,Z=_[B-1]||" ",z=_[B+3]||" ",Y=_.slice(Math.max(0,B-10),B),X=_.slice(B+3,Math.min(_.length,B+10));if(/\w/.test(Z)||/\w/.test(z))continue;if(/:/.test(Y)||/</.test(Y)||/\bas\s*$/.test(Y)||/,/.test(Y)||/\|/.test(Y)||/&/.test(Y)||/\[/.test(X)||/>/.test(X)||/,/.test(X)||/\|/.test(X)||/extends\s+$/.test(Y)||/=\s*$/.test(Y)){let ie=a.indexOf("any",Math.max(0,B-5));s.push({filePath:b.filePath,line:i+1,column:ie>=0?ie+1:B+1,ruleId:"ts/no-explicit-any",message:"Unexpected `any` type. Specify a more precise type or use `unknown` if the type is truly unknown.",severity:"error",help:"Replace `any` with a specific type, `unknown`, or a generic type parameter"})}}}return s},fix:(y)=>{let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l;n=n.replace(/:\s*any\b(?!\s*\))/g,(i)=>i.replace("any","unknown")),s.push(n)}return s.join(`
|
|
94
|
-
`)}};var Br={meta:{docs:"Require promises to be handled - must be awaited, returned, or have .catch() called"},check:(y,b)=>{let s=[];if(!/\.tsx?$/.test(b.filePath))return s;let l=y.split(/\r?\n/),n=!1;for(let i=0;i<l.length;i++){let w=l[i],a=w;if(n){let j=w.indexOf("*/");if(j>=0)w=w.slice(j+2),n=!1;else continue}let P=w.indexOf("/*"),E=w.indexOf("//");if(P>=0&&(E===-1||P<E)){let j=w.indexOf("*/",P+2);if(j>=0)w=w.slice(0,P)+w.slice(j+2);else n=!0,w=w.slice(0,P)}if(E>=0)w=w.slice(0,E);let _=w.replace(/(['"`])(?:(?!\1)[^\\]|\\.)*?\1/g,'""');if(/\b(?:await|return|void)\s/.test(_))continue;if(/\.(?:then|catch|finally)\s*\(/.test(_))continue;let D=[/\b(fetch|axios|request)\s*\(/,/\b[\w$]*(?:async|Async|load|Load|get|Get|post|Post|put|Put|delete|Delete|save|Save|update|Update|fetch|Fetch)[\w$]*\s*\(/,/\bnew\s+Promise\s*\(/,/\bPromise\s*\.\s*(?:resolve|reject|all|allSettled|race|any)\s*\(/];for(let j of D){let B=_.match(j);if(!B)continue;let Z=_.indexOf(B[0]),z=_.slice(0,Z).trim();if(/\b(?:const|let|var)\s+[\w$]+\s*=\s*$/.test(z))continue;if(/[\w$]+\s*=\s*$/.test(z))continue;if(/\breturn\s+$/.test(z))continue;if(/\(\s*$/.test(z)||/,\s*$/.test(z))continue;let Y=_.slice(Z+B[0].length),X=1,J=B[0].length;while(J<Y.length&&X>0){if(Y[J]==="(")X++;else if(Y[J]===")")X--;J++}let ie=Y.slice(J).trim();if(/^\.(?:then|catch|finally)\s*\(/.test(ie))continue;if(ie===""||ie.startsWith(";")){let Q=a.indexOf(B[0]);s.push({filePath:b.filePath,line:i+1,column:Q>=0?Q+1:Z+1,ruleId:"ts/no-floating-promises",message:"Promise returned by this call is not handled. Add await, return, .catch(), or void.",severity:"error",help:"Either await the promise, return it, add .catch() to handle errors, or use void to explicitly mark as fire-and-forget"});break}}}return s}};var qr={meta:{docs:"Disallow promises in places not designed to handle them (conditionals, logical expressions)"},check:(y,b)=>{let s=[];if(!/\.tsx?$/.test(b.filePath))return s;let l=y.split(/\r?\n/),n=!1;for(let i=0;i<l.length;i++){let w=l[i],a=w;if(n){let Y=w.indexOf("*/");if(Y>=0)w=w.slice(Y+2),n=!1;else continue}let P=w.indexOf("/*"),E=w.indexOf("//");if(P>=0&&(E===-1||P<E)){let Y=w.indexOf("*/",P+2);if(Y>=0)w=w.slice(0,P)+w.slice(Y+2);else n=!0,w=w.slice(0,P)}if(E>=0)w=w.slice(0,E);let _=w.replace(/(['"`])(?:(?!\1)[^\\]|\\.)*?\1/g,'""'),D=_.match(/\bif\s*\(\s*(!?)\s*([\w$]+\s*\([^)]*\))/);if(D){let Y=D[1],X=D[2];if(/async|Async|fetch|Fetch|load|Load|get|Get|save|Save/.test(X)){let J=_.slice(0,_.indexOf(D[0])),ie=_.slice(_.indexOf("if (")+4);if(!/\bawait\s/.test(ie)){let Q=a.indexOf(X);s.push({filePath:b.filePath,line:i+1,column:Q>=0?Q+1:1,ruleId:"ts/no-misused-promises",message:"Promise used in conditional expression without await. Promises are always truthy.",severity:"error",help:"Add await before the async call in the condition"})}}}let j=/(?:async|Async|fetch|Fetch|load|Load|get|Get|save|Save|Promise\.)[\w$]*\s*\([^)]*\)/g,B;while((B=j.exec(_))!==null){let Y=B.index,X=B[0],J=_.slice(Math.max(0,Y-10),Y),ie=_.slice(Y+X.length,Math.min(_.length,Y+X.length+10));if(/(?:&&|\|\|)\s*$/.test(J)||/^\s*(?:&&|\|\|)/.test(ie)){if(!/\bawait\s*$/.test(J)){let ee=a.indexOf(X,Math.max(0,Y-5));s.push({filePath:b.filePath,line:i+1,column:ee>=0?ee+1:Y+1,ruleId:"ts/no-misused-promises",message:"Promise used in logical expression without await. This will not work as expected.",severity:"error",help:"Add await before the async call or restructure the logic"})}}let Q=_.slice(Math.max(0,Y-20),Y);if(/\?\s*$/.test(J)||/\?[^:]*$/.test(Q)){if(!/\bawait\s*$/.test(J)){let ee=a.indexOf(X,Math.max(0,Y-5));s.push({filePath:b.filePath,line:i+1,column:ee>=0?ee+1:Y+1,ruleId:"ts/no-misused-promises",message:"Promise used in ternary expression without await.",severity:"error",help:"Add await before the async call"})}}}let Z=_.match(/\b(?:while|for)\s*\([^)]*(?:async|Async|fetch|Fetch|load|Load|get|Get)[\w$]*\s*\([^)]*\)/);if(Z){if(!/\bawait\s/.test(Z[0])){let Y=a.indexOf(Z[0]);s.push({filePath:b.filePath,line:i+1,column:Y>=0?Y+1:1,ruleId:"ts/no-misused-promises",message:"Promise used in loop condition without await. This will cause unexpected behavior.",severity:"error",help:"Add await before the async call in the loop condition"})}}let z=_.match(/\.(forEach|map|filter|reduce|every|some|find|findIndex)\s*\(\s*async\s*(?:\(|[\w$]+\s*=>)/);if(z){if(z[1]==="forEach"){let X=a.indexOf(z[0]);s.push({filePath:b.filePath,line:i+1,column:X>=0?X+1:1,ruleId:"ts/no-misused-promises",message:"async callback in forEach - forEach does not wait for promises to resolve.",severity:"error",help:"Use for...of loop with await, or Promise.all() with map()"})}}}return s}};var zr={meta:{docs:"Disallow require() in TypeScript files; prefer ESM imports"},check:(y,b)=>{let s=[];if(!/\.ts$/.test(b.filePath))return s;let l=y.split(/\r?\n/),n=!1;for(let i=0;i<l.length;i++){let w=l[i],a=w;if(n){let j=a.indexOf("*/");if(j>=0)a=a.slice(j+2),n=!1;else continue}let P=a.indexOf("/*"),E=a.indexOf("//");if(P>=0&&(E===-1||P<E)){let j=a.indexOf("*/",P+2);if(j>=0)a=a.slice(0,P)+a.slice(j+2);else n=!0,a=a.slice(0,P)}if(E>=0)a=a.slice(0,E);let _=a.trim();if(!_)continue;if(/\bimport\s*\(/.test(_))continue;let D=_.indexOf("require(");if(D>=0){s.push({filePath:b.filePath,line:i+1,column:w.indexOf("require(")+1||D+1,ruleId:"ts/no-require-imports",message:"Do not use require() in TypeScript files. Use ESM import syntax instead.",severity:"error"});continue}if(/^import\s+(?:\S.*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])=\s*require\s*\(/.test(_)){let j=w.indexOf("require(");s.push({filePath:b.filePath,line:i+1,column:j>-1?j+1:1,ruleId:"ts/no-require-imports",message:"Do not use require() in TypeScript files. Use ESM import syntax instead.",severity:"error"})}}return s}};var Zr={meta:{docs:"Disallow top-level await in TypeScript/JavaScript files"},check:(y,b)=>{let s=[],l=b.filePath.split(".").pop()||"";if(!["ts","tsx","mts","cts","js","mjs","cjs"].includes(l))return s;let n=c(y),i=0,w=0,a=1;for(let P=0;P<n.length;P++){let E=n[P];if(w++,E===`
|
|
95
|
-
`){a++,w=0;continue}if(E==="{"){i++;continue}if(E==="}"){if(i>0)i--;continue}if(E==="a"&&n.slice(P,P+5)==="await"){let _=n.slice(Math.max(0,P-6),P),D=/for\s+$/.test(_),j=P===0||/[^$\w]/.test(n[P-1]),B=/[^$\w]/.test(n[P+5]||" ");if(!D&&j&&B&&i===0)s.push({filePath:b.filePath,line:a,column:w,ruleId:"ts/no-top-level-await",message:"Do not use top-level await",severity:"error"});P+=4,w+=4}}return s}};var Gr={meta:{docs:"Disallow `exports =` in TypeScript; prefer ESM export default"},check:(y,b)=>{let s=[],l=b.filePath.split(".").pop()||"";if(!["ts","tsx","mts","cts","d.ts"].includes(l))return s;let n=y.split(/\r?\n/);for(let i=0;i<n.length;i++){let P=n[i].replace(/\/\*.*?\*\//g,"").replace(/\/\/.*$/,"").match(/\bexports\s*=\s*/);if(P)s.push({filePath:b.filePath,line:i+1,column:(P.index||0)+1,ruleId:"ts/no-ts-export-equal",message:"Use ESM `export default` instead of `exports =`",severity:"error"})}return s}};var Vr={meta:{docs:"Disallow assignment of `any` typed values to variables - unsafe assignments bypass type checking"},check:(y,b)=>{let s=[];if(!/\.tsx?$/.test(b.filePath))return s;let l=y.split(/\r?\n/),n=!1;for(let i=0;i<l.length;i++){let w=l[i],a=w;if(n){let J=w.indexOf("*/");if(J>=0)w=w.slice(J+2),n=!1;else continue}let P=w.indexOf("/*"),E=w.indexOf("//");if(P>=0&&(E===-1||P<E)){let J=w.indexOf("*/",P+2);if(J>=0)w=w.slice(0,P)+w.slice(J+2);else n=!0,w=w.slice(0,P)}if(E>=0)w=w.slice(0,E);let _=w.replace(/(['"`])(?:(?!\1)[^\\]|\\.)*?\1/g,'""'),D=/(\w+)\s+as\s+any/g,j;while((j=D.exec(_))!==null){let J=j[1],ie=j.index,Q=_.slice(ie+j[0].length).trim(),ee=_.slice(0,ie).trim();if(/=\s*$/.test(ee)&&!/==|===|!=|!==/.test(ee)){let le=a.indexOf(j[0]);s.push({filePath:b.filePath,line:i+1,column:le>=0?le+1:ie+1,ruleId:"ts/no-unsafe-assignment",message:"Unsafe assignment: value cast to `any` is being assigned. This bypasses type checking.",severity:"error",help:"Avoid casting to `any` or use a more specific type"})}}let B=["JSON.parse","eval","Function","require"];for(let J of B){let ie=new RegExp(`\\b${J.replace(".","\\.")}\\s*\\(`,"g");ie.lastIndex=0;while((j=ie.exec(_))!==null){let Q=j.index,ee=_.slice(0,Q).trim(),le=ee.match(/(?:const|let|var)\s+([\w$]+)\s*=\s*$/);if(le){let te=le[1];if(!new RegExp(`\\b${te}\\s*:\\s*\\w+`).test(_)){let ce=a.indexOf(j[0]);s.push({filePath:b.filePath,line:i+1,column:ce>=0?ce+1:Q+1,ruleId:"ts/no-unsafe-assignment",message:`Unsafe assignment from ${J}() without type annotation. This function returns 'any'.`,severity:"error",help:`Add a type annotation to ${te} or use a type assertion with a specific type`})}}let ge=ee.match(/([\w$.]+)\s*=\s*$/),be=/(?:const|let|var)\s+/.test(ee);if(ge&&!le&&!be){let te=a.indexOf(j[0]);s.push({filePath:b.filePath,line:i+1,column:te>=0?te+1:Q+1,ruleId:"ts/no-unsafe-assignment",message:`Unsafe assignment from ${J}() which returns 'any'.`,severity:"error",help:"Consider adding a type assertion with a specific type"})}}}let Z=/(?:const|let|var)\s+([\w$]+)\s*:\s*any\s*=/,z=_.match(Z);if(z){let J=z[1],ie=a.indexOf(z[0]);s.push({filePath:b.filePath,line:i+1,column:ie>=0?ie+1:1,ruleId:"ts/no-unsafe-assignment",message:`Variable '${J}' is explicitly typed as 'any'. This defeats TypeScript's type safety.`,severity:"error",help:"Use a more specific type or `unknown` instead of `any`"})}let Y=/(?:const|let|var)\s+(?:\{[^}]+\}|\[[^\]]+\])\s*=\s*([\w$]+)/,X=_.match(Y);if(X){let J=X[1];if(/^(?:params|query|body|req|res|response|data|result)$/.test(J));}}return s}};var Kr={meta:{docs:"Prefer nullish coalescing operator (??) over logical OR (||) when checking for null/undefined"},check:(y,b)=>{let s=[];if(!/\.tsx?$/.test(b.filePath))return s;let l=y.split(/\r?\n/),n=!1;for(let i=0;i<l.length;i++){let w=l[i],a=w.split(""),P=a.length,E=0;if(n){let Z=w.indexOf("*/");if(Z<0)continue;for(let z=0;z<=Z+1;z++)a[z]=" ";n=!1,E=Z+2}let _=null;for(;E<P;E++){let Z=a[E];if(_){if(Z==="\\"){if(a[E]=" ",E+1<P)a[E+1]=" ",E++;continue}if(Z===_){_=null;continue}a[E]=" ";continue}if(Z==="/"&&a[E+1]==="/"){for(let z=E;z<P;z++)a[z]=" ";break}if(Z==="/"&&a[E+1]==="*"){let z=w.indexOf("*/",E+2);if(z<0){for(let Y=E;Y<P;Y++)a[Y]=" ";n=!0;break}for(let Y=E;Y<=z+1;Y++)a[Y]=" ";E=z+1;continue}if(Z==='"'||Z==="'"||Z==="`")_=Z}let D=a.join(""),j=/\|\|/g,B;while((B=j.exec(D))!==null){let Z=B.index,z=Z-1,Y=0,X=0,J=0;while(z>=0){let te=D[z];if(te===")")Y++;else if(te==="("){if(Y===0){z++;break}Y--}else if(te==="}")X++;else if(te==="{"){if(X===0){z++;break}X--}else if(te==="]")J++;else if(te==="["){if(J===0){z++;break}J--}else if(Y===0&&X===0&&J===0){if(new RegExp("[;,=:?]").test(te)){z++;break}if(te==="&"||te==="|"){z++;break}}z--}if(z<0)z=0;let ie=D.slice(z,Z).trim();if(/[<>!=]/.test(ie))continue;if(/\b(?:true|false)\b/.test(ie))continue;let Q=Z+2,ee=Q;Y=0,X=0,J=0;while(ee<D.length){let te=D[ee];if(te==="(")Y++;else if(te===")"){if(Y===0)break;Y--}else if(te==="{")X++;else if(te==="}"){if(X===0)break;X--}else if(te==="[")J++;else if(te==="]"){if(J===0)break;J--}else if(Y===0&&X===0&&J===0){if(new RegExp("[;,?:]").test(te))break;if(te==="&"||te==="|"&&D[ee+1]==="|")break}ee++}let le=D.slice(Q,ee).trim(),ge=/^["'`\d]/.test(le)||/^\{/.test(le)||/^[\w$]+\(/.test(le)||/^[\w$.[\]]+$/.test(le),be=/^[\w$]+$/.test(ie)||/^[\w$.?[\]()]+$/.test(ie);if(ge&&be)s.push({filePath:b.filePath,line:i+1,column:Z+1,ruleId:"ts/prefer-nullish-coalescing",message:"Prefer nullish coalescing operator (??) over logical OR (||)",severity:"error",help:'Use `??` instead of `||` to only handle null/undefined, not falsy values like 0, "", or false'})}}return s},fix:(y)=>{let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l,i=new RegExp("(\\b[\\w$.]+)\\s*\\|\\|\\s*([^|&]+?)(?=\\s*[;,)\\]}]|$)","g");n=n.replace(i,(w,a,P)=>{if(/\b(?:true|false)\b/.test(P.trim()))return w;return`${a} ?? ${P}`}),s.push(n)}return s.join(`
|
|
96
|
-
`)}};var Hr={meta:{docs:"Prefer optional chaining (?.) over chained logical AND (&&) for property access"},check:(y,b)=>{let s=[];if(!/\.tsx?$/.test(b.filePath))return s;let l=y.split(/\r?\n/),n=!1;for(let i=0;i<l.length;i++){let w=l[i],a=w;if(n){let z=w.indexOf("*/");if(z>=0)w=w.slice(z+2),n=!1;else continue}let P=w.indexOf("/*"),E=w.indexOf("//");if(P>=0&&(E===-1||P<E)){let z=w.indexOf("*/",P+2);if(z>=0)w=w.slice(0,P)+w.slice(z+2);else n=!0,w=w.slice(0,P)}if(E>=0)w=w.slice(0,E);let _=w.replace(/(['"`])(?:(?!\1)[^\\]|\\.)*?\1/g,'""'),D=/(\b[\w$]+)\s*&&\s*\1\.([\w$]+)/g,j;while((j=D.exec(_))!==null){let z=j[1],Y=j[2],X=j.index,J=a.indexOf(j[0],Math.max(0,X-5));s.push({filePath:b.filePath,line:i+1,column:J>=0?J+1:X+1,ruleId:"ts/prefer-optional-chain",message:`Prefer optional chaining over && for property access: ${z}?.${Y}`,severity:"error",help:`Use \`${z}?.${Y}\` instead of \`${z} && ${z}.${Y}\``})}let B=/([\w$]+\.[\w$.]+)\s*&&\s*\1\.([\w$]+)/g;B.lastIndex=0;while((j=B.exec(_))!==null){let z=j[1],Y=j[2],X=j.index,J=a.indexOf(j[0],Math.max(0,X-5));s.push({filePath:b.filePath,line:i+1,column:J>=0?J+1:X+1,ruleId:"ts/prefer-optional-chain",message:`Prefer optional chaining over && for nested property access: ${z}?.${Y}`,severity:"error",help:`Use \`${z}?.${Y}\` instead of \`${z} && ${z}.${Y}\``})}let Z=_.split(/\s*&&\s*/);if(Z.length>=3)for(let z=0;z<Z.length-2;z++){let Y=Z[z].trim(),X=Z[z+1].trim(),J=Z[z+2].trim();if(X.startsWith(`${Y}.`)&&J.startsWith(`${X}.`)){let ie=a.indexOf(Y);s.push({filePath:b.filePath,line:i+1,column:ie>=0?ie+1:1,ruleId:"ts/prefer-optional-chain",message:"Prefer optional chaining over multiple && checks for nested properties",severity:"error",help:`Use optional chaining like \`${Y}?.${X.slice(Y.length+1)}?.${J.slice(X.length+1)}\``});break}}}return s},fix:(y)=>{let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l;n=n.replace(/(\b[\w$]+)\s*&&\s*\1\.([\w$]+)/g,"$1?.$2"),n=n.replace(/([\w$]+\.[\w$.]+)\s*&&\s*\1\.([\w$]+)/g,"$1?.$2"),s.push(n)}return s.join(`
|
|
97
|
-
`)}};function ic(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var Yr=/([a-zA-Z_$][a-zA-Z0-9_$]*\??)\s*:\s*([A-Z][a-zA-Z0-9_$<>[\]|&]*|string|number|boolean|null|undefined|void|never|any|unknown|object|symbol|bigint)/g,Xr={meta:{docs:"Require consistent spacing around type annotation colons",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a;Yr.lastIndex=0;while((a=Yr.exec(i))!==null){if(ic(i,a.index))continue;let P=a[0],E=P.indexOf(":"),_=a.index+E;if(E>0&&P[E-1]===" "&&!P.startsWith("?")){if(!a[1].endsWith("?")||P[E-1]===" "){if(i[_-1]===" "&&!/\?\s*$/.test(a[1]))s.push({filePath:b.filePath,line:n+1,column:_+1,ruleId:"ts/type-annotation-spacing",message:"Unexpected space before colon in type annotation",severity:"warning"})}}if(_+1<i.length&&i[_+1]!==" "&&i[_+1]!=="\t")s.push({filePath:b.filePath,line:n+1,column:_+2,ruleId:"ts/type-annotation-spacing",message:"Missing space after colon in type annotation",severity:"warning"})}}return s},fix(y){let b=y.split(/\r?\n/),s=[];for(let l of b){let n=l;n=n.replace(/([a-zA-Z_$][a-zA-Z0-9_$]*\??)\s*:\s*([A-Z][a-zA-Z0-9_$<>[\]|&]*|string|number|boolean|null|undefined|void|never|any|unknown|object|symbol|bigint)/g,"$1: $2"),s.push(n)}return s.join(`
|
|
98
|
-
`)}};function Jr(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var Qr=/([A-Za-z_$][A-Za-z0-9_$]*)\s*<(\s+)/g,eo=/(\s+)>(?!=)/g,rc=/([A-Za-z_$][A-Za-z0-9_$]*)\s*<\s+/g,oc=/\s+>(?!=)/g,to={meta:{docs:"Disallow spaces inside TypeScript generic angle brackets",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;Qr.lastIndex=0;let a;while((a=Qr.exec(i))!==null){let P=a.index+a[1].length,E=i.indexOf("<",P);if(E===-1)continue;if(Jr(i,E))continue;s.push({filePath:b.filePath,line:n+1,column:E+2,ruleId:"ts/type-generic-spacing",message:"Unexpected space after '<' in generic type",severity:"warning"})}eo.lastIndex=0;while((a=eo.exec(i))!==null){let P=a.index+a[1].length;if(Jr(i,P))continue;let E=i.slice(0,P);if(!/[A-Za-z_$][A-Za-z0-9_$]*\s*</.test(E))continue;s.push({filePath:b.filePath,line:n+1,column:P+1,ruleId:"ts/type-generic-spacing",message:"Unexpected space before '>' in generic type",severity:"warning"})}}return s},fix(y,b){let s=y.split(/\r?\n/),l=[];for(let n of s){let i=n.trim();if(!i||i.startsWith("//")||i.startsWith("*")||i.startsWith("/*")){l.push(n);continue}let w=n;if(w=w.replace(rc,(a,P)=>`${P}<`),/[A-Za-z_$][A-Za-z0-9_$]*\s*</.test(w))w=w.replace(oc,">");l.push(w)}return l.join(`
|
|
99
|
-
`)}};function lc(y,b){let s=y.slice(0,b);if(s.includes("//"))return!0;let l=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return l%2===1||n%2===1||i%2===1}var no=/([a-zA-Z_$][a-zA-Z0-9_$?]*):(\S)/g,ro={meta:{docs:"Require space after colon in named tuple members",recommended:!0},check(y,b){let s=[],l=y.split(/\r?\n/);for(let n=0;n<l.length;n++){let i=l[n],w=i.trim();if(!w||w.startsWith("//")||w.startsWith("*")||w.startsWith("/*"))continue;let a=so(i);for(let P of a){no.lastIndex=0;let E;while((E=no.exec(P.text))!==null){let D=P.start+E.index+E[1].length;if(lc(i,D))continue;if(!io(i))continue;s.push({filePath:b.filePath,line:n+1,column:D+2,ruleId:"ts/type-named-tuple-spacing",message:"Missing space after colon in named tuple member",severity:"warning"})}}}return s},fix(y,b){let s=y.split(/\r?\n/),l=[];for(let n of s){let i=n.trim();if(!i||i.startsWith("//")||i.startsWith("*")||i.startsWith("/*")){l.push(n);continue}if(!io(n)){l.push(n);continue}let w=n,a=so(n);for(let P=a.length-1;P>=0;P--){let E=a[P],_=E.text.replace(/([a-zA-Z_$][a-zA-Z0-9_$?]*):(\S)/g,"$1: $2");if(_!==E.text)w=w.slice(0,E.start)+_+w.slice(E.start+E.text.length)}l.push(w)}return l.join(`
|
|
100
|
-
`)}};function so(y){let b=[],s=0,l=-1;for(let n=0;n<y.length;n++)if(y[n]==="["){if(s===0)l=n;s++}else if(y[n]==="]"){if(s--,s===0&&l>=0)b.push({start:l,text:y.slice(l,n+1)}),l=-1}return b}function io(y){let b=y.trim();return/\btype\s/.test(b)||/:\s*\[/.test(b)||/=\s*\[/.test(b)||/\bas\s/.test(b)||/<[^>]*\[/.test(b)||/\bextends\s/.test(b)||/\bimplements\s/.test(b)}var oo={name:"ts",rules:{"no-require-imports":e(zr),"no-top-level-await":e(Zr),"no-ts-export-equal":e(Gr),"no-explicit-any":e(Fr),"prefer-nullish-coalescing":e(Kr),"prefer-optional-chain":e(Hr),"no-floating-promises":e(Br),"no-misused-promises":e(qr),"no-unsafe-assignment":e(Vr),"member-delimiter-style":e(Ur),"type-annotation-spacing":e(Xr),"type-generic-spacing":e(to),"type-named-tuple-spacing":e(ro)}};var lo={name:"unused-imports",rules:{"no-unused-vars":e(Fe),"no-unused-imports":e(Fe)}};var cc={markdown:()=>import.meta.require("./chunk-t4eg5fx5.js").markdownPlugin,shell:()=>import.meta.require("./chunk-513cs23x.js").shellPlugin,spell:()=>import.meta.require("./chunk-wz6hqyhd.js").spellPlugin,lockfile:()=>import.meta.require("./chunk-he3fbz3w.js").lockfilePlugin,publint:()=>import.meta.require("./chunk-kn5s3eh8.js").publintPlugin},co=new Map;function ac(y){let b=co.get(y);if(!b)b=cc[y](),co.set(y,b);return b}function uc(y,b,s){let l=()=>ac(y).rules[b],n={get meta(){return l().meta},check:(i,w)=>l().check(i,w)};if(s)n.fix=(i,w)=>l().fix(i,w);return n}function nt(y){let b={};for(let[s,l]of Object.entries(us[y]))b[s]=uc(y,s,l);return{name:y,rules:b}}var ao=null;function Un(){return ao??=[es,as,zs,qs,jr,Ks,oo,nt("markdown"),nt("shell"),nt("spell"),ps,nt("lockfile"),nt("publint"),lo,ds],[...ao]}var dc=lt("pickier");function po(){return dc}function He(...y){if(r.TRACE)po().debug("[pickier:trace]",y)}async function fo(y,b,s){let l,n=new Promise((i,w)=>{l=setTimeout(()=>w(Error(`Timeout after ${b}ms at ${s}`)),b)});try{let i=await Promise.race([y,n]);return clearTimeout(l),i}catch(i){throw po().error(`[pickier:error] ${s} failed:`,i?.message||i),He("withTimeout error:",s,i),i}}function ho(y){if(y.length===0)return"";let b=new Map;for(let l of y){let n=b.get(l.filePath)||[];n.push(l),b.set(l.filePath,n)}let s="";for(let[l,n]of b){s+=`
|
|
101
|
-
${t.bold(`\x1B[4m${l}\x1B[24m`)}
|
|
102
|
-
`;let i;try{i=mo(l,"utf8")}catch{for(let a of n){let P=a.severity==="error"?t.red("error"):t.yellow("warn ");s+=` ${a.line}:${a.column} ${P} ${a.message} ${t.blue(a.ruleId)}
|
|
103
|
-
`}continue}let w=i.split(/\r?\n/);for(let a of n){let P=a.severity==="error"?t.red("!"):t.yellow("!"),E=t.blue(a.ruleId);s+=`
|
|
104
|
-
${P} ${E}: ${a.message}
|
|
105
|
-
`;let _=2,D=2,j=Math.max(1,a.line-_),B=Math.min(w.length,a.line+D),z=String(B).length;s+=` ${t.gray(" ,-")}${t.gray(`[:${a.line}:${a.column}]`)}
|
|
106
|
-
`;for(let Y=j;Y<=B;Y++){let X=String(Y).padStart(z),J=w[Y-1]||"";if(Y===a.line)s+=` ${t.gray(X)} ${t.gray("|")} ${t.red(",-> ")}${J}
|
|
107
|
-
`;else if(Y===a.line+1&&D>0)s+=` ${t.gray(X)} ${t.gray("|")} ${t.red("| ")}${J}
|
|
108
|
-
`;else if(Y===a.line+D&&D>1)s+=` ${t.gray(X)} ${t.gray("|")} ${t.red("`-> ")}${J}
|
|
109
|
-
`;else s+=` ${t.gray(X)} ${t.gray("| ")}${J}
|
|
110
|
-
`}if(s+=` ${t.gray(" `----")}
|
|
111
|
-
`,a.help)s+=` ${t.blue("help")}: ${a.help}
|
|
112
|
-
`}}return s}function go(y){if(y.length===0)return"";let b=new Map;for(let w of y){let a=b.get(w.filePath)||[];a.push(w),b.set(w.filePath,a)}let s=t.red("error"),l=t.yellow("warn "),n=new Map,i="";for(let[w,a]of b){i+=`
|
|
113
|
-
${t.bold(`\x1B[4m${w}\x1B[24m`)}
|
|
114
|
-
`;for(let P of a){let E=P.severity==="error"?s:l,_=n.get(P.ruleId);if(_===void 0)_=t.blue(P.ruleId),n.set(P.ruleId,_);let j=`${P.line}:${P.column}`.padStart(6),B=60,Z=P.message.padEnd(B);i+=`${j} ${E} ${Z} ${_}
|
|
115
|
-
`}}return i}async function H(y,b){He("runFormat:start",{globs:y,options:b});let s=await u(b.config),l=y.length?y:["."],n=x(l);He("patterns",n);let i=new Set((b.ext||s.format.extensions.join(",")).split(",").map((Y)=>{let X=Y.trim();return X.startsWith(".")?X:`.${X}`})),w=r.TIMEOUT_MS,P=n.some((Y)=>{let X=Y.replace(/\/?\*\*(?:\/\*+)?$/,"");return!(mc(X)?X:pc(process.cwd(),X)).startsWith(process.cwd())})?h(m):h(s.ignores),E=d(P),_=[];if(n.length===1&&/\*\*\/\*$/.test(n[0])){let Y=n[0].replace(/\/?\*\*\/\*$/,"");try{let{readdirSync:X,statSync:J}=await import("fs"),{join:ie}=await import("path"),Q=[Y];while(Q.length){let ee=Q.pop(),le=X(ee);for(let ge of le){let be=ie(ee,ge),te=J(be);if(E(be))continue;if(te.isDirectory())Q.push(be);else _.push(be)}}}catch{_=await fo(f(n,{dot:!1,ignore:P,onlyFiles:!0,absolute:!0}),w,"glob")}}else _=await fo(f(n,{dot:!1,ignore:P,onlyFiles:!0,absolute:!0}),w,"glob");He("globbed entries",_.length);let j=_.filter((Y)=>{if(E(Y))return!1;let X=Y.lastIndexOf(".");if(X<0)return!0;let J=Y.slice(X);return i.has(J)});He("filtered files",j.length);let B=0,Z=[];for(let Y of j){He("format start",uo(process.cwd(),Y));let X=mo(Y,"utf8"),J=p(X,s,Y),ie=J!==X;if(b.write){if(ie)fc(Y,J,"utf8")}if(ie)Z.push(uo(process.cwd(),Y));B++}let z=Z.length;if(z>0){for(let Y of Z)console.log(t.gray(` ${Y}`));console.log(b.write?t.gray(`Formatted ${z} of ${B} file(s).`):t.yellow(`${z} of ${B} file(s) need formatting. Run with --write to fix.`))}else if(b.verbose!==void 0?b.verbose:s.verbose)console.log(t.gray(`Checked ${B} files, all formatted.`));return b.check&&z>0?1:0}import{mkdirSync as hc,readFileSync as gc,writeFileSync as yc}from"fs";import{dirname as bc,relative as xc,resolve as xo}from"path";var Rc=".pickiercache";function yo(y){return xc(process.cwd(),xo(process.cwd(),y))}var bo="";function Fn(y){return Bun.hash(y).toString(36)}function wc(y,b){let s=JSON.stringify({cfg:y,options:{formatOnly:!!b._formatOnly,fix:!!b.fix,dryRun:!!b.dryRun,ext:b.ext}},(l,n)=>typeof n==="function"?`fn:${n.toString()}`:n instanceof RegExp?`re:${n}`:n);return`${F}:${Fn(s)}`}function Ro(y,b){let s=b.cache??y.lint?.cache??!1,l=(b.fix||b._formatOnly)&&!b.dryRun;return!!s&&!l}function wo(y,b,s=b.cacheLocation??y.lint?.cacheLocation??Rc){let l=xo(process.cwd(),s),n=wc(y,b),i={};try{let a=JSON.parse(gc(l,"utf8"));if(a.key===n&&a.files&&typeof a.files==="object")i=a.files}catch{}let w={};return{get(a,P){let E=yo(a),_=i[E];if(_&&_.hash===Fn(P))return w[E]=_,_.issues.map((D)=>D.filePath===bo?{...D,filePath:a}:D);return},set(a,P,E){w[yo(a)]={hash:Fn(P),issues:E.map((_)=>_.filePath===a?{..._,filePath:bo}:_)}},save(){try{hc(bc(l),{recursive:!0}),yc(l,JSON.stringify({key:n,files:w}))}catch{}}}}import{chmodSync as kc,existsSync as ko}from"fs";import{resolve as Bn}from"path";var __dirname="/home/runner/work/pickier/pickier/packages/pickier/src",Ic=new Set(["quotes","indent","no-debugger","no-console","no-template-curly-in-string","no-cond-assign","pickier/import-dedupe","pickier/no-import-dist","pickier/no-import-node-modules-by-path","pickier/sort-tailwind-classes","style/brace-style","style/max-statements-per-line","regexp/no-super-linear-backtracking","regexp/no-unused-capturing-group","regexp/no-useless-lazy","general/prefer-const","general/prefer-template","general/no-unused-vars","pickier/no-unused-imports","ts/no-top-level-await","style/no-multi-spaces","style/no-multiple-empty-lines","style/no-trailing-spaces","eslint/no-new","quality/no-new","general/no-new","general/no-regex-spaces","node/prefer-global/buffer","node/prefer-global/process","pickier/sort-exports"]),Io=new Set(["eslint","general","quality","pickier","style","regexp","ts","node","unused-imports","perfectionist"]),Po=new Set(["markdown","publint","lockfile","shell"]),Mo={"pickier/sort-exports":(y)=>y.pluginRules?.["pickier/sort-exports"]?.[1]||{}};function Pc(y,b){let s=Mo[b.id]?Mo[b.id](y):b.options;return{id:b.id,severity:b.severity??null,options:s??null}}function Mc(y){return{quotes:o(y,"quotes",["style/quotes"],"warn")??null,indent:o(y,"indent",["style/indent"],"warn")??null,"no-debugger":o(y,"no-debugger",["noDebugger"])??null,"no-console":o(y,"no-console",["noConsole"])??null,"no-template-curly-in-string":o(y,"no-template-curly-in-string",["noTemplateCurlyInString"])??null,"no-cond-assign":o(y,"no-cond-assign",["noCondAssign"])??null}}function vc(y){return{quotes:y.format.quotes,indent:y.format.indent,indentStyle:y.format.indentStyle??"spaces"}}function vo(y){return/\.(?:ts|js|tsx|jsx|mts|mjs|cts|cjs)$/.test(y)}function $o(y,b){if(process.env.PICKIER_NATIVE==="0"||b.fix||b._formatOnly)return null;if((y.plugins??[]).some((a)=>typeof a==="string"||Io.has(a.name)||Po.has(a.name)))return null;let s=$c();if(!s)return null;let l=Mc(y),n=[],i=[],w=!1;if(V(y).forEach((a,P)=>{if(Io.has(a.plugin)&&Ic.has(a.id))n.push(Pc(y,a)),i.push(P);else if(!Po.has(a.plugin))w=!0}),n.length===0&&Object.values(l).every((a)=>a===null))return null;return{request:{format:vc(y),builtins:l,rules:n},binary:s,positions:i,nativeRules:n.map((a)=>a.id),hybrid:w}}function $c(){if(process.env.PICKIER_NATIVE_BINARY)return ko(process.env.PICKIER_NATIVE_BINARY)?process.env.PICKIER_NATIVE_BINARY:null;let y=`${process.platform}-${process.arch}`,b=process.platform==="win32"?"pickier-native.exe":"pickier-native";return[Bn(__dirname,"native",y,b),Bn(__dirname,"../dist/native",y,b),Bn(__dirname,"../../zig/zig-out/bin/pickier-zig")].find((l)=>ko(l))??null}function Co(y,b,s,l,n){let i=Buffer.from(Eo(y,b,l)),w=So(s,()=>Bun.spawnSync([s,"lint-batch"],{stdin:i,stdout:"pipe",stderr:"pipe"}));if(!w||w.exitCode!==0)return null;return Ao(w.stdout.toString(),y,n)}async function Lo(y,b,s,l){let n=Buffer.from(Eo(y,b)),i=So(s,()=>Bun.spawn([s,"lint-batch"],{stdin:n,stdout:"pipe",stderr:"ignore"}));if(!i)return null;let[w,a]=await Promise.all([new Response(i.stdout).text(),i.exited]);if(a!==0)return null;return Ao(w,y,l)}function So(y,b){try{return b()}catch(s){if(s?.code!=="EACCES")return null;try{return kc(y,493),b()}catch{return null}}}function Eo(y,b,s){return JSON.stringify({...b,...s&&{threads:s},files:y})}var Cc=2;function Ao(y,b,s){let l;try{let n=JSON.parse(y);if(n?.v!==Cc)return null;l=n.f}catch{return null}if(!Array.isArray(l)||l.length!==b.length)return null;return l.map((n,i)=>{if(n===null)return null;let{s:w,i:a}=n,P=b[i],E=[];for(let _=0;_<a.length;_+=7){let D={filePath:P,line:a[_],column:a[_+1],ruleId:w[a[_+2]],message:w[a[_+3]],severity:a[_+4]===0?"error":"warning"};if(a[_+5]>=0)D.help=w[a[_+5]];if(s)D.pos=a[_+6]<0?-1:s[a[_+6]];E.push(D)}return E})}function Oo(y,b){let s=y,l=b,n=[],i=new Set,w=(E)=>{let _=`${E.line}:${E.column}:${E.ruleId}`;if(i.has(_))return;i.add(_);let D={filePath:E.filePath,line:E.line,column:E.column,ruleId:E.ruleId,message:E.message,severity:E.severity};if(E.help!==void 0)D.help=E.help;n.push(D)},a=0,P=0;while(a<s.length||P<l.length)if(P>=l.length||a<s.length&&s[a].pos<=l[P].pos)w(s[a++]);else w(l[P++]);return n}import{existsSync as Lc}from"fs";import{availableParallelism as _o}from"os";var Sc=32,Ec=8,Ac=4;function To(y){let b=r.WORKERS;if(b!==null)return Math.min(b,y);if(y<Sc)return 0;return Math.min(Math.max(1,_o()-1),Math.ceil(y/Ec))}var vn=new Map,Oc=Math.max(1,_o()-1);function _c(y){let s=vn.get(y)?.pop();if(s)return s.ref(),s;let l=new Worker(y);return l.addEventListener("close",()=>{let n=vn.get(y),i=n?.indexOf(l)??-1;if(i>=0)n.splice(i,1)}),l}function Tc(y,b){b.unref();let s=vn.get(y);if(!s)vn.set(y,[b]);else if(s.length<Oc)s.push(b)}function Wc(){for(let y of["./lint-worker.ts","./lint-worker.js","./src/lint-worker.js"]){let b=new URL(y,import.meta.url);try{if(b.protocol==="file:"&&Lc(Bun.fileURLToPath(b)))return b.href}catch{}}return null}async function Wo(y,b,s,l,n=Wc()){let i=Array(y.length);if(n!==null){let w=0,a=()=>{let E=[];while(E.length<Ac&&w<y.length)E.push([w,y[w]]),w++;return E},P=[];try{await new Promise((E,_)=>{let D=0,j=null,B=()=>{if(j)_(j);else E()},Z=()=>{let z;try{z=_c(n)}catch{return}P.push(z),D++;let Y=[],X=!1,J=(ee)=>{if(X)return;if(X=!0,z.onmessage=null,z.onerror=null,z.removeEventListener("close",Q),ee)Tc(n,z);if(D--,D===0)B()},ie=()=>{if(Y=a(),Y.length===0)J(!0);else z.postMessage({type:"lint",batch:Y})};z.onmessage=(ee)=>{let le=ee.data;if(le.type==="done"){for(let[ge,be]of le.results)i[ge]=be;ie()}else if(le.type==="error")j??=Error(le.message),w=y.length,Y=[],J(!1)};let Q=()=>{Y=[],J(!1)};z.onerror=Q,z.addEventListener("close",Q);try{z.postMessage({type:"init",options:b})}catch{J(!1);return}ie()};for(let z=0;z<s;z++)Z();if(D===0)B()})}finally{for(let E of P)E.unref()}}for(let w=0;w<y.length;w++)if(i[w]===void 0)i[w]=await l(y[w]);return i}var Nc=lt("pickier:lint");function Le(){return Nc}function Te(...y){if(r.TRACE)Le().error("[pickier:trace]",y)}async function W(y,b,s="untitled",l){if(l?.aborted)throw Error("AbortError");An();let n=qe(y),i=ze(y),w=ot(s,y,b,n,i);if(l?.aborted)throw Error("AbortError");try{let a=await En(s,y,b);for(let P of a){if(l?.aborted)throw Error("AbortError");if(De(P.ruleId,P.line,n))continue;if(i.has(P.line)&&Ln(P.ruleId))continue;w.push({filePath:P.filePath,line:P.line,column:P.column,ruleId:P.ruleId,message:P.message,severity:P.severity,...P.help&&{help:P.help}})}}catch{}return w}function A(y,b,s="untitled"){An();let l=Jo(s,y,b,qe(y),ze(y));if(l=Xo(s,l,b),Qo(s,l,b))l=Kc(l,b,qe(l),ze(l));return l}async function U(y,b,s){Te("runLintProgrammatic:start",{globs:y,options:b});let l=await u(b.config);if(s?.aborted)throw Error("AbortError");let n=y.length?y:["."],i=x(n),w=b.ext||l.lint.extensions.join(","),a=new Set(w.split(",").map((ce)=>{let ae=ce.trim();return ae.startsWith(".")?ae:`.${ae}`})),P=r.TIMEOUT_MS,_=i.some((ce)=>{let ae=ce.replace(/\/?\*\*\/*\*\*$/,""),de=Ye(ae)?ae:Xe(process.cwd(),ae),oe=process.cwd();return de!==oe&&!de.startsWith(oe+Ko)})?h(m):h(l.ignores),D=d(_),j=[];if(i.length===1&&!/[*?[\]{}()!]/.test(i[0]))try{if($n(i[0]).isFile())j=[Ye(i[0])?i[0]:Xe(process.cwd(),i[0])]}catch{}let Z=i.length===1&&/\*\*\/*\*$/.test(i[0]);if(!j.length&&Z){let ce=i[0].replace(/\/?\*\*\/*\*\*$/,""),ae=Ye(ce)?ce:Xe(process.cwd(),ce);try{let de=[ae];while(de.length){if(s?.aborted)throw Error("AbortError");let oe=de.pop(),xe=Go(oe);for(let he of xe){let fe=Vo(oe,he),ke=$n(fe);if(D(fe))continue;if(ke.isDirectory())de.push(fe);else j.push(fe)}}}catch{j=await rt(f(i,{dot:!1,ignore:_,onlyFiles:!0,absolute:!0}),P,"glob")}}else if(!j.length)j=await rt(f(i,{dot:!1,ignore:_,onlyFiles:!0,absolute:!0}),P,"glob");if(s?.aborted)throw Error("AbortError");let z=0,Y=0,X=0,J=0,ie=0,Q=[];for(let ce of j){if(z++,ce.replace(/\\/g,"/").includes("/node_modules/")){X++;continue}if(D(ce)){J++;continue}if(!T(ce,a)){ie++;continue}Q.push(ce),Y++}Te("filter:programmatic",{total:z,included:Y,node_modules:X,ignored:J,wrongExt:ie});let ee=r.CONCURRENCY,be=(await Ho(Q,ee,async(ce)=>{if(s?.aborted)throw Error("AbortError");An();let ae=Hn(ce,"utf8"),de=qe(ae),oe=ze(ae),xe=ot(ce,ae,l,de,oe);try{let he=await En(ce,ae,l);for(let fe of he){if(s?.aborted)throw Error("AbortError");if(De(fe.ruleId,fe.line,de))continue;if(oe.has(fe.line)&&Ln(fe.ruleId))continue;xe.push({filePath:fe.filePath,line:fe.line,column:fe.column,ruleId:fe.ruleId,message:fe.message,severity:fe.severity,...fe.help&&{help:fe.help}})}}catch{}{let he=new Set;xe=xe.filter((fe)=>{let ke=`${fe.line}:${fe.column}:${fe.ruleId}`;if(he.has(ke))return!1;return he.add(ke),!0})}if(b.fix){let he=Jo(ce,ae,l,de,oe);if(he=Xo(ce,he,l),he!==ae){let fe=qe(he),ke=ze(he);if(xe=ot(ce,he,l,fe,ke),!b.dryRun)Kn(ce,he,"utf8")}}return xe})).flat(),te=be.filter((ce)=>ce.severity==="error").length,ue=be.filter((ce)=>ce.severity==="warning").length;return{errors:te,warnings:ue,issues:be}}function Dc(y){return y.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function jc(y){return y.replace(/-([a-z])/g,(b,s)=>s.toUpperCase())}function qe(y){let b=new Map,s=new Set,l=new Map,n=new Map,i=y.split(/\r?\n/),w=new Set;for(let E=0;E<i.length;E++){let _=i[E].trim(),D=E+1,j=_.match(/^\/\/\s*(?:eslint|pickier)-disable-next-line(?:\s+(\S.*))?$/);if(j){let X=j[1]?.replace(/\s+--\s.*$/,""),J=X?X.split(",").map((ie)=>ie.trim()).filter(Boolean):["*"];if(J.length>0){let ie=D+1,Q=b.get(ie)||new Set;for(let ee of J)Q.add(ee);b.set(ie,Q)}continue}let B=_.match(/^\/\*\s*(?:eslint|pickier)-disable(?:\s+([^*]+))?\s*\*\//);if(B){let X=B[1]?.trim().replace(/\s+--\s.*$/,"");if(!X||X==="")l.set(D,new Set(["*"])),w.add("*");else{let J=X.split(",").map((Q)=>Q.trim()).filter(Boolean),ie=l.get(D)||new Set;for(let Q of J)ie.add(Q),w.add(Q);l.set(D,ie)}if(E===0)if(!X||X==="")s.add("*");else{let J=X.split(",").map((ie)=>ie.trim()).filter(Boolean);for(let ie of J)s.add(ie)}continue}let Z=_.match(/^\/\*\s*(?:eslint|pickier)-enable(?:\s+([^*]+))?\s*\*\//);if(Z){let X=Z[1]?.trim();if(!X||X==="")n.set(D,new Set(["*"])),w.clear();else{let J=X.split(",").map((Q)=>Q.trim()).filter(Boolean),ie=n.get(D)||new Set;for(let Q of J)ie.add(Q),w.delete(Q);n.set(D,ie)}continue}let z=_.match(/^\/\/\s*(?:eslint|pickier)-disable(?:\s+(\S.*))?$/);if(z){let X=z[1]?.trim().replace(/\s+--\s.*$/,"");if(!X||X==="")l.set(D,new Set(["*"])),w.add("*");else{let J=X.split(",").map((Q)=>Q.trim()).filter(Boolean),ie=l.get(D)||new Set;for(let Q of J)ie.add(Q),w.add(Q);l.set(D,ie)}continue}let Y=_.match(/^\/\/\s*(?:eslint|pickier)-enable(?:\s+(\S.*))?$/);if(Y){let X=Y[1]?.trim();if(!X||X==="")n.set(D,new Set(["*"])),w.clear();else{let J=X.split(",").map((Q)=>Q.trim()).filter(Boolean),ie=n.get(D)||new Set;for(let Q of J)ie.add(Q),w.delete(Q);n.set(D,ie)}}}let a=Array.from(l.keys()).sort((E,_)=>E-_),P=Array.from(n.keys()).sort((E,_)=>E-_);return{nextLine:b,fileLevel:s,rangeDisable:l,rangeEnable:n,sortedDisableLines:a,sortedEnableLines:P}}function De(y,b,s){if(s instanceof Map){let a=s.get(b);if(!a||a.size===0)return!1;return st(y,a)}if(s.fileLevel.size>0){if(st(y,s.fileLevel))return!0}let l=s.nextLine.get(b);if(l&&st(y,l))return!0;let n=!1,i=0,w=0;while(!0){let a=i<s.sortedDisableLines.length?s.sortedDisableLines[i]:Number.POSITIVE_INFINITY,P=w<s.sortedEnableLines.length?s.sortedEnableLines[w]:Number.POSITIVE_INFINITY,E=Math.min(a,P);if(E>=b)break;if(a===E){let D=s.rangeDisable.get(a);if(st(y,D))n=!0;i++;continue}let _=s.rangeEnable.get(P);if(_.has("*")||st(y,_))n=!1;w++}return n}function st(y,b){if(b.size===0)return!1;if(b.has("*"))return!0;if(b.has(y))return!0;let s=Dc(y);if(b.has(s)||b.has(jc(y)))return!0;for(let l of b)if(!l.includes("/")){if(y.endsWith(`/${l}`))return!0}if(!y.includes("/")){for(let l of b)if(l.endsWith(`/${y}`))return!0}return!1}function Ln(y){return y!=="spaced-comment"&&!y.endsWith("/spaced-comment")}function Uc(y,b){if(y.help)return y;let s=b.includes("/")?b.split("/")[1]:b,l;if(s.startsWith("no-"))l=`Remove or refactor this ${s.replace("no-","").replace(/-/g," ")}. Check the rule documentation for more details or disable with: // eslint-disable-next-line ${b}`;else if(s.startsWith("prefer-"))l=`Consider using ${s.replace("prefer-","").replace(/-/g," ")} instead. This is a best practice recommendation. Disable with: // eslint-disable-next-line ${b} if needed`;else if(s.includes("sort")||s.includes("order"))l=`Reorder these items according to the rule requirements, or use --fix to auto-sort. Disable with: // eslint-disable-next-line ${b}`;else if(s.includes("indent")||s.includes("spacing")||s.includes("newline"))l=`Fix the formatting issue. Run with --fix to automatically format. Disable with: // eslint-disable-next-line ${b}`;else l=`Fix this issue or disable the rule with: // eslint-disable-next-line ${b}. Check the rule documentation for more details`;return{...y,help:l}}async function rt(y,b,s){let l,n=new Promise((i,w)=>{l=setTimeout(()=>w(Error(`Timeout after ${b}ms at ${s}`)),b)});try{let i=await Promise.race([y,n]);return clearTimeout(l),i}catch(i){throw Le().error(`[pickier:error] ${s} failed:`,i?.message||i),Te("withTimeout error:",s,i),i}}async function Ho(y,b,s){let l=Array(y.length);if(y.length===0)return l;let n=0,i=Math.max(1,Math.min(Math.max(1,b),y.length));async function w(){while(n<y.length){let a=n++;l[a]=await s(y[a],a)}}return await Promise.all(Array.from({length:i},w)),l}var No=new WeakMap;function Fc(y){let b=Un();if(y.plugins&&y.plugins.length>0){let s=new Set(["pickier","style","regexp","ts"]),l=y.plugins.filter((i)=>typeof i!=="string");b=l.some((i)=>s.has(i.name))?b:[];for(let i of l)b.push(i)}return b}function Bc(y,b){let s={...y.pluginRules||{},...y.rules||{}};if(y.rules?.noUnusedCapturingGroup)s["regexp/no-unused-capturing-group"]=y.rules.noUnusedCapturingGroup;let l={"antfu/curly":"style/curly","antfu/if-newline":"style/if-newline","antfu/no-top-level-await":"ts/no-top-level-await"};for(let[n,i]of Object.entries(l))if(s[n])s[i]=s[n];for(let n of[y.pluginRules,y.rules])for(let i of Object.keys(n||{})){if(i.includes("/"))continue;for(let w of b)if(w.rules&&Object.prototype.hasOwnProperty.call(w.rules,i))s[`${w.name}/${i}`]=n[i]}return s}function Sn(y){let b=No.get(y);if(b)return b;let s=Fc(y),l=Bc(y,s),n=[],i=[],w=new Set(["no-debugger"]),a=new Set(["no-debugger"]),P=new Set;for(let _ of s)for(let D in _.rules){let j=`${_.name}/${D}`,B=N(l,j);if(!B.enabled)continue;if(P.has(D))continue;P.add(D);let Z=_.rules[D],z={pluginName:_.name,ruleName:D,fullRuleId:j,rule:Z,severity:B.severity,options:B.options};if(typeof Z?.check==="function")n.push(z);else if(B.severity==="error")n.push(z);if(typeof Z?.fix==="function")i.push(z),w.add(j),a.add(D)}let E={checkRules:n,fixRules:i,fixableRuleIds:w,fixableBareRuleNames:a};return No.set(y,E),E}function V(y){return Sn(y).checkRules.map((b)=>({id:b.fullRuleId,plugin:b.pluginName,severity:b.severity,options:b.options}))}function qc(y,b){return/\.(?:sh|bash|zsh|ksh|dash)$/.test(y)||/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/.test(b)}function zc(y){return/(?:^|[/\\])(?:bun\.lock|bun\.lockb|package-lock\.json|pnpm-lock\.yaml|yarn\.lock|npm-shrinkwrap\.json)$/.test(y)}function Yo(y,b,s){switch(y.pluginName){case"markdown":return b.endsWith(".md");case"shell":return qc(b,s);case"publint":return/(?:^|[/\\])package\.json$/.test(b);case"lockfile":return zc(b);case"node":case"ts":case"general":case"quality":case"eslint":case"regexp":case"unused-imports":case"perfectionist":return/\.(?:ts|js|tsx|jsx|mts|mjs|cts|cjs)$/.test(b);default:return!0}}async function En(y,b,s,l){let n=[],i=Sn(s),w={filePath:y,config:s};for(let a=0;a<i.checkRules.length;a++){let P=i.checkRules[a];if(l?.has(P.fullRuleId)||!Yo(P,y,b))continue;let E=n.length;if(await Zc(P,y,b,w,n),l)for(let _=E;_<n.length;_++)n[_].pos=a}return n}async function Zc(y,b,s,l,n){let{fullRuleId:i,rule:w,severity:a}=y;if(!w||typeof w.check!=="function"){if(a==="error")n.push({filePath:b,line:1,column:1,ruleId:`${i}-internal`,message:"Rule missing implementation (check function is undefined)",severity:"error"});return}try{Te("rule:start",i);let P=r.RULE_TIMEOUT_MS,E={...l,options:y.options},_=performance.now(),D=await rt(Promise.resolve().then(()=>w.check(s,E)),P,`rule:${i}`),j=performance.now()-_;if(j>P)n.push({filePath:b,line:1,column:1,ruleId:`${i}-internal`,message:`Rule exceeded timeout budget: ${Math.round(j)}ms > ${P}ms`,severity:"error"});Te("rule:end",i,Array.isArray(D)?D.length:0);for(let B of D){let Z=Uc(B,i);if(a)n.push({...Z,severity:a});else n.push(Z)}}catch(P){n.push({filePath:b,line:1,column:1,ruleId:`${i}-internal`,message:`Rule threw: ${P?.message||P}`,severity:"error"})}}var Gc=/\.(?:[cm]?[jt]sx?|vue|svelte|stx)$/i;function Vc(y,b,s){if(!Gc.test(s)||!y.includes("`"))return b;let l=y.split(/\r?\n/),n=b.split(/\r?\n/);if(l.length!==n.length)return b;let i=Be(y),w=0;for(let a=0;a<n.length;a++)if(i[a]&&n[a]!==l[a])n[a]=l[a],w++;return w>0?n.join(`
|
|
116
|
-
`):b}function Xo(y,b,s){let l=Sn(s),n={filePath:y,config:s},i=b,w=!0,a=0;while(w&&a++<L){w=!1;for(let P of l.fixRules){if(!Yo(P,y,i))continue;let E={...n,options:P.options},_=P.rule.fix(i,E),D=P.rule.meta?.editsStringContent?_:Vc(i,_,y);if(D!==i)i=D,w=!0}}return i}function Jo(y,b,s,l,n){if(!o(s,"no-debugger",["noDebugger"])||!b.includes("debugger"))return b;let w=y.split(".").pop()?.toLowerCase()??"",a=w==="sh"||w==="bash"||w==="zsh"||w==="ksh"||w==="dash"||/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/.test(b);if(w==="md"||w==="yaml"||w==="yml"||w==="json"||w==="jsonc"||a)return b;let P=/^\s*debugger\b/,E=Yn(b),_=b.split(/\r?\n/),D=[],j=!1;for(let B=0;B<_.length;B++){let Z=_[B],z=B+1;if(P.test(Z)&&!n.has(z)&&!E.has(z)&&!De("no-debugger",z,l)){j=!0;continue}D.push(Z)}return j?D.join(`
|
|
117
|
-
`):b}function Qo(y,b,s){let l=o(s,"indent",["style/indent"],"warn");if(!l)return;let n=y.split(".").pop()?.toLowerCase()??"";if(n==="md")return;if(n==="stx"||n==="html"||n==="htm"||n==="vue")return;if(n==="yaml"||n==="yml")return;if(n==="sh"||n==="bash"||n==="zsh"||n==="ksh"||n==="dash"||/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/.test(b))return;return l}function Kc(y,b,s,l){let n=b.format.indent,i=b.format.indentStyle,w=Yn(y),a=y.split(/\r?\n/),P=!1;for(let E=0;E<a.length;E++){let _=a[E],D=E+1;if(l.has(D)||w.has(D)||De("indent",D,s))continue;let j=0;while(j<_.length&&(_.charCodeAt(j)===32||_.charCodeAt(j)===9))j++;if(j===0)continue;let B=_.slice(0,j);if(!M(B,n,i,_))continue;let Z;if(i==="tabs"){let z=0,Y=0;for(let J=0;J<B.length;J++)if(B.charCodeAt(J)===9)Y++;else z++;let X=Math.floor(z/n);Z="\t".repeat(Y+X)}else{let z=0;for(let X=0;X<B.length;X++)if(B.charCodeAt(X)===9)z+=n;else z++;let Y=Math.floor(z/n)*n;Z=" ".repeat(Y)}if(Z!==B)a[E]=Z+_.slice(j),P=!0}return P?a.join(`
|
|
118
|
-
`):y}var it=null;function An(){it=null,q()}function Yn(y){if(it!==null&&it.content===y)return it.lines;let b=Hc(y);return it={content:y,lines:b},b}var Ze=0,qn=1,zn=2,Do=3,jo=4,Zn=5,Uo=6,Gn=1,Fo=2;function Hc(y){let b=new Set;if(!y.includes("`"))return b;let s=[],l=!1,n=Ze,i=1,w=0,a=-1,P=0,E=y.length,_=0,D=()=>{if(_++,y.charCodeAt(_)===10)i++,P=_+1,a=-1};for(;_<E;_++){let j=y.charCodeAt(_);if(j===10){if(n===Do)n=Ze;i++,P=_+1,a=-1;continue}if(n===Ze&&l&&w!==i)b.add(i),w=i;if(n!==Ze){switch(n){case qn:case zn:if(j===92)D();else if(n===qn&&j===39||n===zn&&j===34)n=Ze;break;case jo:if(j===42&&y.charCodeAt(_+1)===47)_++,n=Ze;break;case Zn:if(j===92)D();else if(j===91)n=Uo;else if(j===47)n=Ze;break;case Uo:if(j===92)D();else if(j===93)n=Zn;break}continue}if(l){if(j===92){D();continue}if(j===96){s.pop(),l=s.length>0&&s[s.length-1]===Gn;continue}if(j===36&&y.charCodeAt(_+1)===123){s.push(Fo),l=!1,_++;continue}continue}if(j===96){if(s.push(Gn),l=!0,w!==i)b.add(i),w=i;continue}if(j===39){n=qn;continue}if(j===34){n=zn;continue}if(j===47){let B=y.charCodeAt(_+1);if(B===47){n=Do,_++;continue}if(B===42){n=jo,_++;continue}if(Xn(a<0?"":y[a],y.slice(P,_+1),_-P)){n=Zn;continue}}if(j===125&&s.length>0&&s[s.length-1]===Fo){s.pop(),l=s.length>0&&s[s.length-1]===Gn;continue}if(!(j===32||j>=9&&j<=13||j>=128&&/\s/.test(y[_])))a=_}return b}function Bo(y,b){let s=y.match(b);if(!s||s.index===void 0)return null;let l=s.index+s[0].length-1,n=0;for(let i=l;i<y.length;i++)if(y[i]==="(")n++;else if(y[i]===")"){if(n--,n===0)return y.slice(l+1,i)}return null}function qo(y){let b="",s=0;for(let l of y){if(l==="("){s++;continue}if(l===")"){s=Math.max(0,s-1);continue}if(s===0)b+=l}return b}function zo(y){if(!y.includes("/"))return y;let b="",s=0;while(s<y.length){if(y[s]==="/"){if(y[s+1]==="/"||y[s+1]==="*")return b+y.slice(s);let l=y.slice(0,s).trimEnd();if(Xn(l[l.length-1]??"",y,s)){s++;let n=!1;while(s<y.length){if(y[s]==="\\"){s+=2;continue}if(y[s]==="[")n=!0;else if(y[s]==="]")n=!1;else if(y[s]==="/"&&!n){s++;while(s<y.length&&/[gimsuvy]/.test(y[s]))s++;break}s++}continue}}b+=y[s],s++}return b}function Xn(y,b,s){if(y==="")return!0;if("([{,:;!?&|=<>~^+*%-".includes(y))return!0;if(/[A-Za-z_$]/.test(y)){let n=b.slice(0,s).trimEnd();if(/(?:^|[^A-Za-z0-9_$])(?:return|typeof|instanceof|new|delete|void|in|of|yield|await|throw|case)$/.test(n))return!0}return!1}function Zo(y){if(!y.includes("/"))return y;let b="",s=0,l=null,n=!1;while(s<y.length){let i=y[s],w=y[s+1];if(n){b+=i,n=!1,s++;continue}if(i==="\\"&&l){n=!0,b+=i,s++;continue}if(!l){if(i==='"'){l="double",b+=i,s++;continue}if(i==="'"){l="single",b+=i,s++;continue}if(i==="`"){l="template",b+=i,s++;continue}if(i==="/"&&w==="/")break;if(i==="/"&&w==="*"){s+=2;while(s<y.length){if(y[s]==="*"&&y[s+1]==="/"){s+=2;break}s++}b+=" ";continue}b+=i,s++}else{if(l==="double"&&i==='"'||l==="single"&&i==="'"||l==="template"&&i==="`")l=null;b+=i,s++}}return b}function ze(y){let b=new Set,s="code",l=1,n=!1,i=!1,w=!1,a=[];for(let P=0;P<y.length;P++){let E=y[P],_=y[P+1],D=P>0?y[P-1]:"";if(E===`
|
|
119
|
-
`){if(w&&s==="block-comment")b.add(l);else if(!n&&i&&s!=="block-comment")b.add(l);else if(!n&&s==="block-comment")b.add(l);if(l++,n=!1,i=!1,w=s==="block-comment",s==="line-comment")s="code";continue}switch(s){case"code":if(E==="/"&&_==="/")s="line-comment",i=!0,P++;else if(E==="/"&&_==="*"){let j=!1;if(P>0){let B=P-1;while(B>0&&(y[B]===" "||y[B]==="\t"))B--;let Z=y[B];if("=([{,;!&|?:~^%+-".includes(Z)&&Z!==`
|
|
120
|
-
`)j=!0;else if(/[a-z]/.test(Z)){let z=y.slice(Math.max(0,B-6),B+1);if(/\b(?:return|case|typeof|void|in|of|new|throw|delete)$/.test(z))j=!0}}if(j){n=!0,P++;while(P<y.length){if(y[P]==="\\"){P+=2;continue}if(y[P]==="/"){P++;break}if(y[P]===`
|
|
121
|
-
`)break;P++}while(P<y.length&&/[gimsuy]/.test(y[P]))P++;P--}else i=!0,s="block-comment",P++}else if(E==="/"&&_!==void 0){let j=!1;if(P>0){let B=P-1;while(B>0&&(y[B]===" "||y[B]==="\t"))B--;let Z=y[B];if("=([{,;!&|?:~^%+-".includes(Z)||Z===`
|
|
122
|
-
`)j=!0;else if(/[a-z]/.test(Z)){let z=y.slice(Math.max(0,B-6),B+1);if(/\b(?:return|case|typeof|void|in|of|new|throw|delete)$/.test(z))j=!0}}if(j){n=!0,P++;while(P<y.length){if(y[P]==="\\"){P+=2;continue}if(y[P]==="/"){P++;break}if(y[P]===`
|
|
123
|
-
`)break;P++}while(P<y.length&&/[gimsuy]/.test(y[P]))P++;P--}else n=!0}else if(E==="'")s="string-single",n=!0;else if(E==='"')s="string-double",n=!0;else if(E==="`")s="string-template",n=!0;else if(E==="{"){if(a.length)a[a.length-1]++;n=!0}else if(E==="}"){if(a.length)if(a[a.length-1]===0)a.pop(),s="string-template";else a[a.length-1]--;n=!0}else if(E!==" "&&(E<"\t"||E>"\r")&&(E<"\x80"||!/\s/.test(E)))n=!0;break;case"string-single":if(E==="\\"){P++;break}if(E==="'")s="code";break;case"string-double":if(E==="\\"){P++;break}if(E==='"')s="code";break;case"string-template":if(E==="\\"){P++;break}if(E==="$"&&_==="{"){a.push(0),s="code",P++;break}if(E==="`")s="code";break;case"line-comment":break;case"block-comment":if(E==="*"&&_==="/")s="code",P++;break}}if(w&&s==="block-comment")b.add(l);else if(!n&&i&&s!=="block-comment")b.add(l);else if(!n&&s==="block-comment")b.add(l);return b}function ot(y,b,s,l,n){let i=[],w=b.split(/\r?\n/),a=s.format.quotes,P=y.split(".").pop()?.toLowerCase()??"",E=P==="md",_=P==="sh"||P==="bash"||P==="zsh"||P==="ksh"||P==="dash"||/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/.test(b),D=o(s,"quotes",["style/quotes"],"warn"),j=!D||P==="json"||P==="jsonc"||P==="lock"||E||P==="yaml"||P==="yml"||P==="stx"||P==="html"||P==="htm"||P==="vue"||_||y.endsWith("bun.lock"),B=E||P==="yaml"||P==="yml"||P==="json"||P==="jsonc"||_,Z=Qo(y,b,s),z=!1,Y=o(s,"no-debugger",["noDebugger"]),X=o(s,"no-console",["noConsole"]),J=o(s,"no-template-curly-in-string",["noTemplateCurlyInString"]),ie=o(s,"no-cond-assign",["noCondAssign"]),Q=/\bconsole\.log\s*\(/,ee=/^\s*debugger\b/,le=new Set;if(P==="md"){let be=!1;for(let te=0;te<w.length;te++){if(/^(?:`{3,}|~{3,})/.test(w[te].trim())){be=!be;continue}if(be)le.add(te+1)}}let ge=Yn(b);for(let be=0;be<w.length;be++){let te=w[be],ue=be+1;if(n.has(ue))continue;if(!j&&!ge.has(ue)){let de=Zo(zo(te)),oe=O(de,a);if(oe.length>0&&!z){if(!De("quotes",ue,l))i.push({filePath:y,line:ue,column:(oe[0]||0)+1,ruleId:"quotes",message:"Inconsistent quote style",severity:D,help:`Use ${a} quotes consistently throughout your code. You can change the preferred quote style in your config with format.quotes: '${a==="single"?"double":"single"}'`});z=!0}}let ce=0;while(ce<te.length&&(te.charCodeAt(ce)===32||te.charCodeAt(ce)===9))ce++;let ae=ce>0?te.slice(0,ce):"";if(Z&&ae.length>0&&!le.has(ue)&&!ge.has(ue)&&M(ae,s.format.indent,s.format.indentStyle,te)){if(!De("indent",ue,l))i.push({filePath:y,line:ue,column:1,ruleId:"indent",message:"Incorrect indentation detected",severity:Z,help:`Use ${s.format.indentStyle==="spaces"?`${s.format.indent} spaces`:"tabs"} for indentation. Configure with format.indent and format.indentStyle in your config`})}if(!B&&Y&&!ge.has(ue)&&ee.test(te)){if(!De("no-debugger",ue,l))i.push({filePath:y,line:ue,column:1,ruleId:"no-debugger",message:"Unexpected debugger statement",severity:Y,help:"Remove debugger statements before committing code. Use breakpoints in your IDE instead, or run with --fix to auto-remove"})}if(!B&&X&&!ge.has(ue)&&Q.test(te)){let de=te.indexOf("//"),oe=te.indexOf("console.");if(de!==-1&&oe>de);else{let xe=null;for(let he=0;he<te.length;he++){let fe=te[he];if(!xe){if(fe==='"')xe="double";else if(fe==="'")xe="single";else if(fe==="`")xe="template";else if(te.slice(he).startsWith("console.")){let ke=he+1;if(!De("no-console",ue,l))i.push({filePath:y,line:ue,column:ke,ruleId:"no-console",message:"Unexpected console call",severity:X,help:"Remove console statements before committing. Use a proper logging library or disable this rule if console output is intentional"});break}}else if(xe==="double"&&fe==='"'||xe==="single"&&fe==="'"||xe==="template"&&fe==="`"){let ke=0;for(let re=he-1;re>=0&&te[re]==="\\";re--)ke++;if(ke%2===0)xe=null}}}}if(J&&!ge.has(ue)){let de=te,oe=null,xe=!1,he=!1,fe="",ke="";for(let re=0;re<de.length;re++){let se=de[re];if(xe){if(ke==="\\"){ke=se;continue}if(he){if(se==="]")he=!1}else if(se==="[")he=!0;else if(se==="/"){xe=!1;while(re+1<de.length&&/[a-z]/i.test(de[re+1]))re++;fe="/"}ke=se;continue}if(!oe){if(se==='"'){oe="double",ke=se;continue}if(se==="'"){oe="single",ke=se;continue}if(se==="`"){oe="template",ke=se;continue}if(se==="/"&&de[re+1]!=="/"&&de[re+1]!=="*"&&Xn(fe,de,re)){xe=!0,he=!1,ke=se;continue}if(se!==" "&&se!=="\t")fe=se}else if(oe==="double"&&se==='"'||oe==="single"&&se==="'"||oe==="template"&&se==="`"){if(ke!=="\\")oe=null}else if(se==="$"&&de[re+1]==="{"&&ke!=="\\"&&oe!=="template"){if(!De("no-template-curly-in-string",ue,l))i.push({filePath:y,line:ue,column:re+1,ruleId:"no-template-curly-in-string",message:"Unexpected template string expression in normal string",severity:J,help:"Change the string quotes from ' or \" to backticks (`) to use template literal interpolation, or escape the $ if you meant to use it literally"});break}ke=se}}if(!B&&ie&&!ge.has(ue)){let oe=Zo(zo(te)).replace(/'[^']*'|"[^"]*"/g,'""'),xe=(re)=>/[^=!<>]=(?![=>])/.test(re),he=(re)=>{let se=te.match(re);if(se&&se.index!==void 0)return se.index+se[0].length;return Math.max(1,te.indexOf("(")+1)},fe=Bo(oe,/\b(?:if|while)\s*\(/);if(fe){let re=qo(fe);if(xe(re)){if(!De("no-cond-assign",ue,l))i.push({filePath:y,line:ue,column:he(/\b(?:if|while)\s*\(/),ruleId:"no-cond-assign",message:"Unexpected assignment within a conditional expression",severity:ie,help:"Use === or == for comparison instead of = (assignment). Wrap intentional assignments in extra parentheses."})}}let ke=Bo(oe,/\bfor\s*\(/);if(ke){let re=ke.split(";");if(re.length>=2){let se=qo(re[1]);if(xe(se)){if(!De("no-cond-assign",ue,l))i.push({filePath:y,line:ue,column:he(/\bfor\s*\(/),ruleId:"no-cond-assign",message:"Unexpected assignment within a conditional expression",severity:ie,help:"Use === or == for comparison instead of = (assignment). Wrap intentional assignments in extra parentheses."})}}}}}return i}async function v(y,b,s){An();let l=Hn(y,"utf8");if(s._formatOnly){let P=p(l,b,y);if(P!==l)if(!s.dryRun)Kn(y,P,"utf8");else return[{filePath:y,line:1,column:1,ruleId:"format",message:"File is not formatted",severity:"error",help:"Run pickier format with --write to apply formatting."}];return[]}if(s._nativeRules)return Yc(y,l,b,s._nativeRules);let n=qe(l),w=/\.(?:ts|js|tsx|jsx|mts|mjs|cts|cjs)$/.test(y)?ze(l):new Set,a=ot(y,l,b,n,w);try{let P=await En(y,l,b);for(let E of P){if(De(E.ruleId,E.line,n))continue;if(w.has(E.line)&&Ln(E.ruleId))continue;a.push({filePath:E.filePath,line:E.line,column:E.column,ruleId:E.ruleId,message:E.message,severity:E.severity,...E.help&&{help:E.help}})}}catch{}{let P=new Set;a=a.filter((E)=>{let _=`${E.line}:${E.column}:${E.ruleId}`;if(P.has(_))return!1;return P.add(_),!0})}if(s.fix){let P=A(l,b,y);if(P!==l){let E=qe(P),_=ze(P);if(a=ot(y,P,b,E,_),!s.dryRun)Kn(y,P,"utf8");if(s.dryRun&&(s.verbose!==void 0?s.verbose:b.verbose))Le().debug(t.gray(`dry-run: would apply fixes in ${Cn(process.cwd(),y)}`))}}return Te("scan done",Cn(process.cwd(),y),a.length),a}var Vn=null;async function Yc(y,b,s,l){if(Vn?.ids!==l)Vn={ids:l,set:new Set(l)};let n=await En(y,b,s,Vn.set);if(n.length===0)return n;let i=qe(b),w=ze(b),a=[];for(let P of n){if(De(P.ruleId,P.line,i))continue;if(w.has(P.line)&&Ln(P.ruleId))continue;a.push({filePath:P.filePath,line:P.line,column:P.column,ruleId:P.ruleId,message:P.message,severity:P.severity,...P.help&&{help:P.help},pos:P.pos})}return a}async function K(y,b){if(r.DIAGNOSTICS||r.TRACE)await Le().ready();try{return await Xc(y,b)}finally{await R()}}async function Xc(y,b){Te("runLint:start",{globs:y,options:b});let s=r.DIAGNOSTICS;if(s)Le().info("[pickier:diagnostics] Starting lint process...");try{if(s)Le().info("[pickier:diagnostics] Loading config...");let l=await u(b.config);Te("config:loaded",{reporter:l.lint.reporter,ext:l.lint.extensions.join(",")});let n=y.length?y:["."],i=x(n);if(Te("patterns",i),s)Le().info(`[pickier:diagnostics] Patterns to search: ${i.join(", ")}`);let w=b.ext||l.lint.extensions.join(","),a=new Set(w.split(",").map((re)=>{let se=re.trim();return se.startsWith(".")?se:`.${se}`}));if(s)Le().info(`[pickier:diagnostics] File extensions: ${Array.from(a).join(", ")}`);let P=r.TIMEOUT_MS;if(s)Le().info(`[pickier:diagnostics] Glob timeout: ${P}ms`);let E=i.some((re)=>{let se=re.replace(/\/?\*\*\/*\*\*$/,""),pe=Ye(se)?se:Xe(process.cwd(),se),me=process.cwd();return pe!==me&&!pe.startsWith(me+Ko)}),_=E?h(m):h(l.ignores),D=d(_);if(s){if(Le().info(`[pickier:diagnostics] Globbing outside project: ${E}, ignore patterns: ${_.length}`),E)Le().info(`[pickier:diagnostics] Using universal ignores: ${m.slice(0,5).join(", ")}... (${m.length} total)`)}let j=[],B=i.length===1&&!/[*?[\]{}()!]/.test(i[0]);if(s)Le().info(`[pickier:diagnostics] Starting file discovery... (nonGlobSingle: ${B})`);if(B)try{if($n(i[0]).isFile())j=[Ye(i[0])?i[0]:Xe(process.cwd(),i[0])]}catch{}let Z=i.length===1&&/\*\*\/*\*$/.test(i[0]);if(!j.length&&Z){let re=i[0].replace(/\/?\*\*\/*\*\*$/,"");if(s)Le().info(`[pickier:diagnostics] Using fast directory scan for: ${re}`);try{let pe=[Ye(re)?re:Xe(process.cwd(),re)],me=0;while(pe.length){let ne=pe.pop();if(me++,s&&me%100===0)Le().info(`[pickier:diagnostics] Scanned ${me} directories, ${j.length} files found so far...`);let Re=Go(ne);for(let Me of Re){let ve=Vo(ne,Me),Ie=$n(ve);if(D(ve))continue;if(Ie.isDirectory())pe.push(ve);else j.push(ve)}}if(s)Le().info(`[pickier:diagnostics] Fast scan complete: ${me} directories, ${j.length} total files`)}catch(se){if(s)Le().info(`[pickier:diagnostics] Fast scan failed: ${se?.message}, falling back to glob`);j=await rt(f(i,{dot:!1,ignore:_,onlyFiles:!0,absolute:!0}),P,"glob")}}else if(!j.length){if(s)Le().info(`[pickier:diagnostics] Using glob with timeout ${P}ms...`);if(j=await rt(f(i,{dot:!1,ignore:_,onlyFiles:!0,absolute:!0}),P,"glob"),s)Le().info(`[pickier:diagnostics] glob found ${j.length} files`)}if(Te("globbed entries",j.length),s)Le().info(`[pickier:diagnostics] File discovery complete: ${j.length} files found`);if(j.length>1e4){if(Le().warn(`[pickier:warn] Found ${j.length} files. This seems unusually high and may cause memory issues.`),Le().warn("[pickier:warn] Consider checking your ignore patterns or being more specific with your glob pattern."),Le().warn("[pickier:warn] Common culprits: node_modules, build directories, cache folders, or vendor dependencies."),j.length>1e5)return Le().error(`[pickier:error] File count exceeds 100,000 (${j.length}). This will likely cause out-of-memory errors.`),Le().error("[pickier:error] Aborting to prevent crash. Please refine your glob pattern or ignore patterns."),1}if(s)Le().info(`[pickier:diagnostics] Filtering ${j.length} files by extension and ignore patterns...`);let z=0,Y=0,X=0,J=0,ie=0,Q=[];for(let re of j){if(z++,s&&z%1000===0)Le().info(`[pickier:diagnostics] Filtering progress: ${z}/${j.length} files checked, ${Y} included...`);if(re.replace(/\\/g,"/").includes("/node_modules/")){X++;continue}if(D(re)){J++;continue}if(!T(re,a)){ie++;continue}Q.push(re),Y++}if(Te("filter:cli",{total:z,included:Y,node_modules:X,ignored:J,wrongExt:ie}),Te("filtered files",Q.length),s)Le().info("[pickier:diagnostics] Filtering complete:"),Le().info(`[pickier:diagnostics] Total files found: ${z}`),Le().info(`[pickier:diagnostics] Files to lint: ${Y}`),Le().info(`[pickier:diagnostics] Excluded (node_modules): ${X}`),Le().info(`[pickier:diagnostics] Excluded (ignored): ${J}`),Le().info(`[pickier:diagnostics] Excluded (wrong extension): ${ie}`);if(Q.length>5000){if(Le().warn(`[pickier:warn] After filtering, ${Q.length} files will be linted. This may take a while and use significant memory.`),Q.length>50000)return Le().error(`[pickier:error] ${Q.length} files to lint exceeds safe limit (50,000). This will likely cause out-of-memory errors.`),Le().error("[pickier:error] Aborting to prevent crash. Please be more specific with your glob pattern."),Le().error("[pickier:error] Example: Instead of '../stx', try '../stx/src' or '../stx/packages/core'"),1}let ee=r.CONCURRENCY;if(s)Le().info(`[pickier:diagnostics] Starting to process ${Q.length} files with concurrency ${ee}...`);let le=0,ge=async(re)=>{if(s){if(le++,le===1||le%10===0||le===Q.length)Le().info(`[pickier:diagnostics] Processing file ${le}/${Q.length}: ${Cn(process.cwd(),re)}`)}return v(re,l,b)},be=async(re,se=b)=>{if(re.length===0)return[];let pe=se===b?ge:(ne)=>v(ne,l,se),me=s||r.TRACE?0:To(re.length);return me>1?Wo(re,se,me,pe):Ho(re,ee,pe)},te=s||r.TRACE?null:$o(l,b),ue=async(re)=>{let se=Array(re.length);if(te){let ne=re.flatMap((Me,ve)=>vo(Me)?[ve]:[]),Re=ne.map((Me)=>re[Me]);if(Re.length>0&&te.hybrid){let[Me,ve]=await Promise.all([Lo(Re,te.request,te.binary,te.positions),be(Re,{...b,_nativeRules:te.nativeRules})]);if(Me)ne.forEach((Ie,Ae)=>{if(Me[Ae])se[Ie]=Oo(Me[Ae],ve[Ae])});Te("native",{files:Re.length,linted:Me?Me.filter(Boolean).length:0,hybrid:!0})}else if(Re.length>0){let Me=Co(Re,te.request,te.binary);if(Me)ne.forEach((ve,Ie)=>{if(Me[Ie])se[ve]=Me[Ie]});Te("native",{files:Re.length,linted:Me?Me.filter(Boolean).length:0})}}let pe=re.flatMap((ne,Re)=>se[Re]===void 0?[Re]:[]),me=await be(pe.map((ne)=>re[ne]));return pe.forEach((ne,Re)=>{se[ne]=me[Re]}),se},ce;if(Ro(l,b)){let re=wo(l,b),se=Q.map((ne)=>{try{return Hn(ne,"utf8")}catch{return null}});ce=Array(Q.length);let pe=[];for(let ne=0;ne<Q.length;ne++){let Re=se[ne]===null?void 0:re.get(Q[ne],se[ne]);if(Re)ce[ne]=Re;else pe.push(ne)}let me=await ue(pe.map((ne)=>Q[ne]));pe.forEach((ne,Re)=>{if(ce[ne]=me[Re],se[ne]!==null)re.set(Q[ne],se[ne],me[Re])}),re.save(),Te("cache",{hits:Q.length-pe.length,misses:pe.length})}else ce=await ue(Q);let ae=ce.flat();if(s)Le().info(`[pickier:diagnostics] Processing complete! Found ${ae.length} issues total`);let de=0,oe=0;for(let re of ae)if(re.severity==="error")de++;else if(re.severity==="warning")oe++;if(Te("issues:summary",{errors:de,warnings:oe}),s)Le().info(`[pickier:diagnostics] Errors: ${de}, Warnings: ${oe}`);let xe=b.reporter||l.lint.reporter,he=b.verbose!==void 0?b.verbose:l.verbose;if(xe==="json")console.log(JSON.stringify({errors:de,warnings:oe,issues:ae},null,2));else if(xe==="compact")for(let re of ae)console.log(`${Cn(process.cwd(),re.filePath)}:${re.line}:${re.column} ${re.severity} ${re.ruleId} ${re.message}`);else if(ae.length>0)console.log(he?ho(ae):go(ae));if(ae.length>0&&xe!=="json"){let re=de+oe,se=re===1?"problem":"problems",pe=de===1?"error":"errors",me=oe===1?"warning":"warnings",ne=Sn(l),Re=0,Me=0;for(let ve of ae){let Ie=ve.ruleId;if(ne.fixableRuleIds.has(Ie)||ne.fixableBareRuleNames.has(Ie)){if(ve.severity==="error")Re++;else if(ve.severity==="warning")Me++}}if(console.log(),console.log(t.red(`\u2716 ${re} ${se} (${de} ${pe}, ${oe} ${me})`)),Re>0||Me>0){let ve=Re===1?"error":"errors",Ie=Me===1?"warning":"warnings";console.log(t.gray(` ${Re} ${ve} and ${Me} ${Ie} potentially fixable with the \`--fix\` option.`))}}if(he&&xe!=="json")console.log(t.gray(`Scanned ${Q.length} files, found ${de} errors and ${oe} warnings.`));let fe=b.maxWarnings??l.lint.maxWarnings,ke=r.FAIL_ON_WARNINGS;if(de>0)return Te("runLint:end",1),1;if(ke&&oe>0)return Te("runLint:end",1),1;if(fe>=0&&oe>fe)return Te("runLint:end",1),1;return Te("runLint:end",0),0}catch(l){return Le().error("[pickier:error] runLint failed:",l?.message||l),Te("runLint:exception",l),1}}
|
|
124
|
-
export{R,H,W,A,U,V,v,K};
|