pickier 0.1.69 → 0.1.70
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-1c4363f9.js → chunk-0b2yx624.js} +2 -2
- package/dist/chunk-1jtr81zg.js +25 -0
- package/dist/{chunk-0wjnsb7e.js → chunk-5c026tb4.js} +1 -1
- package/dist/chunk-5tx5kfq7.js +2 -0
- package/dist/{chunk-jqsghmew.js → chunk-8m82hwdv.js} +2 -2
- package/dist/chunk-c82emw32.js +3 -0
- package/dist/{chunk-861zc8zq.js → chunk-gpfjzx90.js} +1 -1
- package/dist/chunk-m9ym248d.js +2 -0
- package/dist/chunk-mqjmcycy.js +128 -0
- package/dist/chunk-ng3egs14.js +2 -0
- package/dist/chunk-pvptb0h1.js +3 -0
- package/dist/{chunk-zp6n036m.js → chunk-qjzzx1m2.js} +18 -18
- package/dist/chunk-t776wefr.js +2 -0
- package/dist/chunk-wx92kdf9.js +9 -0
- package/dist/chunk-xjt8q744.js +3 -0
- package/dist/src/index.js +1 -1
- package/dist/src/lint-worker.js +1 -1
- package/dist/src/rules/shell/_continuation.d.ts +4 -0
- package/package.json +1 -1
- package/dist/chunk-1gsmqw00.js +0 -2
- package/dist/chunk-1r811fef.js +0 -9
- package/dist/chunk-9nk05dhr.js +0 -3
- package/dist/chunk-9w2q7ghj.js +0 -2
- package/dist/chunk-acdw0br0.js +0 -3
- package/dist/chunk-dqv1qww5.js +0 -128
- package/dist/chunk-hyabhvem.js +0 -2
- package/dist/chunk-vjsh2bkt.js +0 -25
- package/dist/chunk-w7q10fyj.js +0 -2
- package/dist/chunk-yvrap76h.js +0 -3
package/dist/chunk-dqv1qww5.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{d,S,C,k,E,u,r,f,L,o,t,l,y,P,m,h}from"./chunk-vjsh2bkt.js";import{T}from"./chunk-9nk05dhr.js";import{e,b}from"./chunk-jqsghmew.js";import{readdirSync as Zo,readFileSync as Yn,statSync as vn,writeFileSync as Hn}from"fs";import{isAbsolute as Ze,join as Go,relative as $n,resolve as Ge,sep as Vo}from"path";import{readFileSync as go,writeFileSync as bc}from"fs";import{isAbsolute as yc,relative as po,resolve as xc}from"path";var An=Promise.resolve();function rt(p){let R=null,s=null,c=()=>(s??=import("./chunk-dxrcbgyc.js").then((i)=>(R=new i.Logger(p,{showTags:!1}),R)),s),n=(i,g)=>{if(R){R[i](...g);return}An=An.then(c).then((a)=>{a[i](...g)}).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 c()}}}function w(){return An}var ot={meta:{docs:"Enforce return statements in callbacks of array methods",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),i=new RegExp(`\\.(${["map","filter","find","findIndex","findLast","findLastIndex","every","some","reduce","reduceRight","sort","flatMap"].join("|")})\\s*\\(`,"g");for(let g=0;g<c.length;g++){let a=c[g],M;for(M=i.exec(a);M!==null;M=i.exec(a)){let v=M[1],A=M.index+M[0].length,O=a.slice(A),_=O.match(/^\s*(?:\(([^)]*)\)|([a-z_$][\w$]*))\s*=>/i),U=O.match(/^\s*function\s*(?:[a-zA-Z_$][\w$]*\s*)?\(/);if(_){let B=O.slice(_[0].length).trim();if(B.startsWith("{")){let q=!1,z=0,Z=B,G=g;while(G<c.length){let X=G===g?Z:c[G];for(let V=0;V<X.length;V++){let K=X[V];if(K==="{")z++;if(K==="}"){if(z--,z===0){if(!q)s.push({filePath:R.filePath,line:g+1,column:M.index+1,ruleId:"eslint/array-callback-return",message:`Array method '${v}' callback should return a value`,severity:"error"});break}}}if(X.match(new RegExp("\\breturn\\s+[^;]")))q=!0;if(z===0)break;G++,Z=c[G]||""}}}else if(U){let B=!1,q=0,z=g,Z=!1;while(z<c.length){let G=c[z];for(let X=0;X<G.length;X++){let V=G[X];if(V==="{")q++,Z=!0;else if(V==="}"){if(q--,q===0&&Z){if(!B)s.push({filePath:R.filePath,line:g+1,column:M.index+1,ruleId:"eslint/array-callback-return",message:`Array method '${v}' callback should return a value`,severity:"error"});break}}}if(Z&&G.match(new RegExp("\\breturn\\s+[^;]")))B=!0;if(q===0&&Z)break;z++}}}}return s}};var lt={meta:{docs:"Require super() calls in constructors of derived classes",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=!1,i=!1,g=0,a=0,M=!1;for(let v=0;v<c.length;v++){let A=c[v];if(A.match(/\bclass\s+\w+\s+extends\s+\w+/))n=!0;if(n&&A.match(/\bconstructor\s*\(/))i=!0,g=v+1,a=0,M=!1;if(i){for(let O of A){if(O==="{")a++;if(O==="}")a--}if(A.match(/\bsuper\s*\(/))M=!0;if(a===0&&A.includes("}")){if(!M)s.push({filePath:R.filePath,line:g,column:1,ruleId:"eslint/constructor-super",message:"Constructors of derived classes must call super()",severity:"error"});i=!1,n=!1}}}return s}};var ct={meta:{docs:'Enforce "for" loop update clause moving counter in the right direction',recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=new RegExp("\\bfor\\s*\\(\\s*(?:(?:let|var|const)\\s*)?(\\w+)\\s*=[^;]+;\\s*(\\w+)\\s*([<>]=?)[^;]+;\\s*(\\w+)(\\+\\+|--|[\\s+-]=)"),a=i.match(g);if(a){let M=a[1],v=a[2],A=a[3],O=a[4],_=a[5];if(M===v&&v===O){let U=_.includes("+"),B=A.includes("<");if(B&&!U||!B&&U)s.push({filePath:R.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 at={meta:{docs:"Enforce return statements in getters",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let g=c[n].match(/\bget\s+(\w+)\s*\(/);if(g){let a=g[1],M=!1,v=0,A=n;while(A<c.length){let O=c[A];for(let U of O){if(U==="{")v++;if(U==="}"){if(v--,v===0){if(!M)s.push({filePath:R.filePath,line:n+1,column:1,ruleId:"eslint/getter-return",message:`Getter '${a}' must return a value`,severity:"error"});break}}}let _=new RegExp("\\breturn\\s+[^;]");if(O.match(_))M=!0;if(v===0)break;A++}}}return s}};var ut={meta:{docs:"Disallow async functions as Promise executor",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/new\s+Promise\s*\(\s*async\s*(?:\(|function)/g,a;for(a=g.exec(i);a!==null;a=g.exec(i))s.push({filePath:R.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 ft={meta:{docs:"Disallow comparing against -0",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/([!=]==?)\s*-0\b|\b-0\s*([!=]==?)/g,a;for(a=g.exec(i);a!==null;a=g.exec(i))s.push({filePath:R.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 mt={meta:{docs:"Disallow assignment operators in conditional expressions",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\b(if|while)\s*\([^)]*\b(\w+)\s*=\s*(?!=)[^)]*\)/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){let M=a[0];if(/===|==/.test(M))continue;if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.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 pt={meta:{docs:"Disallow reassigning const variables",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=new Map;for(let i=0;i<c.length;i++){let g=c[i],a=g.match(/\bconst\s+(\w+)/);if(a)n.set(a[1],i);let M=/\b(\w+)\s*=(?!=)/g,v;for(v=M.exec(g);v!==null;v=M.exec(g)){let A=v[1],O=g.substring(0,v.index);if(!/\b(?:const|let|var)\s*$/.test(O)&&n.has(A))s.push({filePath:R.filePath,line:i+1,column:Math.max(1,v.index+1),ruleId:"eslint/no-const-assign",message:`'${A}' is constant`,severity:"error"})}}return s}};var dt={meta:{docs:"Disallow constant expressions in conditions",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=[{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:M}of g){let v;while((v=a.exec(i))!==null){let A=v[1];if(i.substring(0,v.index).includes("//"))continue;s.push({filePath:R.filePath,line:n+1,column:Math.max(1,v.index+A.length+2),ruleId:"eslint/no-constant-condition",message:"Unexpected constant condition",severity:"error"})}}}return s}};var ht={meta:{docs:"Disallow duplicate class members",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=!1,i=new Set,g=0;for(let a=0;a<c.length;a++){let M=c[a];if(M.match(/\bclass\s+\w+/))n=!0,i=new Set,g=0;if(n){for(let A of M){if(A==="{")g++;if(A==="}"){if(g--,g===0)n=!1}}let v=[...M.matchAll(/^\s*(?:(?:public|private|protected|static|readonly|async)\s*)?(?:get|set)?\s*(\w+)\s*\(/g),...M.matchAll(/^\s*(?:(?:public|private|protected|static|readonly)\s*)?(\w+)\s*[:=]/g)];for(let A of v){let O=A[1];if(i.has(O))s.push({filePath:R.filePath,line:a+1,column:1,ruleId:"eslint/no-dupe-class-members",message:`Duplicate class member '${O}'`,severity:"error"});else i.add(O)}}}return s}};var Ke={meta:{docs:"Disallow duplicate keys in object literals",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=/\{\s*$/,i=/^\s*(?:(['"`])(.+?)\1|(\w+))\s*:/;for(let g=0;g<c.length;g++){let a=c[g];if(!n.test(a)&&!a.includes("{"))continue;let M=new Map,v=(a.match(/\{/g)||[]).length-(a.match(/\}/g)||[]).length,A=g;for(let O=g+1;O<c.length&&v>0;O++){let _=c[O];v+=(_.match(/\{/g)||[]).length,v-=(_.match(/\}/g)||[]).length;let U=_.match(i);if(U){let B=U[2]||U[3];if(B)if(M.get(B)!==void 0)s.push({filePath:R.filePath,line:O+1,column:Math.max(1,_.search(/\S/)+1),ruleId:"eslint/no-dupe-keys",message:`Duplicate key '${B}'`,severity:"error"});else M.set(B,O)}if(v===0)break}}return s},fix:(p,R)=>{let s=Ke.check(p,R);if(s.length===0)return p;let c=p.split(/\r?\n/),n=new Set(s.map((g)=>g.line-1));return c.filter((g,a)=>!n.has(a)).join(`
|
|
3
|
-
`)}};var gt={meta:{docs:"Disallow duplicate case labels in switch statements",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=!1,i=new Set,g=-1;for(let a=0;a<c.length;a++){let M=c[a],v=M.trim();if(/\bswitch\s*\(/.test(v)){n=!0,i=new Set,g=a;continue}if(n&&v==="}"&&a>g){let A=c[g].match(/^\s*/)?.[0].length||0;if((M.match(/^\s*/)?.[0].length||0)<=A+2)n=!1,i=new Set}if(n){let A=v.match(/^case\s+(.+?)\s*:/);if(A){let O=A[1].trim();if(i.has(O))s.push({filePath:R.filePath,line:a+1,column:Math.max(1,M.indexOf("case")+1),ruleId:"eslint/no-duplicate-case",message:`Duplicate case label '${O}'`,severity:"error"});else i.add(O)}}}return s}};var bt={meta:{docs:"Disallow empty destructuring patterns",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\{\s*\}\s*=/g,a=/\[\s*\]\s*=/g,M;for(M=g.exec(i);M!==null;M=g.exec(i)){if(i.substring(0,M.index).includes("//"))continue;s.push({filePath:R.filePath,line:n+1,column:Math.max(1,M.index+1),ruleId:"eslint/no-empty-pattern",message:"Unexpected empty object pattern",severity:"error"})}for(M=a.exec(i);M!==null;M=a.exec(i)){if(i.substring(0,M.index).includes("//"))continue;s.push({filePath:R.filePath,line:n+1,column:Math.max(1,M.index+1),ruleId:"eslint/no-empty-pattern",message:"Unexpected empty array pattern",severity:"error"})}}return s}};var yt={meta:{docs:"Disallow fallthrough of case statements",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=!1,i=-1,g=!1;for(let a=0;a<c.length;a++){let v=c[a].trim();if(/\bswitch\s*\(/.test(v)){n=!0;continue}if(n){if(/^case\s+/.test(v)||/^default\s*:/.test(v)){if(i>=0&&g){if(!(/\/\/.*falls?\s*through|\/\*.*falls?\s*through/i.test(c[i])||a>0&&/\/\/.*falls?\s*through|\/\*.*falls?\s*through/i.test(c[a-1])))s.push({filePath:R.filePath,line:i+1,column:Math.max(1,c[i].indexOf("case")+1),ruleId:"eslint/no-fallthrough",message:"Expected a 'break' statement before 'case'",severity:"error"})}i=a,g=!0}if(/\b(?:break|return|throw|continue)\b/.test(v))g=!1;if(v==="}")n=!1,i=-1,g=!1}}return s}};var xt={meta:{docs:"Disallow number literals that lose precision",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\b(\d{17,}(?:\.\d+)?|\d+\.\d{17,})\b/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){let M=a[1];if(Number(M).toString()!==M)s.push({filePath:R.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 Rt={meta:{docs:"Disallow returning values from Promise executor functions",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++)if(c[n].match(/new\s+Promise\s*\(/)){let a=0,M=!1,v=n;while(v<c.length){let A=c[v];for(let _ of A){if(_==="{")a++,M=!0;if(_==="}"){if(a--,a===0&&M)break}}let O=new RegExp("\\breturn\\s+[^;]");if(M&&A.match(O))s.push({filePath:R.filePath,line:v+1,column:1,ruleId:"eslint/no-promise-executor-return",message:"Return values from promise executor functions cannot be read",severity:"error"});if(a===0&&M)break;v++}}return s}};var wt={meta:{docs:"Disallow variable redeclaration",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=new Map;for(let i=0;i<c.length;i++){let g=c[i],a=/\b(var|let|const)\s+(\w+)/g,M;for(M=a.exec(g);M!==null;M=a.exec(g)){let A=M[2];if(n.get(A)!==void 0)s.push({filePath:R.filePath,line:i+1,column:Math.max(1,M.index+1),ruleId:"eslint/no-redeclare",message:`'${A}' is already defined`,severity:"error"});else n.set(A,i)}let v=/\bfunction\s+(\w+)/g;for(M=v.exec(g);M!==null;M=v.exec(g)){let A=M[1];if(n.get(A)!==void 0)s.push({filePath:R.filePath,line:i+1,column:Math.max(1,M.index+1),ruleId:"eslint/no-redeclare",message:`'${A}' is already defined`,severity:"error"});else n.set(A,i)}}return s}};var He={meta:{docs:"Disallow assignments where both sides are identical",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=new RegExp("\\b(\\w+)\\s*=\\s*(\\w+)\\s*(?:;\\s*)?(?:\\/\\/.*)?$"),a=i.match(g);if(a&&a[1]===a[2]){s.push({filePath:R.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 M=i.match(/([\w.]+)\s*=\s*([\w.]+)/);if(M&&M[1]===M[2]){s.push({filePath:R.filePath,line:n+1,column:Math.max(1,i.indexOf(M[1])+1),ruleId:"eslint/no-self-assign",message:`'${M[1]}' is assigned to itself`,severity:"error"});continue}let v=i.match(/(\w+\[[^\]]+\])\s*=\s*(\w+\[[^\]]+\])/);if(v){let A=v[1].replace(/\s/g,""),O=v[2].replace(/\s/g,"");if(A===O)s.push({filePath:R.filePath,line:n+1,column:Math.max(1,i.indexOf(v[1])+1),ruleId:"eslint/no-self-assign",message:`'${v[1]}' is assigned to itself`,severity:"error"})}}return s},fix:(p,R)=>{let s=He.check(p,R);if(s.length===0)return p;let c=p.split(/\r?\n/),n=new Set(s.map((g)=>g.line-1));return c.map((g,a)=>{if(n.has(a)){let M=g.trim();if(new RegExp("^\\w+(?:\\.\\w+|\\[[^\\]]+\\])?\\s*=\\s*\\w+(?:\\.\\w+|\\[[^\\]]+\\])?;?\\s*$").test(M))return""}return g}).filter((g,a,M)=>{if(g===""&&n.has(a)){let v=a>0&&M[a-1].trim()!=="",A=a<M.length-1&&M[a+1]&&M[a+1].trim()!=="";if(!v||!A)return!1}return!0}).join(`
|
|
4
|
-
`)}};var kt={meta:{docs:"Disallow comparisons where both sides are identical",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/([\w.\[\]]+)\s*(===|!==|==|!=|<|>|<=|>=)\s*([\w.\[\]]+)/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){let M=a[1].replace(/\s/g,""),v=a[2],A=a[3].replace(/\s/g,"");if(M===A)s.push({filePath:R.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 It={meta:{docs:"Disallow sparse arrays (arrays with empty slots)",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\[([^\]]*)\]/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){let M=a[1];if(/,\s*,/.test(M))s.push({filePath:R.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:(p,R)=>{let s=p.split(/\r?\n/),c=!1,n=s.map((i)=>{let g=i;return g=g.replace(/\[([^\]]*)\]/g,(a,M)=>{if(/,\s*,/.test(M))return c=!0,`[${M.replace(/,(\s*),/g,", undefined,")}]`;return a}),g});return c?n.join(`
|
|
5
|
-
`):p}};var Pt={meta:{docs:"Disallow undeclared variables",recommended:!0,wip:!0},check:(p,R)=>[]};var Mt={meta:{docs:"Disallow unreachable code after return, throw, continue, or break",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(/^\s*(?:return|throw|break|continue)\b/.test(i))for(let a=n+1;a<c.length;a++){let M=c[a],v=M.trim();if(v===""||v.startsWith("//")||v.startsWith("/*"))continue;if(v==="}"||v.startsWith("}"))break;if(/^(?:case\b|default\s*:)/.test(v))break;s.push({filePath:R.filePath,line:a+1,column:Math.max(1,M.search(/\S/)+1),ruleId:"eslint/no-unreachable",message:"Unreachable code",severity:"error"});break}}return s}};var vt={meta:{docs:"Disallow negation of the left operand of relational operators",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/!\s*\w+\s+in\s+/g,a=/!\s*\w+\s+instanceof\s+/g,M;for(M=g.exec(i);M!==null;M=g.exec(i))s.push({filePath:R.filePath,line:n+1,column:M.index+1,ruleId:"eslint/no-unsafe-negation",message:"Unexpected negation of 'in' operand",severity:"error"});for(M=a.exec(i);M!==null;M=a.exec(i))s.push({filePath:R.filePath,line:n+1,column:M.index+1,ruleId:"eslint/no-unsafe-negation",message:"Unexpected negation of 'instanceof' operand",severity:"error"})}return s},fix:(p)=>{let R=p;return R=R.replace(/!\s*(\w+)\s+in\s+/g,"!($1 in "),R=R.replace(/!\s*(\w+)\s+instanceof\s+/g,"!($1 instanceof "),R}};var $t={meta:{docs:"Disallow unnecessary catch clauses",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.match(/catch\s*\(\s*(\w+)\s*\)/);if(!g)continue;let a=g[1];for(let M=n+1;M<Math.min(n+5,c.length);M++){let v=c[M].trim();if(v===`throw ${a}`||v===`throw ${a};`){let A=!1;for(let O=n+1;O<M;O++){let _=c[O].trim();if(_!==""&&_!=="{"&&!_.startsWith("//")){A=!0;break}}if(!A)s.push({filePath:R.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(v==="}")break}}return s}};var Ct={meta:{docs:"Require isNaN() when checking for NaN",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\b([\w.\[\]]+)\s*(===|!==|==|!=)\s*NaN\b|\bNaN\s*(===|!==|==|!=)\s*([\w.\[\]]+)/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){let M=a[1]||a[4];s.push({filePath:R.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:(p,R)=>{let s=p.split(/\r?\n/),c=!1,n=s.map((i)=>{let g=i;return g=g.replace(/\b([\w.\[\]]+)\s*===\s*NaN\b/g,(a,M)=>(c=!0,`isNaN(${M})`)),g=g.replace(/\bNaN\s*===\s*([\w.\[\]]+)\b/g,(a,M)=>(c=!0,`isNaN(${M})`)),g=g.replace(/\b([\w.\[\]]+)\s*!==\s*NaN\b/g,(a,M)=>(c=!0,`!isNaN(${M})`)),g=g.replace(/\bNaN\s*!==\s*([\w.\[\]]+)\b/g,(a,M)=>(c=!0,`!isNaN(${M})`)),g=g.replace(/\b([\w.\[\]]+)\s*==\s*NaN\b/g,(a,M)=>(c=!0,`isNaN(${M})`)),g=g.replace(/\bNaN\s*==\s*([\w.\[\]]+)\b/g,(a,M)=>(c=!0,`isNaN(${M})`)),g=g.replace(/\b([\w.\[\]]+)\s*!=\s*NaN\b/g,(a,M)=>(c=!0,`!isNaN(${M})`)),g=g.replace(/\bNaN\s*!=\s*([\w.\[\]]+)\b/g,(a,M)=>(c=!0,`!isNaN(${M})`)),g});return c?n.join(`
|
|
6
|
-
`):p}};var Qn=["undefined","object","boolean","number","string","function","symbol","bigint"],Lt={meta:{docs:"Enforce comparing typeof expressions against valid strings",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/typeof\s+\w+\s*(?:===|!==|==|!=)\s*(['"`])(\w+)\1/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){let v=a[2];if(!Qn.includes(v))s.push({filePath:R.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/valid-typeof",message:`Invalid typeof comparison value '${v}'`,severity:"error"})}let M=/(['"`])(\w+)\1\s*(?:===|!==|==|!=)\s*typeof\s+\w+/g;for(a=M.exec(i);a!==null;a=M.exec(i)){let v=a[2];if(!Qn.includes(v))s.push({filePath:R.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/valid-typeof",message:`Invalid typeof comparison value '${v}'`,severity:"error"})}}return s}};var St={meta:{docs:"Enforce a maximum cyclomatic complexity allowed in a program",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=10,i=!1,g=0,a="",M=0,v=0;for(let A=0;A<c.length;A++){let O=c[A],_=O.match(/\bfunction\s+(\w+)\s*\(|(\w+)\s*=\s*(?:\([^)]*\)|(\w+))\s*=>/);if(_)i=!0,g=A+1,a=_[1]||_[2]||_[3]||"anonymous",M=1,v=0;if(i){for(let B of O){if(B==="{")v++;if(B==="}"){if(v--,v===0){if(M>10)s.push({filePath:R.filePath,line:g,column:1,ruleId:"eslint/complexity",message:`Function '${a}' has complexity ${M}, exceeds maximum of 10`,severity:"error"});i=!1}}}let U=[/\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 B of U){let q=O.match(new RegExp(B,"g"));if(q)M+=q.length}}}return s}};var Et={meta:{docs:"Require default case in switch statements",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=!1,i=0,g=!1,a=0;for(let M=0;M<c.length;M++){let v=c[M];if(v.match(/\bswitch\s*\(/))n=!0,i=M+1,g=!1,a=0;if(n){for(let A of v){if(A==="{")a++;if(A==="}"){if(a--,a===0){if(!g)s.push({filePath:R.filePath,line:i,column:1,ruleId:"eslint/default-case",message:"Expected a default case",severity:"error"});n=!1}}}if(v.match(/\bdefault\s*:/))g=!0}}return s}};var At={meta:{docs:"Require === and !== instead of == and !=",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/([^=!])(\s*)(==)(\s*)([^=])/g,a=/([^!])(\s*)(!=)(\s*)([^=])/g,M;for(M=g.exec(i);M!==null;M=g.exec(i))s.push({filePath:R.filePath,line:n+1,column:Math.max(1,M.index+2),ruleId:"eslint/eqeqeq",message:"Expected '===' and instead saw '=='",severity:"error"});for(M=a.exec(i);M!==null;M=a.exec(i))s.push({filePath:R.filePath,line:n+1,column:Math.max(1,M.index+2),ruleId:"eslint/eqeqeq",message:"Expected '!==' and instead saw '!='",severity:"error"})}return s},fix:(p)=>{let R=p;return R=R.replace(/([^!])(\s*)(!=)(\s*)([^=])/g,"$1$2!==$4$5"),R=R.replace(/([^=!])(\s*)(==)(\s*)([^=])/g,"$1$2===$4$5"),R}};var Ot={meta:{docs:"Enforce a maximum depth that blocks can be nested",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=4,i=0,g=0,a=0;for(let M=0;M<c.length;M++){let v=c[M];if(v.match(/\b(if|for|while|switch|try|catch|else)\b.*\{/)){if(i++,i>g)g=i,a=M+1}else if(v.match(/\{/)&&!v.match(/^.*\}/)){if(c[M-1]?.match(/\b(if|for|while|switch|try|catch|else)\b/)){if(i++,i>g)g=i,a=M+1}}if(v.match(/^\s*\}/))i--;if(i>4)s.push({filePath:R.filePath,line:M+1,column:1,ruleId:"eslint/max-depth",message:`Blocks are nested too deeply (${i}), maximum allowed is 4`,severity:"error"})}return s}};var _t={meta:{docs:"Enforce a maximum number of lines of code in a function",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=50,i=!1,g=0,a="",M=0;for(let v=0;v<c.length;v++){let A=c[v],O=A.match(/\bfunction\s+(\w+)\s*\(|(\w+)\s*=\s*(?:\([^)]*\)|(\w+))\s*=>/);if(O)i=!0,g=v+1,a=O[1]||O[2]||O[3]||"anonymous",M=0;if(i)for(let _ of A){if(_==="{")M++;if(_==="}"){if(M--,M===0){let U=v+1-g+1;if(U>50)s.push({filePath:R.filePath,line:g,column:1,ruleId:"eslint/max-lines-per-function",message:`Function '${a}' has ${U} lines, exceeds maximum of 50`,severity:"error"});i=!1}}}}return s}};var Tt={meta:{docs:"Disallow alert, confirm, and prompt",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\b(alert|confirm|prompt)\s*\(/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-alert",message:`Unexpected ${a[1]}`,severity:"warning"})}}return s}};var Wt={meta:{docs:"Disallow await inside of loops",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=!1,i=0,g=0;for(let a=0;a<c.length;a++){let M=c[a];if(M.match(/\b(for|while|do)\s*\(/))n=!0,i=0,g=a;if(n){for(let v of M){if(v==="{")i++;if(v==="}"){if(i--,i===0)n=!1}}if(M.match(/\bawait\s+/))s.push({filePath:R.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 Nt={meta:{docs:"Disallow use of arguments.caller or arguments.callee",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\barguments\s*\.\s*(caller|callee)\b/g,a;for(a=g.exec(i);a!==null;a=g.exec(i))s.push({filePath:R.filePath,line:n+1,column:a.index+1,ruleId:"eslint/no-caller",message:`Avoid arguments.${a[1]}`,severity:"error"})}return s}};var Dt={meta:{docs:"Disallow lexical declarations in case clauses",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=!1,i=!1;for(let g=0;g<c.length;g++){let a=c[g];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:R.filePath,line:g+1,column:1,ruleId:"eslint/no-case-declarations",message:"Unexpected lexical declaration in case block",severity:"error"})}}return s}};var jt={meta:{docs:"Disallow else blocks after return statements in if statements",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];if(!/^\s*else\b/.test(i))continue;let g=!1;for(let a=n-1;a>=0&&a>=n-10;a--){let M=c[a].trim();if(M.startsWith("return"))g=!0;if(M==="}"&&g)break;if(M.includes("{"))break}if(g)s.push({filePath:R.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 Ut={meta:{docs:"Disallow empty block statements",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\{\s*\}/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){let M=i.substring(0,a.index).trim(),v=/(?:if|else|for|while|do|try|catch|finally|function|\})\s*$/.test(M),A=/[=:]$/.test(M)||/return\s*$/.test(M);if(v&&!A)s.push({filePath:R.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<c.length-1;n++){let i=c[n],g=c[n+1];if(/\{\s*$/.test(i.trim()))for(let a=n+1;a<c.length;a++){let M=c[a].trim();if(M==="")continue;if(M==="}"||M.startsWith("}")){let v=i.substring(0,i.lastIndexOf("{")).trim(),A=/(?:if|else|for|while|do|try|catch|finally|function|\})\s*$/.test(v),O=/[=:]$/.test(v)||/return\s*$/.test(v);if(A&&!O)s.push({filePath:R.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 Ft={meta:{docs:"Disallow empty functions",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=[/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 g){let M;for(M=a.exec(i);M!==null;M=a.exec(i)){if(i.substring(0,M.index).includes("//"))continue;s.push({filePath:R.filePath,line:n+1,column:Math.max(1,M.index+1),ruleId:"eslint/no-empty-function",message:"Unexpected empty function",severity:"warning"})}}}return s}};var Bt={meta:{docs:"Disallow use of eval()",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\beval\s*\(/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.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 Qo=["Object","Array","String","Number","Boolean","Date","RegExp","Function","Math","JSON","Promise","Map","Set","WeakMap","WeakSet","Symbol","Proxy","Reflect","Error","TypeError","RangeError"],qt={meta:{docs:"Disallow extending native types",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];for(let g of Qo){let a=new RegExp(`\\b${g}\\.prototype\\.\\w+\\s*=`,"g"),M;for(M=a.exec(i);M!==null;M=a.exec(i)){if(i.substring(0,M.index).includes("//"))continue;s.push({filePath:R.filePath,line:n+1,column:Math.max(1,M.index+1),ruleId:"eslint/no-extend-native",message:`${g} prototype is read only, properties should not be added`,severity:"error"})}}}return s}};var zt={meta:{docs:"Disallow unnecessary boolean casts",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=[/\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 g){let M;for(M=a.exec(i);M!==null;M=a.exec(i)){if(i.substring(0,M.index).includes("//"))continue;s.push({filePath:R.filePath,line:n+1,column:Math.max(1,M.index+1),ruleId:"eslint/no-extra-boolean-cast",message:"Redundant Boolean call or double negation",severity:"error"})}}}return s},fix:(p)=>{let R=p;return R=R.replace(/\b(if|while)\s*\(\s*Boolean\s*\(([^)]+)\)\s*\)/g,"$1 ($2)"),R=R.replace(/!\s*Boolean\s*\(([^)]+)\)/g,"!$1"),R=R.replace(/!!\s*(\w+)/g,"$1"),R}};var el=["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"],Zt={meta:{docs:"Disallow assignment to native objects or read-only global variables",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];for(let g of el){let a=new RegExp(`\\b${g}\\s*=\\s*[^=]`,"g"),M;for(M=a.exec(i);M!==null;M=a.exec(i))if(!i.slice(M.index).match(new RegExp(`^${g}\\s*===?`)))s.push({filePath:R.filePath,line:n+1,column:M.index+1,ruleId:"eslint/no-global-assign",message:`Read-only global '${g}' should not be modified`,severity:"error"})}}return s}};var Gt={meta:{docs:"Disallow implied eval() via setTimeout/setInterval with strings",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\b(setTimeout|setInterval)\s*\(\s*(['"`])/g,a;while((a=g.exec(i))!==null){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.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 Vt={meta:{docs:"Disallow the use of the __iterator__ property",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/__iterator__/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.filePath,line:n+1,column:Math.max(1,a.index+1),ruleId:"eslint/no-iterator",message:"Reserved name '__iterator__'",severity:"error"})}}return s}};var Ye={meta:{docs:"Disallow if statements as the only statement in else blocks",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(/^\s*else\s*(?:\{\s*)?$/.test(i)){let a=n,M=i.includes("{");if(!M){if(n+1<c.length&&c[n+1].trim()==="{")a=n+1,M=!0}if(M)for(let v=a+1;v<c.length;v++){let A=c[v].trim();if(A===""||A.startsWith("//")||A.startsWith("/*"))continue;if(A==="}")break;if(A.startsWith("if ")||A.startsWith("if(")){let O=!0,_=0,U=!1;for(let B=v;B<c.length;B++){let q=c[B];if(_+=(q.match(/\{/g)||[]).length,_-=(q.match(/\}/g)||[]).length,B===v){U=!0;continue}if(_===0){for(let z=B+1;z<c.length;z++){let Z=c[z].trim();if(Z===""||Z.startsWith("//"))continue;if(Z==="}"||Z.startsWith("}"))break;else O=!1;break}break}}if(U&&O)s.push({filePath:R.filePath,line:v+1,column:Math.max(1,c[v].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:(p,R)=>{if(Ye.check(p,R).length===0)return p;return p}};var Kt={meta:{docs:"Disallow new operators outside of assignments or comparisons",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];if(/^\s*new\s+\w+\s*\(/.test(i)){if(!/[=:]/.test(i.substring(0,i.indexOf("new"))))s.push({filePath:R.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 Ht={meta:{docs:"Disallow new Function() declarations",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\bnew\s+Function\s*\(/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.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 Yt={meta:{docs:"Disallow new operators with String, Number, and Boolean",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\bnew\s+(String|Number|Boolean)\s*\(/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.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:(p)=>{let R=p.split(/\r?\n/),s=!1,c=R.map((n)=>{if(n.trim().startsWith("//")||n.trim().startsWith("/*"))return n;return n.replace(/\bnew\s+(String|Number|Boolean)\s*\(/g,(g,a)=>(s=!0,`${a}(`))});return s?c.join(`
|
|
7
|
-
`):p}};var Xt={meta:{docs:"Disallow octal literals",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\b0[0-7]+\b/g,a;for(a=g.exec(i);a!==null;a=g.exec(i))s.push({filePath:R.filePath,line:n+1,column:a.index+1,ruleId:"eslint/no-octal",message:"Octal literals should not be used",severity:"error"})}return s}};var Jt={meta:{docs:"Disallow reassignment of function parameters",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=new Map;for(let i=0;i<c.length;i++){let g=c[i],a=[...g.matchAll(/function\s+(?:(\w+)\s*)?\(([^)]*)\)/g),...g.matchAll(/(?:const|let|var)?\s*(\w+)\s*=\s*\(([^)]*)\)\s*=>/g),...g.matchAll(/(?:const|let|var)?\s*(\w+)\s*=\s*(\w+)\s*=>/g)];for(let M of a){let v=M[2]?M[2].split(",").map((O)=>O.trim().split(/[=:]/)[0].trim()):[],A=`line-${i}`;if(v.length>0)n.set(A,new Set(v.filter((O)=>O&&/^\w+$/.test(O))))}for(let[M,v]of n.entries())for(let A of v){let O=new RegExp(`\\b${A}\\s*=\\s*[^=]`,"g"),_;for(_=O.exec(g);_!==null;_=O.exec(g))if(!g.slice(_.index).match(/^\w+\s*===?/))s.push({filePath:R.filePath,line:i+1,column:_.index+1,ruleId:"eslint/no-param-reassign",message:`Assignment to function parameter '${A}'`,severity:"error"})}}return s}};var Qt={meta:{docs:"Disallow use of __proto__",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/__proto__/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.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:(p)=>{let R=p.split(/\r?\n/),s=!1,c=R.map((n)=>{if(n.trim().startsWith("//")||n.trim().startsWith("/*"))return n;return n.replace(/(\w+)\.__proto__/g,(g,a)=>(s=!0,`Object.getPrototypeOf(${a})`))});return s?c.join(`
|
|
8
|
-
`):p}};var en={meta:{docs:"Disallow assignment operators in return statements",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\breturn\s[^;]*\b\w+\s*=\s*(?!=)/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){let M=a[0];if(/===|==/.test(M))continue;if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.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 tn={meta:{docs:"Disallow comma operators",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\)\s*,\s*\w+\s*\(/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.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 nn={meta:{docs:"Disallow variable declarations from shadowing variables declared in the outer scope",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),i=[new Set];for(let g=0;g<c.length;g++){let a=c[g];if(a.match(/\bfunction\s+\w+\s*\(|=>\s*\{|\{\s*$/))i.push(new Set);let M=[...a.matchAll(/\b(const|let|var)\s+(\w+)/g),...a.matchAll(/function\s+(\w+)\s*\(/g)];for(let v of M){let A=v[2]||v[1];for(let O=0;O<i.length-1;O++)if(i[O].has(A)){s.push({filePath:R.filePath,line:g+1,column:1,ruleId:"eslint/no-shadow",message:`'${A}' is already declared in the upper scope`,severity:"error"});break}i[i.length-1].add(A)}if(a.match(/^\s*\}\s*$/)){if(i.length>1)i.pop()}}return s}};var sn={meta:{docs:"Disallow throwing literals as exceptions",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=[{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:M}of g){let v;while((v=a.exec(i))!==null){if(i.substring(0,v.index).includes("//"))continue;s.push({filePath:R.filePath,line:n+1,column:Math.max(1,v.index+1),ruleId:"eslint/no-throw-literal",message:`Expected an error object to be thrown, got ${M} literal`,severity:"error"})}}}return s}};var tl=new Set(["return","typeof","instanceof","in","of","new","delete","void","case","do","else","yield","await","throw"]);function On(p){return p>=97&&p<=122||p>=65&&p<=90||p>=48&&p<=57||p===95||p===36||p>=160}function Je(p){return p===`
|
|
9
|
-
`||p==="\r"||p==="\u2028"||p==="\u2029"}function nl(p,R){let s=R+1,c=!1;while(s<p.length){let n=p[s];if(Je(n))return-1;if(n==="\\"){if(Je(p[s+1]))return-1;s+=2;continue}if(c){if(n==="]")c=!1}else if(n==="[")c=!0;else if(n==="/"){s+=1;while(s<p.length&&On(p.charCodeAt(s)))s+=1;return s}s+=1}return-1}var Xe=null;function je(p){if(Xe!==null&&Xe.text===p)return Xe.result;let R=sl(p);return Xe={text:p,result:R},R}function sl(p){let R=[],s=[],c=p.length,n=[],i=-1,g="operator",a=0;if(p.startsWith("#!")){let A=2;while(A<c&&!Je(p[A]))A+=1;R.push({kind:"comment",start:2,end:A}),a=A}let M=(A)=>{if(n.length===0)i=A;n.push(-1)},v=()=>{let A=a;while(a<c){let O=p[a];if(O==="\\"){a+=2;continue}if(O==="`"){if(R.push({kind:"template",start:A,end:a}),n.pop(),n.length===0)s.push([i,a]);a+=1,g="value";return}if(O==="$"&&p[a+1]==="{"){R.push({kind:"template",start:A,end:a}),n.push(0),a+=2,g="operator";return}a+=1}a=Math.min(a,c),R.push({kind:"template",start:A,end:a}),n.length=0,s.push([i,c])};while(a<c){if(n.length>0&&n[n.length-1]===-1){v();continue}let A=p[a],O=p[a+1];if(A==="/"&&O==="/"){let _=a+2;while(_<c&&!Je(p[_]))_+=1;R.push({kind:"comment",start:a+2,end:_}),a=_;continue}if(A==="/"&&O==="*"){let _=p.indexOf("*/",a+2),U=_<0?c:_;R.push({kind:"comment",start:a+2,end:U}),a=_<0?c:_+2;continue}if(A==="'"||A==='"'){let _=a+1,U=_;while(U<c){let B=p[U];if(B==="\\"){U+=p[U+1]==="\r"&&p[U+2]===`
|
|
10
|
-
`?3:2;continue}if(B===A||Je(B))break;U+=1}U=Math.min(U,c),R.push({kind:"string",start:_,end:U}),a=p[U]===A?U+1:U,g="value";continue}if(A==="`"){M(a),a+=1;continue}if(A==="/"){let _=g==="operator"?nl(p,a):-1;if(_>0){let U=_;while(U>a&&p[U-1]!=="/")U-=1;R.push({kind:"regex",start:a+1,end:U-1}),a=_,g="value";continue}a+=1,g="operator";continue}if(n.length>0){if(A==="{"){n[n.length-1]+=1,a+=1,g="operator";continue}if(A==="}"){let _=n[n.length-1];if(_>0)n[n.length-1]=_-1,g="operator";else n.pop();a+=1;continue}}if(On(p.charCodeAt(a))){let _=a+1;while(_<c&&On(p.charCodeAt(_)))_+=1;let U=p.slice(a,_);g=tl.has(U)?"operator":"value",a=_;continue}if(A===")"||A==="]")g="value";else if(!(A===" "||A>="\t"&&A<="\r"))g="operator";a+=1}return{regions:R,templates:s}}function rn(p,R={comments:!0},s=je(p)){let c=new Set;if(R.comments)c.add("comment");if(R.strings)c.add("string");if(R.templates)c.add("template");if(R.regex)c.add("regex");if(c.size===0)return p;let n=(R.comments?1:0)|(R.strings?2:0)|(R.templates?4:0)|(R.regex?8:0),i=_n.get(n);if(i!==void 0&&i.text===p)return i.masked;let g=il(p,c,s);return _n.set(n,{text:p,masked:g}),g}var _n=new Map;function es(){Xe=null,_n.clear()}function il(p,R,s){let c="",n=0;for(let i of s.regions){if(!R.has(i.kind))continue;let g=Math.max(i.start,n),a=Math.min(i.end,p.length);if(g>=a)continue;c+=p.slice(n,g)+ol(p.slice(g,a)),n=a}return n===0?p:c+p.slice(n)}var rl=/[^\n\r\u2028\u2029]/g;function ol(p){return p.replace(rl," ")}function ts(p){return rn(p,{comments:!0})}function _e(p){return rn(p,{comments:!0,strings:!0,templates:!0,regex:!0})}function on(p,R=je(p)){let s=[0];for(let g=p.indexOf(`
|
|
11
|
-
`);g!==-1;g=p.indexOf(`
|
|
12
|
-
`,g+1))s.push(g+1);let c=Array.from({length:s.length}).fill(!1),n=R.regions.filter((g)=>g.kind==="template"),i=0;for(let g=0;g<s.length;g+=1){let a=s[g];while(i<n.length&&n[i].end<a)i+=1;let M=n[i];c[g]=M!==void 0&&M.start<=a&&a<=M.end&&a>0}return c}var ln={meta:{docs:"Disallow the use of variables before they are defined",recommended:!1},check:(p,R)=>{let s=[],c=_e(p).split(/\r?\n/),n=new Map;for(let i=0;i<c.length;i++){let g=c[i],a=[...g.matchAll(/\b(const|let|var)\s+(\w+)/g),...g.matchAll(/\bfunction\s+(\w+)\s*\(/g),...g.matchAll(/\bclass\s+(\w+)/g)];for(let M of a){let v=M[2]||M[1];if(!n.has(v))n.set(v,i+1)}}for(let i=0;i<c.length;i++){let g=c[i];if(g.match(/\b(const|let|var|function|class)\s+\w+/))continue;let a=g.matchAll(/\b(\w+)\b/g);for(let M of a){let v=M[1],A=n.get(v);if(A&&A>i+1)s.push({filePath:R.filePath,line:i+1,column:M.index+1,ruleId:"eslint/no-use-before-define",message:`'${v}' was used before it was defined`,severity:"error"})}}return s}};var cn={meta:{docs:"Disallow unnecessary .call() and .apply()",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\.\s*call\s*\(\s*(undefined|null)\s*,/g,a=/\.\s*apply\s*\(\s*(undefined|null)\s*,/g,M;for(M=g.exec(i);M!==null;M=g.exec(i))s.push({filePath:R.filePath,line:n+1,column:M.index+1,ruleId:"eslint/no-useless-call",message:"Unnecessary '.call()'",severity:"error"});for(M=a.exec(i);M!==null;M=a.exec(i))s.push({filePath:R.filePath,line:n+1,column:M.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:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=[/(['"`])([^'"`]*)\1\s*\+\s*\1([^'"`]*)\1/g];for(let a of g){let M;while((M=a.exec(i))!==null){if(i.substring(0,M.index).includes("//"))continue;s.push({filePath:R.filePath,line:n+1,column:Math.max(1,M.index+1),ruleId:"eslint/no-useless-concat",message:"Unexpected string concatenation of literals",severity:"warning"})}}}return s},fix:(p)=>{let R=p;return R=R.replace(/(['"`])([^'"`]*)\1\s*\+\s*\1([^'"`]*)\1/g,"$1$2$3$1"),R}};var ns=["/","(",")","[","]","{","}","<",">",":","@","#","$","%","&","=","+","-","*","?","!",";",",","|","~","`","^"],un={meta:{docs:"Disallow unnecessary escape characters",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];for(let g of ns){let a=`\\${g}`,M=new RegExp(`(['"\`])[^'"\`]*${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`,"g"),v;while((v=M.exec(i))!==null){let A=v.index,O=i.indexOf(a,A);if(O>A)s.push({filePath:R.filePath,line:n+1,column:Math.max(1,O+1),ruleId:"eslint/no-useless-escape",message:`Unnecessary escape character: \\${g}`,severity:"warning"})}}}return s},fix:(p)=>{let R=p;for(let s of ns){let c=`\\${s}`;R=R.replace(new RegExp(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),s)}return R}};var fn={meta:{docs:"Disallow renaming import, export, and destructured assignments to the same name",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/import\s*\{[^}]*\b(\w+)\s+as\s+\1\b[^}]*\}/g,a;for(a=g.exec(i);a!==null;a=g.exec(i))s.push({filePath:R.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 M=/export\s*\{[^}]*\b(\w+)\s+as\s+\1\b[^}]*\}/g;for(a=M.exec(i);a!==null;a=M.exec(i))s.push({filePath:R.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 v=/\{[^}]*\b(\w+)\s*:\s*\1\b[^}]*\}\s*=/g;for(a=v.exec(i);a!==null;a=v.exec(i))s.push({filePath:R.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:(p)=>{let R=p;return R=R.replace(/\b(\w+)\s+as\s+\1\b/g,"$1"),R=R.replace(/\{([^}]*)\b(\w+)\s*:\s*\2\b([^}]*)\}/g,"{$1$2$3}"),R}};var Qe={meta:{docs:"Disallow redundant return statements",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(g==="return"||g==="return;"){let a=!1;for(let M=n+1;M<c.length;M++){let v=c[M].trim();if(v===""||v.startsWith("//")||v.startsWith("/*"))continue;if(v==="}"||v.startsWith("}"))a=!0;break}if(a)s.push({filePath:R.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:(p,R)=>{let s=Qe.check(p,R);if(s.length===0)return p;let c=p.split(/\r?\n/),n=new Set(s.map((g)=>g.line-1));return c.filter((g,a)=>!n.has(a)).join(`
|
|
13
|
-
`)}};var mn={meta:{docs:"Require let or const instead of var",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\bvar\s+/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.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:(p,R)=>p.split(/\r?\n/).map((n)=>{if(n.trim().startsWith("//")||n.trim().startsWith("/*"))return n;return n.replace(/\bvar\s+/g,"let ")}).join(`
|
|
14
|
-
`)};var pn={meta:{docs:"Disallow with statements",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\bwith\s*\(/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.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:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=/\.(map|filter|reduce|forEach|some|every|find|findIndex)\s*\(\s*function\s*\(/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){if(i.substring(0,a.index).includes("//"))continue;s.push({filePath:R.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:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++)if(c[n].match(/\basync\s+(?:function\s+\w+|(?:\(|\w+)\s*(?:\(|=>))/)){let a=!1,M=0,v=!1,A=n;while(A<c.length){let O=c[A];for(let _ of O){if(_==="{")M++,v=!0;if(_==="}"){if(M--,M===0&&v)break}}if(O.match(/\bawait\s+/))a=!0;if(M===0&&v){if(!a)s.push({filePath:R.filePath,line:n+1,column:1,ruleId:"eslint/require-await",message:"Async function has no await expression",severity:"error"});break}A++}}return s}};var ss={name:"eslint",rules:{"array-callback-return":e(ot),"constructor-super":e(lt),"for-direction":e(ct),"getter-return":e(at),"no-async-promise-executor":e(ut),"no-compare-neg-zero":e(ft),"no-cond-assign":e(mt),"no-constant-condition":e(dt),"no-const-assign":e(pt),"no-dupe-class-members":e(ht),"no-dupe-keys":e(Ke),"no-duplicate-case":e(gt),"no-empty-pattern":e(bt),"no-fallthrough":e(yt),"no-loss-of-precision":e(xt),"no-promise-executor-return":e(Rt),"no-redeclare":e(wt),"no-self-assign":e(He),"no-self-compare":e(kt),"no-sparse-arrays":e(It),"no-undef":e(Pt),"no-unsafe-negation":e(vt),"no-unreachable":e(Mt),"no-useless-catch":e($t),"use-isnan":e(Ct),"valid-typeof":e(Lt),"default-case":e(Et),eqeqeq:e(At),"no-alert":e(Tt),"no-await-in-loop":e(Wt),"no-caller":e(Nt),"no-case-declarations":e(Dt),"no-else-return":e(jt),"no-empty":e(Ut),"no-empty-function":e(Ft),"no-eval":e(Bt),"no-extend-native":e(qt),"no-global-assign":e(Zt),"no-implied-eval":e(Gt),"no-iterator":e(Vt),"no-new":e(Kt),"no-new-func":e(Ht),"no-new-wrappers":e(Yt),"no-octal":e(Xt),"no-param-reassign":e(Jt),"no-proto":e(Qt),"no-return-assign":e(en),"no-shadow":e(nn),"no-throw-literal":e(sn),"no-use-before-define":e(ln),"no-useless-call":e(cn),"no-with":e(pn),"require-await":e(hn),complexity:e(St),"max-depth":e(Ot),"max-lines-per-function":e(_t),"no-extra-boolean-cast":e(zt),"no-lonely-if":e(Ye),"no-sequences":e(tn),"no-useless-concat":e(an),"no-useless-escape":e(un),"no-useless-rename":e(fn),"no-useless-return":e(Qe),"no-var":e(mn),"prefer-arrow-callback":e(dn)}};var is={meta:{docs:"Disallow return statements in constructors - constructors automatically return the instance"},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.indexOf("//");if(!(g>=0?i.slice(0,g):i).match(/\bconstructor\s*\(/))continue;let v=0,A=!1,O=-1;for(let _=n;_<c.length;_++){let U=c[_],B=null,q=!1;for(let z=0;z<U.length;z++){let Z=U[z];if(q){q=!1;continue}if(Z==="\\"&&B){q=!0;continue}if(!B){if(Z==="'")B="single";else if(Z==='"')B="double";else if(Z==="`")B="template";else if(Z==="{")v++,A=!0;else if(Z==="}"){if(v--,A&&v===0){O=_;break}}}else if(B==="single"&&Z==="'"||B==="double"&&Z==='"'||B==="template"&&Z==="`")B=null}if(O!==-1)break}if(O===-1)continue;for(let _=n;_<=O;_++){let U=c[_];if(_===n)continue;if(/^\s*\/\//.test(U))continue;let B=U.indexOf("//"),q=B>=0?U.slice(0,B):U;if(q=q.replace(/(['"`])(?:(?!\1)[^\\]|\\.)*?\1/g,'""'),q.match(/\breturn\b/)){let Z=q.indexOf("return"),G=Z>0?q[Z-1]:" ",X=Z+6<q.length?q[Z+6]:" ";if(/\w/.test(G)||/\w/.test(X))continue;let V=q.slice(Z+6).trim();if(V.startsWith("this;")||V==="this")continue;if(V===";"||V==="")continue;let K=U.indexOf("return");s.push({filePath:R.filePath,line:_+1,column:K+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 rs={meta:{docs:"Disallow irregular whitespace characters that may cause issues in code"},check:(p,R)=>{let s=[],c=/[\u00A0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/g,n=p.split(/\r?\n/);for(let i=0;i<n.length;i++){let g=n[i],a;c.lastIndex=0;while((a=c.exec(g))!==null){let v=a[0].charCodeAt(0),A="irregular whitespace",O={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(O[v])A=O[v];s.push({filePath:R.filePath,line:i+1,column:a.index+1,ruleId:"no-irregular-whitespace",message:`Irregular whitespace detected: ${A} (U+${v.toString(16).toUpperCase().padStart(4,"0")})`,severity:"error",help:"Replace irregular whitespace with regular spaces or tabs"})}}return s},fix:(p)=>p.replace(/[\u00A0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/g," ")};var os={meta:{docs:"Disallow new operators outside of assignments or comparisons",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(g.startsWith("//")||g.startsWith("/*")||g.startsWith("*"))continue;if(/^\s*new\s+\w+/.test(i)){let M=/^\s*(?:const|let|var|this\.\w+)\s*=\s*new\s+/,v=/^\s*return\s+new\s+/,A=new RegExp("^\\s*new\\s+\\w[^;]*,"),O=/[=:,(]\s*new\s+/;if(!M.test(i)&&!v.test(i)&&!A.test(i)&&!O.test(g)){let _=i.search(/new\s+/)+1;s.push({filePath:R.filePath,line:n+1,column:_,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 ls={meta:{docs:"Disallow multiple spaces in regular expressions",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];if(/^\s*\/\//.test(i))continue;let g=/\/(?![*/])((?:\\.|[^/\\])+)\/[gimsuvy]*/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){let v=a[1];if(/ {2,}/.test(v)){let A=a.index+1;s.push({filePath:R.filePath,line:n+1,column:A,ruleId:"no-regex-spaces",message:"Multiple spaces in regular expression",severity:"error",help:"Use quantifiers like {2} instead of multiple spaces for clarity."})}}let M=/new\s+RegExp\s*\(\s*['"`]([^'"`]+)['"`]/g;for(a=M.exec(i);a!==null;a=M.exec(i)){let v=a[1];if(/ {2,}/.test(v)){let A=a.index+1;s.push({filePath:R.filePath,line:n+1,column:A,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 cs=new Set(["|","&",":",",","<"]);function as(p){return ts(p)}function gn(p,R){if(p[R+1]==="/"||p[R+1]==="*")return!1;let s=p.slice(0,R).trimEnd();return!s||/[=([{,:;!&|?]$/.test(s)||s.endsWith("=>")||s.endsWith("return")}var Te={meta:{docs:"Report variables and parameters that are declared/assigned but never used"},check:(p,R)=>{if(R.filePath.endsWith("/no-unused-vars.ts"))return[];if(R.filePath.endsWith(".d.ts"))return[];let s=[],c=R.options||{},n=typeof c.varsIgnorePattern==="string"?c.varsIgnorePattern:"^_",i=typeof c.argsIgnorePattern==="string"?c.argsIgnorePattern:"^_",g=new RegExp(n,"u"),a=new RegExp(i,"u"),M=je(p),v=rn(p,{comments:!0},M),A=v.split(/\r?\n/),O=v,_=on(p,M),U=null,B=[],q=(H,re)=>{let se=new RegExp(`\\b${H}\\b`,"g");if(H.includes("$"))return se.test(`${A.slice(0,re).join(`
|
|
15
|
-
`)}
|
|
16
|
-
${A.slice(re+1).join(`
|
|
17
|
-
`)}`);if(U===null){U=A.join(`
|
|
18
|
-
`),B=Array.from({length:A.length});let te=0;for(let fe=0;fe<A.length;fe++)B[fe]=te,te+=A[fe].length+1}let ne=B[re],le=ne+A[re].length;for(let te=se.exec(U);te!==null;te=se.exec(U)){if(te.index<ne||te.index>=le)return!0;if(te[0].length===0)se.lastIndex++}return!1},z=new RegExp("^\\s*(?:const|let|var)\\s+(.+?);?\\s*$");for(let H=0;H<A.length;H++){if(_[H])continue;let re=A[H],se=re.match(z);if(!se)continue;let ne=se[1],le=[],te="",fe=0,oe=0,ae=null,be=!1;for(let Q=0;Q<ne.length;Q++){let Y=ne[Q];if(be){be=!1,te+=Y;continue}if(Y==="\\"&&ae){be=!0,te+=Y;continue}if(!ae){if(Y==="/"&&ne[Q+1]==="/")break;if(Y==="/"&&ne[Q+1]==="*"){Q+=2;while(Q<ne.length&&!(ne[Q]==="*"&&ne[Q+1]==="/"))Q++;Q++;continue}if(Y==="'")ae="single";else if(Y==='"')ae="double";else if(Y==="`")ae="template";else if(Y==="<")oe++;else if(Y===">")oe--;else if(Y==="("||Y==="["||Y==="{")fe++;else if(Y===")"||Y==="]"||Y==="}")fe--;else if(Y===","&&fe===0&&oe===0){le.push(te),te="";continue}}else if(ae==="single"&&Y==="'"||ae==="double"&&Y==='"'||ae==="template"&&Y==="`")ae=null;te+=Y}if(te)le.push(te);for(let Q of le){let Y=Q.trim();if(!Y)continue;let ce=Y.match(/^([$A-Z_][\w$]*)/i),ee=[];if(ce)ee.push(ce[1]);else if(Y.startsWith("{")||Y.startsWith("[")){let J=Y[0],he=J==="{"?"}":"]",Re=0,pe=-1,Pe=null,Me=!1;for(let ke=0;ke<Y.length;ke++){let $e=Y[ke];if(Me){Me=!1;continue}if($e==="\\"&&Pe){Me=!0;continue}if(!Pe){if($e==="'"||$e==='"'||$e==="`")Pe=$e==="'"?"single":$e==='"'?"double":"template";else if($e===J)Re++;else if($e===he){if(Re--,Re===0){pe=ke;break}}}else if(Pe==="single"&&$e==="'"||Pe==="double"&&$e==='"'||Pe==="template"&&$e==="`")Pe=null}if(pe>0){let ke=Y.slice(1,pe),$e=[],we="",ve=0,de=null,ye=!1;for(let xe=0;xe<ke.length;xe++){let ge=ke[xe];if(ye){ye=!1,we+=ge;continue}if(ge==="\\"&&de){ye=!0,we+=ge;continue}if(!de){if(ge==="'"||ge==='"'||ge==="`"){de=ge==="'"?"single":ge==='"'?"double":"template",we+=ge;continue}if(ge==="("||ge==="{"||ge==="[")ve++;if(ge===")"||ge==="}"||ge==="]")ve--;if(ge===","&&ve===0){$e.push(we.trim()),we="";continue}}else if(de==="single"&&ge==="'"||de==="double"&&ge==='"'||de==="template"&&ge==="`")de=null;we+=ge}if(we.trim())$e.push(we.trim());for(let xe of $e){if(xe.startsWith("...")){let Se=xe.slice(3).match(/^([$A-Z_][\w$]*)/i);if(Se)ee.push(Se[1]);continue}let ge=xe.indexOf(":");if(ge!==-1){let Se=xe.slice(ge+1).trim(),Le=0;for(let Oe=0;Oe<Se.length;Oe++){let Ee=Se[Oe];if(Ee==="("||Ee==="{"||Ee==="[")Le++;else if(Ee===")"||Ee==="}"||Ee==="]")Le--;else if(Ee==="="&&Le===0){Se=Se.slice(0,Oe).trim();break}}let Ve=Se.match(/^([$A-Z_][\w$]*)/i);if(Ve)ee.push(Ve[1])}else{let Se=xe,Le=0;for(let Oe=0;Oe<Se.length;Oe++){let Ee=Se[Oe];if(Ee==="("||Ee==="{"||Ee==="[")Le++;else if(Ee===")"||Ee==="}"||Ee==="]")Le--;else if(Ee==="="&&Le===0){Se=Se.slice(0,Oe).trim();break}}let Ve=Se.match(/^([$A-Z_][\w$]*)/i);if(Ve)ee.push(Ve[1])}}}}for(let J of ee){if(g.test(J))continue;if(!q(J,H))s.push({filePath:R.filePath,line:H+1,column:Math.max(1,re.indexOf(J)+1),ruleId:"pickier/no-unused-vars",message:`'${J}' 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 (_${J}) to mark it as intentionally unused`})}}}let Z=(H)=>{let se=((te)=>{let fe="",oe=null,ae=!1,be=0;for(let Q=0;Q<te.length;Q++){let Y=te[Q];if(ae){ae=!1;continue}if(Y==="\\"&&oe){ae=!0;continue}if(!oe){if(Y==="'")oe="single";else if(Y==='"')oe="double";else if(Y==="`")oe="template";else if(Y==="("||Y==="{"||Y==="[")be++;else if(Y===")"||Y==="}"||Y==="]")be--;else if(Y==="="&&be===0)return fe}else if(oe==="single"&&Y==="'"||oe==="double"&&Y==='"'||oe==="template"&&Y==="`")oe=null;fe+=Y}return fe})(H);return((te)=>{let fe="",oe=0;while(oe<te.length){let ae=te[oe];if(ae===":"){oe++;while(oe<te.length&&/\s/.test(te[oe]))oe++;let be=0,Q=0,Y=null,ce=!1;while(oe<te.length){let ee=te[oe];if(ce){ce=!1,oe++;continue}if(ee==="\\"&&Y){ce=!0,oe++;continue}if(!Y){if(ee==="'")Y="single";else if(ee==='"')Y="double";else if(ee==="`")Y="template";else if(ee==="<")Q++;else if(ee===">")Q--;else if(ee==="("||ee==="{"||ee==="[")be++;else if(ee===")"||ee==="}"||ee==="]")if(be>0)be--;else break;else if(ee===","&&be===0&&Q===0)break}else if(Y==="single"&&ee==="'"||Y==="double"&&ee==='"'||Y==="template"&&ee==="`")Y=null;oe++}continue}fe+=ae,oe++}return fe})(se).split(/[^$\w]+/).filter((te)=>te&&te!=="undefined")},G=(H,re)=>{let se=/^\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 ne=H;ne<A.length;ne++){let te=(ne===H?A[ne].slice(re+1):A[ne]).replace(/\/\/.*$/,"");if(ne!==H&&se.test(te))return!0;if(te.includes("{"))return!1;if(te.includes(";"))return!0}return!0},X=(H,re)=>{let se=!1,ne=0,le=0,te=!1,fe=0,oe=null,ae=!1,be=!0,Q="",Y=!1,ce=!1,ee=[],J=!1;for(let he=H;he<A.length;he++){let Re=A[he],pe=Re,Pe=ee.length>0&&ee[ee.length-1]===-1,Me=-1,ke=null,$e=!1;if(!Pe)for(let de=0;de<Re.length-1;de++){let ye=Re[de],xe=Re[de+1];if($e){$e=!1;continue}if(ye==="\\"&&ke){$e=!0;continue}if(!ke){if(ye==="'")ke="single";else if(ye==='"')ke="double";else if(ye==="`")ke="template";else if(ye==="/"&&xe==="/"){Me=de;break}}else if(ke==="single"&&ye==="'"||ke==="double"&&ye==='"'||ke==="template"&&ye==="`")ke=null}if(Me>=0)pe=Re.slice(0,Me);let we=(de)=>{let ye="",xe=0,ge=null,Se=!1;while(xe<de.length){let Le=de[xe];if(Se){Se=!1,ye+=Le,xe++;continue}if(Le==="\\"&&ge){Se=!0,ye+=Le,xe++;continue}if(!ge){if(Le==="'")ge="single";else if(Le==='"')ge="double";else if(Le==="`")ge="template";else if(Le==="/"){if(gn(de,xe)){xe++;while(xe<de.length){if(de[xe]==="\\"){xe+=2;continue}if(de[xe]==="/"){xe++;while(xe<de.length&&/[gimsuvy]/.test(de[xe]))xe++;break}xe++}continue}}}else if(ge==="single"&&Le==="'"||ge==="double"&&Le==='"'||ge==="template"&&Le==="`")ge=null;ye+=Le,xe++}return ye};if(!Pe)pe=we(pe);let ve=0;if(!se){let de=-1,ye=be?typeof re==="number"?re:0:0;if(be=!1,ye>=pe.length){let xe=pe.indexOf("=>");ye=xe>=0?xe+2:0}for(let xe=ye;xe<pe.length;xe++){let ge=pe[xe];if(ae){ae=!1;continue}if(ge==="\\"&&oe){ae=!0;continue}if(!oe){if(ge!==" "&&ge!=="\t"&&ge!==`
|
|
19
|
-
`&&ge!=="\r"&&ge!=="{"&&ge!=="}"&&le===0)Q=ge;if(ge==="'")oe="single";else if(ge==='"')oe="double";else if(ge==="`")oe="template";else if(ge==="<")fe++;else if(ge===">")fe=Math.max(0,fe-1);else if(ge==="{"){if(le===0){if(te&&fe===0&&!cs.has(Q)){de=xe;break}}le++}else if(ge==="}"){if(le>0){if(le--,le===0)te=!0,Q="}"}}}else if(oe==="single"&&ge==="'"||oe==="double"&&ge==='"'||oe==="template"&&ge==="`")oe=null}if(de===-1){if(fe>0)continue;if(le>0&&cs.has(Q))continue;for(let xe=ye;xe<pe.length;xe++)if(pe[xe]==="{"&&!oe){de=xe;break}}if(de===-1)continue;se=!0,ne=1,ve=de+1,H=he}for(let de=ve;de<pe.length;de++){let ye=pe[de];if(J){J=!1;continue}let xe=ee.length>0&&ee[ee.length-1]===-1,ge=ee.length>0&&ee[ee.length-1]>=0;if(ye==="\\"&&(Y||ce||xe)){J=!0;continue}if(Y){if(ye==="'")Y=!1;continue}if(ce){if(ye==='"')ce=!1;continue}if(xe){if(ye==="`")ee.pop();else if(ye==="$"&&de+1<pe.length&&pe[de+1]==="{")ee[ee.length-1]=0,de++;continue}if(ge){if(ye==="/"){if(gn(pe,de)){de++;while(de<pe.length){if(pe[de]==="\\"){de+=2;continue}if(pe[de]==="/"){while(de+1<pe.length&&/[gimsuvy]/.test(pe[de+1]))de++;break}de++}continue}}if(ye==="`"){ee.push(-1);continue}if(ye==="'"){Y=!0;continue}if(ye==='"'){ce=!0;continue}if(ye==="{"){ee[ee.length-1]++;continue}if(ye==="}")if(ee[ee.length-1]>0)ee[ee.length-1]--;else ee[ee.length-1]=-1;continue}if(ye==="'")Y=!0;else if(ye==='"')ce=!0;else if(ye==="`")ee.push(-1);else if(ye==="{")ne++;else if(ye==="}"){if(ne--,ne===0)return{from:H,to:he}}}}return null},V=(H,re)=>{let se={parenDepth:0,braceDepth:0,bracketDepth:0,inTemplate:!1},ne=(Q)=>{for(let Y=0;Y<Q.length;Y++){let ce=Q[Y];if(ce==="`")se.inTemplate=!se.inTemplate;else if(ce==="(")se.parenDepth++;else if(ce===")")se.parenDepth--;else if(ce==="{")se.braceDepth++;else if(ce==="}")se.braceDepth--;else if(ce==="[")se.bracketDepth++;else if(ce==="]")se.bracketDepth--}},le=()=>se.parenDepth>0||se.braceDepth>0||se.bracketDepth>0||se.inTemplate,te=(Q)=>/(?:\?|:|\.|,|&&|\|\||\?\?|\+|-|\*|\/|%|\*\*)$/.test(Q.trimEnd()),fe=(Q)=>/^(?:\?|:|\.|,|&&|\|\||\?\?|\+|-|\*|\/|%|\*\*)/.test(Q.trimStart()),oe=A[H].slice(re+2);ne(oe);let ae=oe.trim()!=="",be=H+1;while(be<A.length){let Q=be===H+1?oe:A[be-1];if(!(!ae||le()||te(Q)||fe(A[be])))break;oe+=`
|
|
20
|
-
${A[be]}`,ae||=A[be].trim()!=="",ne(A[be]),be++}return oe},K=[],ie=!1,ue=!1,me=!1;for(let H=0;H<A.length;H++){let re=A[H];if(/^\s*\/\//.test(re))continue;if(_[H])continue;let se=re,ne=null,le=!1,te=!1;for(let ce=0;ce<re.length-1;ce++){let ee=re[ce],J=re[ce+1];if(te){te=!1;continue}if(ee==="\\"&&(ne||le)){te=!0;continue}if(!ne&&!le){if(ee==="'")ne="single";else if(ee==='"')ne="double";else if(ee==="`")ne="template";else if(ee==="/"){if(gn(re,ce))le=!0;else if(J==="/"){se=re.slice(0,ce);break}}}else if(ne){if(ne==="single"&&ee==="'"||ne==="double"&&ee==='"'||ne==="template"&&ee==="`")ne=null}else if(le&&ee==="/")le=!1}let ae=((ce)=>{let ee="",J=0;while(J<ce.length){if(ce[J]==="/"){if(gn(ce,J)){J++;while(J<ce.length){if(ce[J]==="\\"){J+=2;continue}if(ce[J]==="/"){J++;while(J<ce.length&&/[gimsuvy]/.test(ce[J]))J++;break}J++}continue}}ee+=ce[J],J++}return ee})(se).replace(/'(?:[^'\\]|\\.)*'/g,"''").replace(/"(?:[^"\\]|\\.)*"/g,'""');if(!(!me&&!ie&&!ue&&K.length===0&&!ae.includes("`")&&!ae.includes("'")&&!ae.includes('"'))){let ce="";for(let ee=0;ee<ae.length;ee++){let J=ae[ee];if(me){me=!1;let pe=K.length>0&&K[K.length-1]===-1;ce+=pe?" ":J;continue}let he=K.length>0&&K[K.length-1]===-1,Re=K.length>0&&K[K.length-1]>=0;if(J==="\\"&&(ie||ue||he)){me=!0,ce+=he?" ":J;continue}if(ie){if(J==="'")ie=!1;ce+=J;continue}if(ue){if(J==='"')ue=!1;ce+=J;continue}if(he){if(J==="`")K.pop();else if(J==="$"&&ee+1<ae.length&&ae[ee+1]==="{")K[K.length-1]=0,ce+=" ",ee++;else ce+=" ";continue}if(Re){if(J==="`")K.push(-1),ce+=" ";else if(J==="'")ie=!0,ce+=J;else if(J==='"')ue=!0,ce+=J;else if(J==="{")K[K.length-1]++,ce+=J;else if(J==="}")if(K[K.length-1]>0)K[K.length-1]--,ce+=J;else K[K.length-1]=-1,ce+=" ";else ce+=J;continue}if(J==="`")K.push(-1),ce+=" ";else if(J==="'")ie=!0,ce+=J;else if(J==='"')ue=!0,ce+=J;else ce+=J}ae=ce}let Q=ae.match(/\bfunction\b/);if(Q){if(re.includes("function scanContent")||re.includes("function findMatching"))continue;if(ae.slice(Q.index+8).trimStart().startsWith(":"))continue;let ee=ae.slice(0,Q.index).trimEnd();if(ee.endsWith(".")||ee.endsWith("?."))continue;let J=Q.index,he=re.indexOf("(",J);if(he===-1)continue;let Re=0,pe=-1,Pe=H,Me="";for(let ve=H;ve<A.length;ve++){let de=ve===H?A[ve]:A[ve],ye=ve===H?he:0;for(let xe=ye;xe<de.length;xe++)if(de[xe]==="(")Re++;else if(de[xe]===")"){if(Re--,Re===0){if(pe=xe,Pe=ve,H===ve)Me=re.slice(he+1,pe);else{Me=re.slice(he+1);for(let ge=H+1;ge<ve;ge++)Me+=` ${A[ge]}`;Me+=` ${de.slice(0,pe)}`}break}}if(pe!==-1)break}if(pe===-1)continue;if(G(Pe,pe))continue;let ke=Z(Me),$e=X(Pe,pe),we="";if($e)if($e.from===Pe){let ve=A[$e.from],de=ve.lastIndexOf("{"),ye=de>=0?ve.slice(de+1):"";if($e.to>$e.from)we=`${ye}
|
|
21
|
-
${A.slice($e.from+1,$e.to+1).join(`
|
|
22
|
-
`)}`;else we=ye}else we=A.slice($e.from,$e.to+1).join(`
|
|
23
|
-
`);for(let ve of ke){if(!ve||a.test(ve)||ve==="undefined")continue;if(!new RegExp(`\\b${ve}\\b`,"g").test(we))s.push({filePath:R.filePath,line:H+1,column:Math.max(1,re.indexOf(ve)+1),ruleId:"pickier/no-unused-vars",message:`'${ve}' is defined but never used (function parameter). Allowed unused args must match pattern: ${i}`,severity:"error"})}continue}let Y=re.indexOf("=>");if(Y!==-1&&ae.includes("=>")){let ce=-1;for(let ee=Y-1;ee>=0;ee--){let J=re[ee];if(J===")"){ce=ee;break}if(J!==" "&&J!=="\t"&&J!==`
|
|
24
|
-
`&&J!==":"&&J!==">"&&!/\w/.test(J))break}if(ce!==-1){let ee=-1,J=1;for(let he=ce-1;he>=0;he--){let Re=re[he];if(Re===")")J++;else if(Re==="("){if(J--,J===0){ee=he;break}}}if(ee!==-1){let he=!1,Re=0,pe=0;for(let Me=ee-1;Me>=0;Me--){let ke=re[Me];if(ke===">"){Re++;continue}if(ke==="<"){if(Re>0){Re--;continue}if(pe<=0){he=!0;break}continue}if(ke===":"&&Re===0&&pe<=0){he=!0;break}if(Re>0)continue;if(ke===",")continue;if(ke===")"){pe++;continue}if(ke==="("){pe--;continue}if(ke==="|"||ke==="&"){he=!0;break}if(ke==="="||ke==="{"||ke==="["){if(pe>=0)break;continue}if(ke!==" "&&ke!=="\t"&&!/[\w.]/.test(ke)){if(pe>=0)break}}if(!he){let Me=re.slice(0,ee);if(/^\s*(?:export\s+)?(?:declare\s+)?type\s+\w[\w$]*\s*(?:<[^>]*>)?\s*=\s*$/.test(Me))he=!0;else if(/\bas\s+$/.test(Me))he=!0}if(he)continue;let Pe=re.slice(ee+1,ce);if(!(Pe.trim()===""&&re.slice(Math.max(0,ee-10),ee).includes("async"))){let Me=Z(Pe);if(Me.length>0){let ke="";if(re.slice(Y+2).trimStart().startsWith("{")){let we=X(H,Y);if(we)if(we.from===H){let ve=A[we.from],de=ve.indexOf("{",Y),ye=de>=0?ve.slice(de+1):"";if(we.to>we.from)ke=`${ye}
|
|
25
|
-
${A.slice(we.from+1,we.to+1).join(`
|
|
26
|
-
`)}`;else ke=ye}else ke=A.slice(we.from,we.to+1).join(`
|
|
27
|
-
`)}else ke=V(H,Y);for(let we of Me){if(!we||a.test(we)||we==="undefined")continue;if(!new RegExp(`\\b${we}\\b`,"g").test(ke))s.push({filePath:R.filePath,line:H+1,column:Math.max(1,re.indexOf(we)+1),ruleId:"pickier/no-unused-vars",message:`'${we}' is defined but never used (function parameter). Allowed unused args must match pattern: ${i}`,severity:"error"})}continue}}}}}{let ce=/(?:^|[=,:({\s])\s*([$A-Z_][\w$]*)\s*=>/gi,ee;while((ee=ce.exec(ae))!==null){let J=ee[1];if(!J||a.test(J)||J==="undefined")continue;let he=ae.slice(0,ee.index+ee[0].indexOf(J)).trimEnd();if(/\)\s*:$/.test(he)||/\)\s*:\s*$/.test(he))continue;if(/\)\s*:\s*[$A-Z_][\w$]*\s+is$/i.test(he))continue;if(/^(?:string|number|boolean|void|never|any|unknown|object|bigint|symbol|undefined|null)$/.test(J))continue;let Re=new RegExp(`\\b${J}\\s*=>`),pe=re.match(Re);if(!pe)continue;let Pe=re.indexOf(pe[0])+pe[0].lastIndexOf("=>"),Me="";if(re.slice(Pe+2).trimStart().startsWith("{")){let we=X(H,Pe);if(we)if(we.from===H){let ve=A[we.from],de=ve.indexOf("{",Pe),ye=de>=0?ve.slice(de+1):"";if(we.to>we.from)Me=`${ye}
|
|
28
|
-
${A.slice(we.from+1,we.to+1).join(`
|
|
29
|
-
`)}`;else Me=ye}else Me=A.slice(we.from,we.to+1).join(`
|
|
30
|
-
`)}else Me=V(H,Pe);if(!new RegExp(`\\b${J}\\b`,"g").test(Me))s.push({filePath:R.filePath,line:H+1,column:Math.max(1,re.indexOf(J)+1),ruleId:"pickier/no-unused-vars",message:`'${J}' is defined but never used (function parameter). Allowed unused args must match pattern: ${i}`,severity:"error"})}}}return s},fix:(p,R)=>{let s=Te.check(p,R);if(s.length===0)return p;let c=s.filter((U)=>U.message.includes("(function parameter)"));if(c.length===0)return p;let n=p.split(/\r?\n/),i=new Set,g=/(?:eslint|pickier)-disable-next-line\b([^*\n]*)/;for(let U=0;U<n.length;U++){let B=n[U].match(g);if(!B)continue;let q=B[1].trim();if(q===""||/\bno-unused-vars\b/.test(q)||/\bpickier\/no-unused-vars\b/.test(q))i.add(U+2)}let a=new Map;for(let U of c){if(i.has(U.line))continue;let B=U.message.match(/^'([^']+)'/);if(!B)continue;let q=B[1];if(q.startsWith("_"))continue;let z=a.get(U.line);if(!z)z=new Set,a.set(U.line,z);z.add(q)}if(a.size===0)return p;let M=p.split(/\r?\n/),v=je(p),A=[0];for(let U=0;U<p.length;U++)if(p[U]===`
|
|
31
|
-
`)A.push(U+1);let O=(U)=>v.templates.some(([B,q])=>U>B&&U<q)||v.regions.some((B)=>B.kind!=="template"&&U>=B.start&&U<B.end),_=!1;for(let[U,B]of a){let q=U-1,z=M[q];if(z===void 0)continue;let Z=A[q]??0,G=[];for(let V of B){let K=V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ie=new RegExp(`(?<=[(,]\\s*)\\b${K}\\b(?=\\s*[,):=])`,"g"),ue;while((ue=ie.exec(z))!==null){if(O(Z+ue.index))continue;G.push({start:ue.index,end:ue.index+V.length,name:V})}}if(G.length===0)continue;G.sort((V,K)=>K.start-V.start);let X=z;for(let V of G)X=`${X.slice(0,V.start)}_${V.name}${X.slice(V.end)}`;if(X!==z)M[q]=X,_=!0}return _?M.join(`
|
|
32
|
-
`):p}};function We(p){return on(p)}function ll(p,R){let s=[],c=0,n=0,i=null,g=!1;for(let a=0;a<p.length;a++){let M=p[a];if(g){g=!1;continue}if(M==="\\"&&i){g=!0;continue}if(!i){if(M==="'")i="single";else if(M==='"')i="double";else if(M==="`")i="template";else if(M==="("||M==="{"||M==="[")c++;else if(M===")"||M==="}"||M==="]")c--;else if(M===R&&c===0)s.push(p.slice(n,a)),n=a+1}else if(i==="single"&&M==="'"||i==="double"&&M==='"'||i==="template"&&M==="`")i=null}return s.push(p.slice(n)),s}function cl(p){let R=0;for(let s=0;s<p.length;s++){let c=p[s];if(c==="{"||c==="("||c==="["||c==="<")R++;else if(c==="}"||c===")"||c==="]"||c===">")R--;else if(c==="="&&R===0&&p[s+1]!=="="&&p[s-1]!=="!"&&p[s-1]!=="<"&&p[s-1]!==">")return s}return-1}function al(p,R){let s=new RegExp(`\\b${R}\\b`),c=0,n=null,i=!1;while(c<p.length){let g=p[c];if(i){i=!1,c++;continue}if(g==="\\"&&n){i=!0,c++;continue}if(n){if(n==="single"&&g==="'"||n==="double"&&g==='"'||n==="template"&&g==="`")n=null;c++;continue}if(g==="'"){n="single",c++;continue}if(g==='"'){n="double",c++;continue}if(g==="`"){n="template",c++;continue}if(g==="["||g==="{"){let a=g,M=g==="["?"]":"}",v=1,A=c+1;while(A<p.length&&v>0){let O=p[A];if(O==="\\"){A+=2;continue}if(O===a)v++;else if(O===M)v--;if(v===0)break;A++}if(v===0&&A<p.length){let O=A+1;while(O<p.length&&(p[O]===" "||p[O]==="\t"||p[O]==="\r"||p[O]===`
|
|
33
|
-
`))O++;if(p[O]==="="&&p[O+1]!=="="&&p[O+1]!==">"){let _=p.slice(c+1,A);if(s.test(_)){let U=new RegExp(`\\b${R}\\b\\s*:`),B=new RegExp(`:\\s*\\b${R}\\b`);if(a==="{"){if(!(U.test(_)&&!B.test(_)&&!new RegExp(`(?:^|[\\s,{])\\s*${R}\\s*(?:,|\\s*=|\\s*})`).test(_)))return!0}else return!0}}}c=A+1;continue}c++}return!1}function us(p,R){let s=new RegExp("^\\s*(?:let|var)\\s+(.+?);?\\s*$"),c=p.match(s);if(!c)return null;let n=c[1],i=cl(n);if(i>=0){let M=n.indexOf(":");if(M>=0&&M<i)n=n.slice(0,M)+n.slice(i)}let g=ll(n,","),a=[];for(let M of g){let v=M.trim();if(!v)continue;if(v.match(/^[{[]/))return null;let O=v.match(/^([$A-Z_][\w$]*)/i);if(!O)return null;let _=O[1];if(!/=/.test(v))return null;let B=R.indexOf(p),z=`\\b${_}\\s*(?:${[">>>=","**=","<<=",">>=","??=","||=","&&=","+=","-=","*=","/=","%=","&=","^=","|=","="].map((V)=>V.replace(/[|\\^$*+?.(){}[\]]/g,(K)=>`\\${K}`)).join("|")})`,Z=v.indexOf("="),G=Z>=0?v.slice(Z+1):"",X=new RegExp(z).test(G);if(!X){let V=`${R.slice(0,Math.max(0,B))}
|
|
34
|
-
${R.slice(B+p.length)}`;X=new RegExp(z).test(V)||new RegExp(`(?:^|[^$w])(?:\\+\\+|--)\\s*${_}\\b|\\b${_}\\s*(?:\\+\\+|--)`).test(V)||al(V,_)}a.push({name:_,fixable:!X})}return a}var bn={meta:{docs:"Suggest 'const' for variables that are never reassigned (heuristic)"},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=We(p);for(let i=0;i<c.length;i++){if(n[i])continue;let g=c[i],a=us(g,p);if(!a)continue;for(let{name:M,fixable:v}of a){if(!v)continue;let A=g.search(new RegExp(`\\b${M.replace(/\$/g,"\\$")}\\b`)),O=A!==-1?A:g.indexOf(M);s.push({filePath:R.filePath,line:i+1,column:Math.max(1,O+1),ruleId:"prefer-const",message:`'${M}' is never reassigned. Use 'const' instead`,severity:"error",help:`Change 'let ${M}' to 'const ${M}' since the variable is never reassigned. This makes your code more predictable and prevents accidental mutations`})}}return s},fix:(p)=>{let R=p.split(/\r?\n/),s=We(p),c=new Set,n=/(?:eslint|pickier)-disable-next-line\b([^*\n]*)/;for(let g=0;g<R.length;g++){let a=R[g].match(n);if(!a)continue;let M=a[1].trim();if(M===""||/\bprefer-const\b/.test(M))c.add(g+2)}let i=!1;for(let g=0;g<R.length;g++){if(c.has(g+1))continue;if(s[g])continue;let a=R[g];if(!/^\s*let\b/.test(a))continue;let M=us(a,p);if(!M||M.length===0)continue;if(!M.every((A)=>A.fixable))continue;let v=a.replace(/^(\s*)let(\s+)/,"$1const$2");if(v!==a)R[g]=v,i=!0}return i?R.join(`
|
|
35
|
-
`):p}};var fs={meta:{docs:"Prefer object spread ({...obj}) over Object.assign() for object composition"},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];if(/^\s*\/\//.test(i))continue;let g=i.indexOf("//"),a=g>=0?i.slice(0,g):i,M=a.matchAll(/\bObject\.assign\s*\(/g);for(let v of M){let A=v.index,O=a.slice(0,A),_=(O.match(/'/g)||[]).length,U=(O.match(/"/g)||[]).length,B=(O.match(/`/g)||[]).length;if(_%2!==0||U%2!==0||B%2!==0)continue;let q=A+13,z=a.slice(q),Z=-1,G=1,X=0,V=0,K=null,ie=!1;for(let me=1;me<z.length;me++){let H=z[me];if(ie){ie=!1;continue}if(H==="\\"&&K){ie=!0;continue}if(!K){if(H==="'")K="single";else if(H==='"')K="double";else if(H==="`")K="template";else if(H==="(")G++;else if(H===")"){if(G--,G===0)break}else if(H==="{")X++;else if(H==="}")X--;else if(H==="[")V++;else if(H==="]")V--;else if(H===","&&G===1&&X===0&&V===0){Z=me;break}}else if(K==="single"&&H==="'"||K==="double"&&H==='"'||K==="template"&&H==="`")K=null}if(Z===-1)continue;let ue=z.slice(1,Z).trim();if(ue==="{}")s.push({filePath:R.filePath,line:n+1,column:A+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(ue==="{}"||/^\{.*\}$/.test(ue))s.push({filePath:R.filePath,line:n+1,column:A+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:(p)=>{let R=p.split(/\r?\n/),s=[];for(let c=0;c<R.length;c++){let n=R[c];n=n.replace(/\bObject\.assign\s*\(\s*\{\}\s*,\s*([^)]+)\)/g,(i,g)=>`{${g.split(",").map((M)=>M.trim()).map((M)=>`...${M}`).join(", ")}}`),s.push(n)}return s.join(`
|
|
36
|
-
`)}};function ul(p,R){let s=!1,c=!1,n=!1;for(let i=0;i<R;i++){let g=p[i];if(g==="\\"){i++;continue}if(g==="'"&&!c&&!n)s=!s;else if(g==='"'&&!s&&!n)c=!c;else if(g==="`"&&!s&&!c)n=!n}return s||c||n}var yn={meta:{docs:"Prefer template literals over string concatenation",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(g.startsWith("//")||g.startsWith("/*")||g.startsWith("*")||g.startsWith("import"))continue;let a=/(['"`][^'"`]*['"`])\s*\+\s*([a-z_$][\w$]*)/i,M=/([a-z_$][\w$]*)\s*\+\s*(['"`][^'"`]*['"`])/i,v=g.match(a)||g.match(M);if(v){let A=i.indexOf("//"),O=i.indexOf(v[0]);if(A>=0&&O>A)continue;if(ul(i,O))continue;let _=!!g.match(M),U=!!g.match(a);if(_&&!U){if(g.slice(g.indexOf(v[0])+v[0].length).startsWith("."))continue}s.push({filePath:R.filePath,line:n+1,column:O+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 ms={name:"general",rules:{"array-callback-return":e(ot),"constructor-super":e(lt),"for-direction":e(ct),"getter-return":e(at),"no-async-promise-executor":e(ut),"no-compare-neg-zero":e(ft),"no-cond-assign":e(mt),"no-const-assign":e(pt),"no-constant-condition":e(dt),"no-constructor-return":e(is),"no-dupe-class-members":e(ht),"no-dupe-keys":e(Ke),"no-duplicate-case":e(gt),"no-empty-pattern":e(bt),"no-fallthrough":e(yt),"no-irregular-whitespace":e(rs),"no-loss-of-precision":e(xt),"no-new":e(os),"no-regex-spaces":e(ls),"no-promise-executor-return":e(Rt),"no-redeclare":e(wt),"no-self-assign":e(He),"no-self-compare":e(kt),"no-sparse-arrays":e(It),"no-undef":e(Pt),"no-unsafe-negation":e(vt),"no-unreachable":e(Mt),"no-unused-vars":e(Te),"no-useless-catch":e($t),"prefer-const":e(bn),"prefer-object-spread":e(fs),"prefer-template":e(yn),"use-isnan":e(Ct),"valid-typeof":e(Lt)}};var ps={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 ds={meta:{docs:"Prefer using global Buffer instead of requiring it",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/),n=/(?:import\b[^;\n]*\bfrom\s*|require\s*\(\s*)['"](?:node:)?buffer['"]/;for(let i=0;i<c.length;i++){let g=c[i],a=g.trim();if(a.startsWith("//")||a.startsWith("/*")||a.startsWith("*"))continue;let M=g.match(n);if(!M||M.index===void 0)continue;if(!/\bBuffer\b/.test(g))continue;s.push({filePath:R.filePath,line:i+1,column:M.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 hs={meta:{docs:"Prefer using global process instead of requiring it",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/),n=/(?:import\b[^;\n]*\bfrom\s*|require\s*\(\s*)['"](?:node:)?process['"]/;for(let i=0;i<c.length;i++){let g=c[i],a=g.trim();if(a.startsWith("//")||a.startsWith("/*")||a.startsWith("*"))continue;let M=g.match(n);if(!M||M.index===void 0)continue;s.push({filePath:R.filePath,line:i+1,column:M.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 gs={name:"node",rules:{"prefer-global/buffer":e(ds),"prefer-global/process":e(hs)}};var xn={meta:{docs:"Enforce sorted imports (delegates to formatter check only)"},check:(p,R)=>{let s=p.split(/\r?\n/),c=0;while(c<s.length&&(/^\s*$/.test(s[c])||/^\s*\/.\/.*/.test(s[c])||/^\s*\/.\*/.test(s[c])))c++;let n=c,i=[];while(c<s.length&&/^\s*import\b/.test(s[c]))i.push(s[c].trim()),c++;if(i.length===0)return[];let g=i.join(`
|
|
37
|
-
`),a=s.slice(c).join(`
|
|
38
|
-
`),M=`${g}
|
|
39
|
-
${a}`;if(k(M)!==M)return[{filePath:R.filePath,line:n+1,column:1,ruleId:"sort-imports",message:"Imports are not sorted/grouped consistently",severity:"warning"}];return[]},fix:(p)=>k(p)};var bs={name:"perfectionist",rules:{"sort-imports":e(xn)}};var ys={meta:{docs:"Ensure all imports appear before other statements",recommended:!1},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=!1,i=0;for(let g=0;g<c.length;g++){let a=c[g].trim();if(!a||a.startsWith("//")||a.startsWith("/*")||a.startsWith("*"))continue;let M=a.match(/^\s*import\s+/);if(!M&&a.length>0){if(n=!0,i===0)i=g+1}if(n&&M)s.push({filePath:R.filePath,line:g+1,column:1,ruleId:"import/first",message:"Import statement must appear before other statements",severity:"error"})}return s}};var xs={meta:{docs:"Disallow duplicate specifier names in a single import declaration"},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];if(!i.includes("import"))continue;let g=i.match(/^\s*import\s*\{([^}]*)\}\s*from\s*['"][^'"]+['"]/);if(!g)continue;let M=g[1].split(",").map((A)=>A.trim()).filter(Boolean).map((A)=>A.split(/\s+as\s+/i)[0].trim()),v=new Set;for(let A of M){if(v.has(A)){s.push({filePath:R.filePath,line:n+1,column:Math.max(1,i.indexOf(A)+1),ruleId:"pickier/import-dedupe",message:"Expect no duplication in imports",severity:"warning"});break}v.add(A)}}return s}};function Rs(p){let R=p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(?<![\\w$])${R}(?![\\w$])`)}function fl(p,R,s){let c=[],n=/^\s*import\s+type\b/.test(p),i=p.replace(/^\s*import\s+/,"").replace(/\s+from\s+['"][^'"]+['"].*$/s,"");if(/^['"]/.test(i))return c;let g=(v,A)=>{let O=v.trim();if(!O||O==="type")return;if(!/^[A-Z_$][\w$]*$/i.test(O))return;for(let _=R;_<s.length;_++){let U=s[_].search(Rs(O));if(U!==-1){c.push({name:O,line:_+1,column:U,typeOnly:A});return}if(/\bfrom\b/.test(s[_]))break}c.push({name:O,line:R+1,column:0,typeOnly:A})},a=i.match(/\{([\s\S]*)\}/);if(a)for(let v of a[1].split(",")){let A=v.trim();if(!A)continue;let O=/^type\s+/.test(A),U=A.replace(/^type\s+/,"").split(/\s+as\s+/);g(U[U.length-1],n||O)}let M=a?i.slice(0,i.indexOf("{")):i;for(let v of M.split(",")){let A=v.trim().replace(/^type\s+/,"");if(!A)continue;let O=A.match(/^\*\s+as\s+(\w+)$/);g(O?O[1]:A,n)}return c}var ws={meta:{docs:"Disallow imports that nothing in the file uses"},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=[],i=new Set;for(let M=0;M<c.length;M++){if(!/^\s*import(?![\w$])\s*(?![(.])/.test(c[M]))continue;let v=c[M],A=M,O=Math.min(c.length-1,M+40);while(A<O&&!/\bfrom\s*['"][^'"]*['"]/.test(v)&&!/^\s*import\s*['"]/.test(v))A++,v+=`
|
|
40
|
-
${c[A]}`;if(!/\bfrom\s*['"][^'"]*['"]/.test(v)&&!/^\s*import\s*['"]/.test(v))continue;for(let _=M;_<=A;_++)i.add(_);n.push(...fl(v,M,c)),M=A}if(n.length===0)return s;let g=c.map((M,v)=>i.has(v)?"":M).join(`
|
|
41
|
-
`),a=as(g);for(let M of n){if(Rs(M.name).test(a))continue;s.push({filePath:R.filePath,line:M.line,column:M.column+1,ruleId:"pickier/no-unused-imports",message:M.typeOnly?`'${M.name}' is imported as a type but never used`:`'${M.name}' is imported but never used`,severity:"error"})}return s}};import{readFileSync as ml,statSync as pl}from"fs";import{dirname as dl,join as hl,resolve as gl}from"path";var ks=[".ts",".tsx",".js",".jsx"];function Is(p){return pl(p,{throwIfNoEntry:!1})?.isFile()??!1}function bl(p,R){let s=gl(p,R);for(let c of[...ks,""])if(Is(s+c))return s+c;for(let c of ks){let n=hl(s,`index${c}`);if(Is(n))return n}return null}var Ps={meta:{docs:"Ensure named imports correspond to a named export in the remote file",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=dl(R.filePath);for(let i=0;i<c.length;i++){let a=c[i].match(/\bimport\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/);if(a){let M=a[1].split(",").map((_)=>_.trim().split(/\s+as\s+/)[0].trim()),v=a[2];if(!v.startsWith(".")&&!v.startsWith("/"))continue;let A=bl(n,v),O="";if(A)try{O=ml(A,"utf8")}catch{}if(O)for(let _ of M){let U=new RegExp(`\\bexport\\s+(?:const|let|var|function|class)\\s+${_}\\b`),B=new RegExp(`\\bexport\\s+\\{[^}]*\\b${_}\\b[^}]*\\}`);if(![U,B].some((Z)=>Z.test(O)))s.push({filePath:R.filePath,line:i+1,column:1,ruleId:"import/named",message:`'${_}' not found in '${v}'`,severity:"error"})}}}return s}};import{existsSync as Ms,readFileSync as yl}from"fs";import{dirname as vs,resolve as $s}from"path";var Cs={meta:{docs:"Ensure imports don't create circular dependencies",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=R.filePath,i=new Set,g=new Set;function a(v,A){if(g.has(v))return!0;if(i.has(v))return!1;i.add(v),g.add(v);try{let O=yl(v,"utf8"),_=M(O,vs(v));for(let U of _)if(a(U,[...A,U]))return!0}catch{}return g.delete(v),!1}function M(v,A){let O=[],_=/\bimport(?:\s{2,}|\s+\S.*?(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))from\s+['"]([^'"]+)['"]/g,U;for(U=_.exec(v);U!==null;U=_.exec(v)){let B=U[1];if(B.startsWith(".")||B.startsWith("/")){let q=[".ts",".tsx",".js",".jsx",""];for(let z of q){let Z=$s(A,B+z);if(Ms(Z)){O.push(Z);break}}}}return O}for(let v=0;v<c.length;v++){let O=c[v].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(O){let _=O[1];if(_.startsWith(".")||_.startsWith("/")){let U=[".ts",".tsx",".js",".jsx",""],B="";for(let q of U){let z=$s(vs(n),_+q);if(Ms(z)){B=z;break}}if(B){if(i.clear(),g.clear(),g.add(n),a(B,[n,B]))s.push({filePath:R.filePath,line:v+1,column:1,ruleId:"import/no-cycle",message:"Dependency cycle detected",severity:"error"})}}}}return s}};var Ls={meta:{docs:"Disallow duplicate module imports - all imports from the same module should be combined"},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=new Map,i=!1;for(let g=0;g<c.length;g++){let a=c[g];if(i){let U=a.indexOf("*/");if(U>=0)a=a.slice(U+2),i=!1;else continue}let M=a.indexOf("/*"),v=a.indexOf("//");if(M>=0&&(v===-1||M<v)){let U=a.indexOf("*/",M+2);if(U>=0)a=a.slice(0,M)+a.slice(U+2);else i=!0,a=a.slice(0,M)}if(v>=0)a=a.slice(0,v);let A=a.trim();if(!A)continue;let O=A.match(/^import\s+(?:type\s+)?(?:\{[^}]*\}|[\w$]+(?:\s*,\s*\{[^}]*\})?|\*\s+as\s+[\w$]+)\s+from\s+(['"`])(.+?)\1/);if(O){let U=O[2];if(n.has(U)){let B=n.get(U);s.push({filePath:R.filePath,line:g+1,column:1,ruleId:"no-duplicate-imports",message:`'${U}' imported multiple times (also imported on line${B.length>1?"s":""} ${B.join(", ")})`,severity:"error",help:`Combine all imports from '${U}' into a single import statement`}),B.push(g+1)}else n.set(U,[g+1])}let _=A.match(/^export\s+(?:type\s+)?(?:\{[^}]*\}|\*(?:\s+as\s+[\w$]+)?)\s+from\s+(['"`])(.+?)\1/);if(_){let U=_[2],B=`export:${U}`;if(n.has(B)){let q=n.get(B);s.push({filePath:R.filePath,line:g+1,column:1,ruleId:"no-duplicate-imports",message:`'${U}' re-exported multiple times (also exported on line${q.length>1?"s":""} ${q.join(", ")})`,severity:"error",help:`Combine all re-exports from '${U}' into a single export statement`}),q.push(g+1)}else n.set(B,[g+1])}}return s}};var Ss={meta:{docs:"Disallow importing from dist directories"},check:(p,R)=>{let s=[],c=new RegExp(`^\\s*import\\s[^;]*?from\\s*['"]([^'"]+)['"]`,"m"),n=p.split(/\r?\n/);for(let i=0;i<n.length;i++){let g=n[i],a=g.match(c);if(!a)continue;let M=a[1];if(M==="dist"||(M.startsWith(".")||M.startsWith("/"))&&/(?:^|\/)dist(?:\/.|$)/.test(M))s.push({filePath:R.filePath,line:i+1,column:Math.max(1,g.indexOf(M)+1),ruleId:"pickier/no-import-dist",message:`Do not import modules in \`dist\` folder, got ${M}`,severity:"error"})}return s}};var Es={meta:{docs:"Disallow importing from node_modules by explicit path"},check:(p,R)=>{let s=[],c=new RegExp(`^\\s*import\\s[^;]*?from\\s*['"]([^'"]+)['"]`,"m"),n=/require\(\s*['"]([^'"]+)['"]\s*\)/,i=p.split(/\r?\n/);for(let g=0;g<i.length;g++){let a=i[g],M=a.match(c),v=a.match(n),A=M?.[1]||v?.[1];if(!A)continue;if(A.includes("/node_modules/")){let O=Math.max(1,a.indexOf(A)+1);s.push({filePath:R.filePath,line:g+1,column:O,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 xl}from"fs";import{dirname as Rl,join as wl,resolve as kl}from"path";var As={meta:{docs:"Ensure imports point to a file/module that can be resolved",recommended:!0},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=Rl(R.filePath);for(let i=0;i<c.length;i++){let g=c[i],a=[...g.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),...g.matchAll(/\bimport\s*\(\s*['"]([^'"]+)['"]\s*\)/g),...g.matchAll(/\brequire\s*\(\s*['"]([^'"]+)['"]\s*\)/g)];for(let M of a){let v=M[1];if(!v.startsWith(".")&&!v.startsWith("/"))continue;let A=[],O=[".ts",".tsx",".js",".jsx",".mjs",".cjs",""];for(let U of O){let B=kl(n,v+U);A.push(B),A.push(wl(B,`index${U}`))}if(!A.some((U)=>xl(U)))s.push({filePath:R.filePath,line:i+1,column:1,ruleId:"import/no-unresolved",message:`Unable to resolve path to module '${v}'`,severity:"error"})}}return s}};function Os(p,R,s){let c=s.order==="desc"?-1:1,n=s.type||"alphabetical",i=s.ignoreCase?p.toLowerCase():p,g=s.ignoreCase?R.toLowerCase():R;if(n==="line-length")return(i.length-g.length)*c;if(n==="natural")return i.localeCompare(g,void 0,{numeric:!0,sensitivity:"base"})*c;if(n==="unsorted")return 0;return i.localeCompare(g)*c}var Il=new RegExp(`^export\\s+\\{[^}]*\\}\\s+from\\s+['"][^'"]+['"];?\\s*$`);function Rn(p){return Il.test(p)}var _s={meta:{docs:"Ensure contiguous export statements are sorted consistently."},check:(p,R)=>{let s=[],c=R.config.pluginRules?.["pickier/sort-exports"]?.[1]||{},n=p.split(/\r?\n/),i=0;while(i<n.length){while(i<n.length&&!Rn(n[i]))i++;if(i>=n.length)break;let g=[],a=i;while(a<n.length){let M=n[a];if(Rn(M)){g.push({idx:a,line:M}),a++;continue}if(c.partitionByNewLine&&M.trim()==="")break;else break}if(g.length>1){let M=g.map((O)=>O.line),v=[...M].sort((O,_)=>Os(O,_,c));if(!M.every((O,_)=>O===v[_])){let O=M.findIndex((U,B)=>U!==v[B]),_=g[O]?.idx??g[0].idx;s.push({filePath:R.filePath,line:_+1,column:1,ruleId:"pickier/sort-exports",message:"Export statements are not sorted.",severity:"warning"})}}i=a+1}return s},fix:(p,R)=>{let s=R.config.pluginRules?.["pickier/sort-exports"]?.[1]||{},n=[...p.split(/\r?\n/)],i=0;while(i<n.length){while(i<n.length&&!Rn(n[i]))i++;if(i>=n.length)break;let g=[],a=i;while(a<n.length){let M=n[a];if(Rn(M)){g.push(a),a++;continue}if(s.partitionByNewLine&&M.trim()==="")break;else break}if(g.length>1){let M=g.map((O)=>n[O]),v=[...M].sort((O,_)=>Os(O,_,s));if(!M.every((O,_)=>O===v[_]))g.forEach((O,_)=>{n[O]=v[_]})}i=a+1}return n.join(`
|
|
42
|
-
`)}};var Ts={meta:{docs:"Enforce sorted TypeScript heritage clauses (extends/implements lists)"},check:(p,R)=>{let s=R.options||{},c=s.type||"alphabetical",n=s.order||"asc",i=s.ignoreCase!==!1,g=Array.isArray(s.groups)?s.groups:[],a=s.customGroups||{},M=p.split(/\r?\n/),v=[],A=(V)=>n==="asc"?V:-V,O=(V,K)=>(i?V.toLowerCase():V).localeCompare(i?K.toLowerCase():K),_=(V,K)=>(i?V.toLowerCase():V).localeCompare(i?K.toLowerCase():K,void 0,{numeric:!0}),U=(V,K)=>{if(c==="line-length")return A(V.length-K.length);if(c==="natural")return A(_(V,K));if(c==="unsorted")return 0;return A(O(V,K))},B=Object.fromEntries(Object.entries(a).map(([V,K])=>{let ue=(Array.isArray(K)?K:[K]).map((me)=>new RegExp(me));return[V,ue]})),q=[];for(let V of g)if(Array.isArray(V))q.push(...V);else q.push(V);if(!q.includes("unknown"))q.push("unknown");let z=(V)=>{for(let[K,ie]of Object.entries(B))if(ie.some((ue)=>ue.test(V)))return K;return"unknown"},Z=(V)=>{let K=[],ie=0,ue="";for(let me=0;me<V.length;me++){let H=V[me];if(H==="<")ie++;else if(H===">")ie=Math.max(0,ie-1);if(H===","&&ie===0){K.push(ue.trim()),ue="";continue}ue+=H}if(ue.trim())K.push(ue.trim());return K},G=(V)=>{let K=V.trim(),ie=K.match(/^([A-Z_$][\w$.]*)/i);return ie?ie[1]:K},X=(V,K)=>{let ie=Z(K);if(ie.length<=1)return;let ue=ie.map(G),me=ue.map(z),H=ue.map((se,ne)=>({n:se,g:me[ne],i:ne})).sort((se,ne)=>{let le=q.indexOf(se.g),te=q.indexOf(ne.g);if(le!==te)return le-te;return U(se.n,ne.n)}).map((se)=>se.n);if(!ue.every((se,ne)=>se===H[ne]))v.push({filePath:R.filePath,line:V,column:1,ruleId:"sort-heritage-clauses",message:"Heritage clauses are not sorted",severity:"warning"})};for(let V=0;V<M.length;V++){let K=M[V],ie=K.match(/^\s*interface\s+[A-Za-z_$][^{]*\bextends\s+(.+?)\s*\{/);if(ie)X(V+1,ie[1]);let ue=K.match(/^\s*class\s+[A-Za-z_$][^{]*\bimplements\s+(.+?)\s*\{/);if(ue)X(V+1,ue[1])}return v}};var Ws={meta:{docs:"Require object keys to be sorted (ESLint-compatible core rule subset)"},check:()=>[]};var Ns={meta:{docs:"Enforce sorted named imports within each import statement"},check:(p,R)=>{let s=R.options||{},c=s.type||"alphabetical",n=s.order||"asc",i=s.ignoreCase!==!1,g=Boolean(s.ignoreAlias),a=p.split(/\r?\n/),M=[],v=(A,O)=>{let _=0;if(c==="line-length")_=A.length-O.length;else{let U=i?A.toLowerCase():A,B=i?O.toLowerCase():O;_=U.localeCompare(B)}return n==="asc"?_:-_};for(let A=0;A<a.length;A++){let _=a[A].match(/^\s*import\s+\{([^}]*)\}\s+from\s+['"][^'"]+['"]/);if(!_)continue;let B=_[1].split(",").map((G)=>G.trim()).filter(Boolean);if(B.length<=1)continue;let q=B.map((G)=>{let X=G.replace(/^type\s+/,""),V=X.match(/^([\w$]+)\s+as\s+([\w$]+)$/);if(V)return g?V[2]:V[1];let K=X.match(/^([\w$]+)$/);return K?K[1]:X}),z=[...q].sort(v);if(!q.every((G,X)=>G===z[X]))M.push({filePath:R.filePath,line:A+1,column:1,ruleId:"sort-named-imports",message:"Named imports are not sorted",severity:"warning"})}return M}};var Ds={meta:{docs:"Enforce sorted object keys"},check:(p,R)=>{let s=R.options||{},c=s.type||"alphabetical",n=s.order||"asc",i=s.ignoreCase!==!1,g=Boolean(s.partitionByNewLine),a=p.split(/\r?\n/),M=[],v=(O,_)=>{let U=0;if(c==="line-length")U=O.length-_.length;else{let B=i?O.toLowerCase():O,q=i?_.toLowerCase():_;U=B.localeCompare(q)}return n==="asc"?U:-U},A=0;while(A<a.length){let O=a[A],_=O.indexOf("{");if(_!==-1){let U=O.slice(0,_);if(/=\s*$|\(\s*$|\breturn\s*$/.test(U)){let B=0,q=A,z=A;for(;z<a.length;z++){for(let Z of a[z])if(Z==="{")B++;else if(Z==="}")B--;if(B===0)break}if(z>q){let Z=a.slice(q+1,z),G=[],X={startLine:q+2,props:[]},V=()=>{if(X.props.length)G.push(X);X={startLine:0,props:[]}};for(let K=0;K<Z.length;K++){let ie=Z[K];if(g&&/^\s*$/.test(ie)){V();continue}if(/^\s*\.\.\./.test(ie))continue;if(/\{|\}/.test(ie))continue;let ue=ie.match(/^\s*['"]?([\w$-]+)['"]?\s*:/);if(ue){if(X.startLine===0)X.startLine=q+2+K;X.props.push({key:ue[1],line:q+2+K})}}V();for(let K of G){let ie=K.props.map((H)=>H.key),ue=[...ie].sort(v);if(!(ie.length<=1||ie.every((H,re)=>H===ue[re]))&&K.props.length>0){let H=K.props[0];M.push({filePath:R.filePath,line:H.line,column:1,ruleId:"sort-objects",message:"Object keys are not sorted",severity:"warning"})}}A=z+1;continue}}}A++}return M}};var js={meta:{docs:"Enforce top-level functions to use function declarations"},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];if(/^\s+/.test(i))continue;if(/^\s*(?:\/\/|\/\*)/.test(i))continue;let g=i.match(/^const\s+([A-Za-z_$][\w$]*)\s*=(.*)$/);if(!g)continue;let a=g[2].trim();if(/^\(?[A-Z_$,]*(?:\)\s*)?=>/i.test(a)||/^function\b/.test(a)){let M=i.indexOf("const")+1;s.push({filePath:R.filePath,line:n+1,column:M,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 M=c[n+1]||"";if(/^\s*(?:\(?[A-Za-z_$,]*(?:\)\s*)?=>|function\b)/.test(M)){let v=i.indexOf("const")+1;s.push({filePath:R.filePath,line:n+1,column:v,ruleId:"pickier/top-level-function",message:"Top-level functions should be declared with function keyword",severity:"warning"})}}}return s}};var Pl=[[/^(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]],Ml=/^([a-z0-9][-a-z0-9]{0,50}:)+(?!\[)/;function vl(p){let R=0;while(R<p.length){if(p[R]==="[")break;let s=p.indexOf(":",R);if(s===-1)break;if(p[s+1]==="[")break;R=s+1}return p.slice(R)}function $l(p){let R=vl(p);if(R.startsWith("!"))R=R.slice(1);for(let[s,c]of Pl)if(s.test(R))return c;return 99}function Cl(p){let R=p.match(Ml);if(!R)return 0;let s=R[0].slice(0,-1).split(":"),c={sm:1,md:2,lg:3,xl:4,"2xl":5},n=10;for(let i of s)if(c[i]!==void 0)n+=c[i];else n+=20;return n}var Us=new Map;function Fs(p){let R=Us.get(p);if(R)return R;let s={group:$l(p),variant:Cl(p)};return Us.set(p,s),s}function Tn(p){return[...p].sort((R,s)=>{let c=Fs(R),n=Fs(s),i=c.group,g=n.group;if(i!==g)return i-g;let a=c.variant,M=n.variant;if(a!==M)return a-M;return R.localeCompare(s)})}var Ll=/\b(?:class|className|:class)\s*=\s*(?:"([^"]*?)"|'([^']*?)')/g,Sl=/\b(?:class|className|:class)\s*=\s*\{`([^`]*?)`\}/g,El=/\b(?:clsx|cn|tw|cva|tv)\s*\(\s*(?:"([^"]*?)"|'([^']*?)')/g;function Al(p){let R=p.replace(/\[[^\]]*\]/g,"");if(/['"`]/.test(R))return!0;if(/[{}()=]/.test(R))return!0;if(/ \? | && | \|\| /.test(R))return!0;if(/\b(?:true|false|null|undefined|function|return|typeof|instanceof)\b/.test(R))return!0;return!1}function Bs(p){let R=[];if(!p.includes("class")&&!p.includes("clsx")&&!p.includes("cn(")&&!p.includes("tw(")&&!p.includes("cva(")&&!p.includes("tv("))return R;for(let s of[Ll,Sl,El]){s.lastIndex=0;let c;while((c=s.exec(p))!==null){let n=c[1]??c[2]??"";if(!n.trim())continue;if(Al(n))continue;let i=p.indexOf(n,c.index);if(i===-1)continue;R.push({value:n,start:i,end:i+n.length})}}return R.sort((s,c)=>s.start-c.start),R}function qs(p){let R=[],s="",c=0;for(let n of p)if(n==="[")c++,s+=n;else if(n==="]")c=Math.max(0,c-1),s+=n;else if(/\s/.test(n)&&c===0){if(s)R.push(s),s=""}else s+=n;if(s)R.push(s);return R}function zs(p){let R=Tn(p);return p.every((s,c)=>s===R[c])}var Zs={meta:{docs:"Enforce consistent Tailwind CSS class ordering (layout \u2192 spacing \u2192 typography \u2192 etc.).",recommended:!0,editsStringContent:!0},check:(p,R)=>{let s=[],c=Bs(p);for(let{value:n,start:i}of c){let g=qs(n);if(g.length<2)continue;if(!zs(g)){let a=p.slice(0,i),M=(a.match(/\n/g)??[]).length+1,v=a.lastIndexOf(`
|
|
43
|
-
`),A=v===-1?i+1:i-v;s.push({filePath:R.filePath,line:M,column:A,ruleId:"pickier/sort-tailwind-classes",message:`Tailwind classes are not in the recommended order. Expected: "${Tn(g).join(" ")}"`,severity:"warning",help:"Run with --fix to automatically sort Tailwind classes, or reorder them manually."})}}return s},fix:(p)=>{let R=Bs(p);if(R.length===0)return p;let s=[...R].reverse(),c=p;for(let{value:n,start:i,end:g}of s){let a=qs(n);if(a.length<2||zs(a))continue;let M=Tn(a).join(" ");c=c.slice(0,i)+M+c.slice(g)}return c}};var Gs={name:"pickier",rules:{"sort-exports":e(_s),"sort-objects":e(Ds),"sort-imports":e(xn),"sort-named-imports":e(Ns),"sort-heritage-clauses":e(Ts),"sort-keys":e(Ws),"import-dedupe":e(xs),"no-unused-imports":e(ws),"import-first":e(ys),"import-named":e(Ps),"import-no-cycle":e(Cs),"import-no-unresolved":e(As),"no-import-dist":e(Ss),"no-import-node-modules-by-path":e(Es),"no-duplicate-imports":e(Ls),"top-level-function":e(js),"sort-tailwind-classes":b(Zs),"prefer-const":e(bn),"prefer-template":e(yn),"no-unused-vars":e(Te)}};var Vs={name:"quality",rules:{"default-case":e(Et),eqeqeq:e(At),"no-alert":e(Tt),"no-await-in-loop":e(Wt),"no-caller":e(Nt),"no-case-declarations":e(Dt),"no-else-return":e(jt),"no-empty":e(Ut),"no-empty-function":e(Ft),"no-eval":e(Bt),"no-extend-native":e(qt),"no-global-assign":e(Zt),"no-implied-eval":e(Gt),"no-iterator":e(Vt),"no-new":e(Kt),"no-new-func":e(Ht),"no-new-wrappers":e(Yt),"no-octal":e(Xt),"no-param-reassign":e(Jt),"no-proto":e(Qt),"no-return-assign":e(en),"no-shadow":e(nn),"no-throw-literal":e(sn),"no-use-before-define":e(ln),"no-useless-call":e(cn),"no-with":e(pn),"require-await":e(hn),complexity:e(St),"max-depth":e(Ot),"max-lines-per-function":e(_t),"no-extra-boolean-cast":e(zt),"no-lonely-if":e(Ye),"no-sequences":e(tn),"no-useless-concat":e(an),"no-useless-escape":e(un),"no-useless-rename":e(fn),"no-useless-return":e(Qe),"no-var":e(mn),"prefer-arrow-callback":e(dn)}};var Ks={meta:{docs:"Detects potentially super-linear backtracking patterns in regex literals (heuristic)"},check:(p,R)=>{let s=[],c=(n,i,g)=>{let a=p.slice(0,n),M=(a.match(/\n/g)||[]).length+1,v=n-a.lastIndexOf(`
|
|
44
|
-
`);s.push({filePath:R.filePath,line:M,column:v,ruleId:"no-super-linear-backtracking",message:g,severity:"error"})};for(let n of je(p).regions){if(n.kind!=="regex")continue;let i=n.start-1,g=p.slice(i,n.end+1),a=g.slice(1,g.lastIndexOf("/")),M=a.replace(/\[.*?\]/g,"");if(M.includes(".+?\\s*")||M.includes("\\s*.+?")||M.includes(".*\\s*")||M.includes("\\s*.*")){c(i,g.length,"The combination of ' .*' or ' .+?' with '\\s*' can cause super-linear backtracking due to exchangeable characters");continue}let A=M.replace(/\s+/g,"");if(/(?:\.\*\??){2,}/.test(A)||/(?:\.\+\??){2,}/.test(A)||/\.\*\??\.\+\?|\.\+\??\.\*\?/.test(A)){c(i,g.length,"Multiple adjacent unlimited wildcard quantifiers can cause super-linear backtracking");continue}let O=a.replace(/\\./g,"_").replace(/\[[^\]]*\]/g,"_");if(/\((?:\?:)?[^)]*?[+*][^)]*\)\s*[+*]/.test(O)){c(i,g.length,"Nested unlimited quantifiers detected (e.g., (.+)+) which can cause catastrophic backtracking");continue}}return s}};function Ol(p,R){let s=R-1;while(s>=0&&(p[s]===" "||p[s]==="\t"))s--;let c=s>=0?p[s]:"",n="=(<>!&|?:;,{[+(~^%*/";if(!(s<0||n.includes(c)||/\b(?:return|typeof|void|delete|throw|new|in|of|case)\s*$/.test(p.slice(Math.max(0,s-5),s+1))))return null;let g=R+1,a=!1,M=!1,v=-1;while(g<p.length){let q=p[g];if(M)M=!1;else if(q==="\\")M=!0;else if(q==="["){if(!a)a=!0}else if(q==="]"){if(a)a=!1}else if(q==="/"&&!a){v=g;break}else if(q===`
|
|
45
|
-
`)break;g++}if(v<=R)return null;let A=p.slice(R+1,v),O=v+1;while(O<p.length&&/[gimsuvy]/.test(p[O]))O++;if(/\\[1-9]/.test(A))return null;let _=0,U=-1,B=!1;for(let q=0;q<A.length;q++){if(A[q]==="\\"){q++;continue}if(A[q]==="["&&!B){B=!0;continue}if(A[q]==="]"&&B){B=!1;continue}if(B)continue;if(A[q]==="("&&A.slice(q+1,q+3)!=="?:"&&A.slice(q+1,q+3)!=="?="&&A.slice(q+1,q+3)!=="?!"&&A.slice(q+1,q+4)!=="?<="&&A.slice(q+1,q+4)!=="?<!"){if(U<0)U=q;_++}}if(_===0)return null;return{patternStart:R,patternEnd:O,pattern:A,capCount:_,firstCapOffset:U}}function _l(p,R,s){let c=s;while(c<p.length&&(p[c]===" "||p[c]==="\t"))c++;if(p[c]==="."){let M=p.slice(c+1,c+20);if(/^test\s*\(/.test(M))return!1;if(/^exec\s*\(/.test(M))return!0}let n=R-1;while(n>=0&&(p[n]===" "||p[n]==="\t"))n--;if(p[n]==="("){let v=n-1;while(v>=0&&(p[v]===" "||p[v]==="\t"))v--;let A=p.slice(Math.max(0,v-20),v+1);if(/\.match\s*$/.test(A))return!0;if(/\.matchAll\s*$/.test(A))return!0;if(/\.exec\s*$/.test(A))return!0;if(/\.replace\s*$/.test(A))return!0;if(/\.replaceAll\s*$/.test(A))return!0;if(/\.split\s*$/.test(A))return!0;if(/\.search\s*$/.test(A))return!1;if(/\.test\s*$/.test(A))return!1}let i=p.lastIndexOf(`
|
|
46
|
-
`,R)+1,a=p.slice(i,R).trim().match(/(?:const|let|var)\s+(\w+)\s*=\s*$/);if(a){let M=a[1],v=p.slice(s),A=new RegExp(`\\b${M}\\.exec\\s*\\(`),O=new RegExp(`\\b${M}\\.test\\s*\\(`),_=new RegExp(`\\.match(?:All)?\\s*\\(\\s*${M}\\s*\\)`),U=new RegExp(`\\.replace(?:All)?\\s*\\(\\s*${M}`),B=A.test(v),q=_.test(v),z=U.test(v),Z=O.test(v);if(B||q||z)return!0;if(Z)return!1;return!0}return!0}function Tl(p,R){let s=R-1;while(s>=0&&(p[s]===" "||p[s]==="\t"))s--;let c=s>=0?p[s]:"",n="=(<>!&|?:;,{[+(~^%*/";if(!(s<0||n.includes(c)||/\b(?:return|typeof|void|delete|throw|new|in|of|case)\s*$/.test(p.slice(Math.max(0,s-5),s+1))))return R+1;let g=R+1,a=!1,M=!1;while(g<p.length){let v=p[g];if(M)M=!1;else if(v==="\\")M=!0;else if(v==="["){if(!a)a=!0}else if(v==="]"){if(a)a=!1}else if(v==="/"&&!a){g++;while(g<p.length&&/[gimsuvy]/.test(p[g]))g++;return g}else if(v===`
|
|
47
|
-
`)break;g++}return R+1}function Wl(p,R){let s=[],c=R.filePath,n=0;while(n<p.length){let i=p[n];if(i==="/"&&p[n+1]==="/"){while(n<p.length&&p[n]!==`
|
|
48
|
-
`)n++;continue}if(i==="/"&&p[n+1]==="*"){n+=2;while(n<p.length-1&&!(p[n]==="*"&&p[n+1]==="/"))n++;n+=2;continue}if(i==="'"||i==='"'||i==="`"){let g=i;n++;while(n<p.length){if(p[n]==="\\"){n+=2;continue}if(p[n]===g){n++;break}n++}continue}if(i==="/"){let g=Ol(p,n);if(!g){let a=Tl(p,n);if(a>n+1)n=a;else n++;continue}if(!_l(p,g.patternStart,g.patternEnd)){let a=g.patternStart+1+(g.firstCapOffset>=0?g.firstCapOffset:0),M=p.slice(0,a),v=(M.match(/\r?\n/g)||[]).length+1,A=a-(M.lastIndexOf(`
|
|
49
|
-
`)+1)+1;s.push({filePath:c,line:v,column:A,ruleId:"regexp/no-unused-capturing-group",message:"Unused capturing group in regular expression; use non-capturing group (?:...) instead",severity:"error"})}n=g.patternEnd;continue}n++}return s}var Hs={meta:{docs:"Flags regex literals with unused capturing groups (context-aware)",recommended:!1},check(p,R){return Wl(p,R)}};var Ys={meta:{docs:"Disallow lazy quantifiers that don't affect the matching behavior",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];if(i.trim().startsWith("//")||i.trim().startsWith("/*")||i.trim().startsWith("*"))continue;let g=/\/(?![/*])([^/\n\r\\]|\\.)+\/[gimsuvy]*/g,a;for(a=g.exec(i);a!==null;a=g.exec(i)){let M=a[0],v=M.slice(1,M.lastIndexOf("/"));if(/[+*?]\?\$$/.test(v))s.push({filePath:R.filePath,line:n+1,column:a.index+v.search(/[+*?]\?\$$/)+2,ruleId:"regexp/no-useless-lazy",message:"Lazy quantifier is useless before end-of-string anchor",severity:"error"});if(/[+*?]\?$/.test(v))s.push({filePath:R.filePath,line:n+1,column:a.index+v.length-1,ruleId:"regexp/no-useless-lazy",message:"Lazy quantifier is useless at the end of the pattern",severity:"error"})}}return s}};var Xs={name:"regexp",rules:{"no-super-linear-backtracking":e(Ks),"no-unused-capturing-group":e(Hs),"no-useless-lazy":e(Ys)}};function Js(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Qs={meta:{docs:"Disallow spaces inside array brackets",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]==="["&&!Js(i,a)){let M=i[a+1];if(M==="]"||M===void 0||M===`
|
|
50
|
-
`)continue;if(M===" "||M==="\t"){if(i.indexOf("]",a+1)!==-1)s.push({filePath:R.filePath,line:n+1,column:a+2,ruleId:"style/array-bracket-spacing",message:"Unexpected space after '['",severity:"warning"})}}if(i[a]==="]"&&!Js(i,a)){let M=a>0?i[a-1]:void 0;if(M==="["||M===void 0)continue;if(M===" "||M==="\t"){if(i.lastIndexOf("[",a-1)!==-1)s.push({filePath:R.filePath,line:n+1,column:a,ruleId:"style/array-bracket-spacing",message:"Unexpected space before ']'",severity:"warning"})}}}}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c;n=n.replace(/\[\s+(\S)/g,(i,g)=>{if(g==="]")return i;return`[${g}`}),n=n.replace(/(\S)\s+\]/g,"$1]"),s.push(n)}return s.join(`
|
|
51
|
-
`)}};var ei=/(?<![(\[{,=:?&|+\-*/])\b([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=>/g;function Nl(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var ti={meta:{docs:"Require parentheses around arrow function parameters",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;ei.lastIndex=0;while((a=ei.exec(i))!==null){let M=a.index;if(Nl(i,M))continue;let v=a[1];if(i.slice(0,M).trimEnd().endsWith("("))continue;if(v==="async")continue;s.push({filePath:R.filePath,line:n+1,column:M+1,ruleId:"style/arrow-parens",message:`Arrow function parameter '${v}' should be wrapped in parentheses`,severity:"warning"})}}return s},fix(p){return p.replace(/(?<![(\[{,=:?&|+\-*/])\b([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=>/g,(R,s)=>{if(s==="async")return R;return R.replace(s,`(${s})`)})}};var wn=/=>/g;function ni(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var si={meta:{docs:"Require space before and after => in arrow functions",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;wn.lastIndex=0;while((a=wn.exec(i))!==null){let M=a.index;if(ni(i,M))continue;if(M>0&&i[M-1]!==" "&&i[M-1]!=="\t")s.push({filePath:R.filePath,line:n+1,column:M+1,ruleId:"style/arrow-spacing",message:"Missing space before =>",severity:"warning"});let v=M+2;if(v<i.length&&i[v]!==" "&&i[v]!=="\t"&&i[v]!==`
|
|
52
|
-
`)s.push({filePath:R.filePath,line:n+1,column:v+1,ruleId:"style/arrow-spacing",message:"Missing space after =>",severity:"warning"})}}return s},fix(p){let R=p.split(`
|
|
53
|
-
`);for(let s=0;s<R.length;s++){let c=R[s],n=c.trim();if(!n||n.startsWith("//")||n.startsWith("*")||n.startsWith("/*"))continue;let i="",g=0;wn.lastIndex=0;let a;while((a=wn.exec(c))!==null){let M=a.index;if(ni(c,M))continue;let v=c[M-1],A=c[M+2],O=M>0&&v!==" "&&v!=="\t",_=A!==void 0&&A!==" "&&A!=="\t";if(!O&&!_)continue;i+=c.slice(g,M),i+=`${O?" ":""}=>${_?" ":""}`,g=M+2}if(g>0)R[s]=i+c.slice(g)}return R.join(`
|
|
54
|
-
`)}};function Wn(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var ii={meta:{docs:"Require spaces inside single-line blocks",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]!=="{")continue;if(Wn(i,a))continue;if(a>0&&i[a-1]==="$")continue;let M=1,v=-1;for(let O=a+1;O<i.length;O++){if(i[O]==="{"&&!Wn(i,O))M++;if(i[O]==="}"&&!Wn(i,O)){if(M--,M===0){v=O;break}}}if(v===-1)continue;let A=i.slice(a+1,v);if(!A.trim())continue;if(A[0]!==" "&&A[0]!=="\t")s.push({filePath:R.filePath,line:n+1,column:a+2,ruleId:"style/block-spacing",message:"Missing space after '{'",severity:"warning"});if(A[A.length-1]!==" "&&A[A.length-1]!=="\t")s.push({filePath:R.filePath,line:n+1,column:v+1,ruleId:"style/block-spacing",message:"Missing space before '}'",severity:"warning"});break}}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c.replace(/(?<!\$)\{(\S)([^}]*?)(\S)\}/g,(i,g,a,M)=>`{ ${g}${a}${M} }`);n=n.replace(/(?<!\$)\{(\S)([^}]*?)\s\}/g,(i,g,a)=>`{ ${g}${a} }`),n=n.replace(/(?<!\$)\{\s([^}]*?)(\S)\}/g,(i,g,a)=>`{ ${g}${a} }`),s.push(n)}return s.join(`
|
|
55
|
-
`)}};var ri={meta:{docs:"Enforce consistent brace style for blocks",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let g=c[n].trim();if(g.startsWith("//")||g.startsWith("/*"))continue;if(/\}\s+(?:else|catch|finally)\b/.test(g))s.push({filePath:R.filePath,line:n+1,column:g.indexOf("}")+1,ruleId:"style/brace-style",message:"Closing curly brace appears on the same line as the subsequent block",severity:"error"});if(g==="{"&&n>0){let M=c[n-1].trim();if(!M||M.startsWith("//")||M.startsWith("/*")||M.endsWith("*/"))continue;if(M&&!M.endsWith("{")&&!M.endsWith(",")&&!M.endsWith("(")){if(!M.match(/[=:]\s*$/)&&!M.endsWith("["))s.push({filePath:R.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 oi=/,\s*$/,li=new RegExp("^\\s*[}\\])](?:\\s*;?\\s*)?$"),ci={meta:{docs:"Require trailing commas in multiline constructs",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=1;n<c.length;n++){let g=c[n].trim();if(!li.test(g))continue;let a=c[n-1],M=a.trim();if(!M||M==="{"||M==="["||M==="(")continue;if(M.startsWith("//")||M.startsWith("*")||M.startsWith("/*"))continue;if(oi.test(M))continue;if(M.endsWith("{")||M.endsWith("[")||M.endsWith("("))continue;if(M.endsWith("=>"))continue;s.push({filePath:R.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(p){let R=p.split(/\r?\n/),s=[];for(let c=0;c<R.length;c++){let n=R[c];if(c+1<R.length){let i=R[c+1].trim(),g=n.trim();if(li.test(i)&&g&&g!=="{"&&g!=="["&&g!=="("&&!g.startsWith("//")&&!g.startsWith("*")&&!g.startsWith("/*")&&!oi.test(g)&&!g.endsWith("{")&&!g.endsWith("[")&&!g.endsWith("(")&&!g.endsWith("=>")){s.push(n.replace(/(\s*)$/,",$1"));continue}}s.push(n)}return s.join(`
|
|
56
|
-
`)}};function Dl(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var ai={meta:{docs:"Require space after commas, disallow space before commas",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]!==",")continue;if(Dl(i,a))continue;if(a>0&&i[a-1]===" "){if(i.slice(0,a).trim().length>0)s.push({filePath:R.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]!==`
|
|
57
|
-
`&&i[a+1]!=="\r")s.push({filePath:R.filePath,line:n+1,column:a+2,ruleId:"style/comma-spacing",message:"Missing space after comma",severity:"warning"})}}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c;n=n.replace(/ ,/g,","),n=n.replace(/,(\S)/g,", $1"),s.push(n)}return s.join(`
|
|
58
|
-
`)}};var ui={meta:{docs:"Enforce comma-last style (commas at the end of lines, not the beginning)",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;if(g.startsWith(","))s.push({filePath:R.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(p){let R=p.split(/\r?\n/),s=[];for(let c=0;c<R.length;c++){let n=R[c],i=n.trim();if(i.startsWith(",")&&s.length>0){let g=s.length-1;s[g]=s[g].replace(/\s*$/,",");let a=n.match(/^(\s*)/)?.[1]||"";s.push(a+i.slice(1).trim())}else s.push(n)}return s.join(`
|
|
59
|
-
`)}};function jl(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var fi={meta:{docs:"Disallow spaces inside computed property brackets [expr]",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]!=="[")continue;if(jl(i,a))continue;if(a===0)continue;let M=i[a-1];if(!/[a-zA-Z0-9_$)\]]/.test(M))continue;if(a+1<i.length&&(i[a+1]===" "||i[a+1]==="\t"))s.push({filePath:R.filePath,line:n+1,column:a+2,ruleId:"style/computed-property-spacing",message:"Unexpected space after '['",severity:"warning"});let v=1,A=a+1;while(A<i.length&&v>0){if(i[A]==="[")v++;if(i[A]==="]")v--;if(v>0)A++}if(v===0&&A>0){if(i[A-1]===" "||i[A-1]==="\t")s.push({filePath:R.filePath,line:n+1,column:A,ruleId:"style/computed-property-spacing",message:"Unexpected space before ']'",severity:"warning"})}}}return s},fix(p){return p.replace(/([a-zA-Z0-9_$)\]])\[\s+([\s\S]*?)\s+\]/g,"$1[$2]")}};function Ul(p){let R=[],s=p.split(/\r?\n/),c=0;for(let n=0;n<s.length;n++){let i=s[n],g=/\b[\w$)\]]+\s*\./.test(i),a=n+1<s.length&&/^\s*\./.test(s[n+1]);if(g||a){let M=n,v=n;while(M+1<s.length&&/^\s*\./.test(s[M+1]))M++,v=M;if(v>n){let A=c,O=c+s[n].length+1+s.slice(n+1,v+1).join(`
|
|
60
|
-
`).length;R.push({start:A,end:O}),n=v}}c+=i.length+1}return R}var mi={meta:{docs:"Enforce consistent line breaks in member-access/call chains"},check:(p,R)=>{let s=[],c=p.split(/\r?\n/),n=Ul(p);for(let{start:i,end:g}of n){let M=p.slice(i,g).split(/\r?\n/),v=[];for(let U=0;U<M.length;U++){let B=M[U],q=[...B.matchAll(/\./g)].map((z)=>z.index||0);for(let z of q){if(z>0&&B[z-1]==="?")continue;if(/^\s*\./.test(B)&&z===B.indexOf(".")&&B.slice(0,z).trim()==="")v.push("newline");else v.push("inline")}}if(v.length<=1)continue;let A=v[0];if(v.every((U)=>U===A))continue;let O=v.findIndex((U)=>U!==A),_=0;for(let U=0;U<M.length;U++){let B=M[U],q=[...B.matchAll(/\./g)].map((z)=>z.index||0);for(let z of q){if(z>0&&B[z-1]==="?")continue;if(_===O){let G=p.slice(0,i).split(/\r?\n/),X=G.length,V=(G[G.length-1]||"").length;s.push({filePath:R.filePath,line:X+U,column:(U===0?V:0)+z+1,ruleId:"style/consistent-chaining",message:`Inconsistent chaining style: mix of ${A} and ${A==="inline"?"newline":"inline"}.`,severity:"warning"}),U=M.length;break}_++}}}return s}};function pi(p){let R=[0];for(let c=0;c<p.length;c++)if(p[c]===`
|
|
61
|
-
`)R.push(c+1);function s(c){let n=0,i=R.length-1;while(n<=i){let a=n+i>>1,M=R[a],v=a+1<R.length?R[a+1]:1/0;if(c<M)i=a-1;else if(c>=v)n=a+1;else return{line:a+1,column:c-M+1}}let g=R[R.length-1];return{line:R.length,column:Math.max(1,c-g+1)}}return{lineStarts:R,indexToLoc:s}}function di(p){let R=[],s=(i,g,a)=>R.push({type:i,value:p.slice(g,a),start:g,end:a}),c=0,n=p.length;while(c<n){let i=p[c];if(i<=" "){c++;continue}if(i==="/"&&p[c+1]==="/"){let M=c;c+=2;while(c<n&&p[c]!==`
|
|
62
|
-
`)c++;s("LineComment",M,c);continue}if(i==="/"&&p[c+1]==="*"){let M=c;c+=2;while(c<n&&!(p[c]==="*"&&p[c+1]==="/"))c++;c=Math.min(n,c+2),s("BlockComment",M,c);continue}if(i==='"'||i==="'"){let M=i,v=c;c++;while(c<n){let A=p[c];if(A==="\\"){c+=2;continue}if(A===M){c++;break}c++}s("String",v,c);continue}if(i==="`"){let M=c;c++;let v=0;while(c<n){let A=p[c];if(A==="\\"){c+=2;continue}if(A==="`"&&v===0){c++;break}if(A==="$"&&p[c+1]==="{"){v++,c+=2;continue}if(A==="}"&&v>0){v--,c++;continue}c++}s("Template",M,c);continue}if(i==="/"){if(p[c+1]==="/"){let M=c;c+=2;while(c<n&&p[c]!==`
|
|
63
|
-
`)c++;s("LineComment",M,c);continue}if(p[c+1]==="*"){let M=c;c+=2;while(c<n&&!(p[c]==="*"&&p[c+1]==="/"))c++;c=Math.min(n,c+2),s("BlockComment",M,c);continue}if(Fl(R)){let M=c;c++;while(c<n){let v=p[c];if(v==="\\"){c+=2;continue}if(v==="/"){c++;break}c++}while(c<n&&/[a-z]/i.test(p[c]))c++;s("Regex",M,c);continue}s("Punct",c,c+1),c++;continue}if("(){}[];:,.<>+-*%&|^!?=~".includes(i)){s("Punct",c,c+1),c++;continue}let g=c,a=new RegExp("[^\\s(){}[\\];:,.<>+\\-*%&|^!?=~'\"`/]");while(c<n&&a.test(p[c]))c++;if(c>g)s("Word",g,c);else s("Word",c,c+1),c++}return R}function Fl(p){if(p.length===0)return!0;let R=p[p.length-1],s=new RegExp("[(!,{;:?=]");return R.type==="Punct"&&s.test(R.value)||R.type==="Word"&&/^(?:return|throw|case|of|in|instanceof|typeof|void|new)$/.test(R.value)}function hi(p,R,s,c){let n=0,i=(O)=>O<=" ",g=(O)=>{while(O<p.length&&p[O]!==`
|
|
64
|
-
`)O++;return O},a=(O)=>{O+=2;while(O<p.length&&!(p[O]==="*"&&p[O+1]==="/"))O++;return Math.min(p.length,O+2)},M=(O,_)=>{let U=p.length;if(_==="`"){O++;let B=0;while(O<U){let q=p[O];if(q==="\\"){O+=2;continue}if(q==="`"&&B===0){O++;break}if(q==="$"&&p[O+1]==="{"){B++,O+=2;continue}if(q==="}"&&B>0){B--,O++;continue}if(q==='"'||q==="'"){O=M(O,q);continue}if(q==="/"&&p[O+1]==="/"){O=g(O+2);continue}if(q==="/"&&p[O+1]==="*"){O=a(O);continue}O++}return O}O++;while(O<U){let B=p[O];if(B==="\\"){O+=2;continue}if(B===_){O++;break}O++}return O},v=(O)=>{let _=O-1;while(_>=0&&i(p[_]))_--;let U=_>=0?p[_]:"";if(new RegExp("[(:[{;?,=!&|^~+\\-*%<>]").test(U))return!0;if(U==="")return!0;return!1},A=(O)=>{O++;let _=p.length;while(O<_){let U=p[O];if(U==="\\"){O+=2;continue}if(U==="/"){O++;break}O++}while(O<_&&/[a-z]/i.test(p[O]))O++;return O};for(let O=R;O<p.length;O++){let _=p[O];if(_===s){n++;continue}if(_===c){if(n--,n===0)return O;continue}if(_==='"'||_==="'"||_==="`"){O=M(O,_)-1;continue}if(_==="/"&&p[O+1]==="/"){O=g(O+2)-1;continue}if(_==="/"&&p[O+1]==="*"){O=a(O)-1;continue}if(_==="/"&&v(O)){O=A(O)-1;continue}}return-1}var Bl=new Set(["const","let","var","return","if","for","while","do","switch","throw","try","break","continue","function","class","debugger"]);function ql(p){let R=0;for(let n of p){if(n.type!=="Punct")continue;if(n.value==="("||n.value==="["||n.value==="{")R++;else if((n.value===")"||n.value==="]"||n.value==="}")&&R>0)R--;else if(n.value===";"&&R===0)return!0}let[s,c]=p;return s?.type==="Word"&&Bl.has(s.value)&&!(c?.type==="Punct"&&[":",",","(","}","?"].includes(c.value))}function zl(p,R,s,c,n,i,g,a){let M=hi(p,c,n,i);if(M<=c)return;let v=di(p.slice(c+1,M));if(n==="{"&&ql(v))return;let A=[],O=0,_=0,U=c+1,B;for(let Z of v){if(Z.type==="Punct"){let G=Z.value,X=B!==void 0&&B.end===Z.start;if(G==="("||G==="["||G==="{")O++;else if((G===")"||G==="]"||G==="}")&&O>0)O--;else if(G==="<"&&X&&B.type==="Word")_++;else if(G===">"&&_>0&&!(X&&B.value==="="))_--;else if(G===","&&O===0&&_===0)A.push({start:U,end:c+1+Z.start}),U=c+1+Z.end}B=Z}A.push({start:U,end:M});let q=A.map((Z)=>({p:Z,gap:Zl(p,Z.start,Z.end)})).filter((Z)=>Z.gap.at<Z.p.end);if(q.length<2)return;let z=q[0].gap.newline;for(let Z=1;Z<q.length;Z++)if(q[Z].gap.newline!==z){let G=a().indexToLoc(q[Z].gap.at);s.push({filePath:R,line:G.line,column:G.column,ruleId:g,message:z?"Should have line breaks between items":"Should not have line breaks between items",severity:"warning"});return}}function Zl(p,R,s){let c=R,n=!1;while(c<s){let i=p[c];if(i===`
|
|
65
|
-
`)n=!0,c++;else if(i===" "||i==="\t"||i==="\r")c++;else if(i==="/"&&p[c+1]==="/")while(c<s&&p[c]!==`
|
|
66
|
-
`)c++;else if(i==="/"&&p[c+1]==="*"){let g=p.indexOf("*/",c+2);c=g===-1||g+2>s?s:g+2}else break}return{at:c,newline:n}}var gi={meta:{docs:"Enforce consistent newlines for list-like constructs (objects, arrays, named imports/exports)"},check:(p,R)=>{let s=_e(p),c=[],n="style/consistent-list-newline",i,g=()=>i??=pi(s),a=new Set,M=(v,A,O)=>{if(a.has(v))return;a.add(v),zl(s,R.filePath,c,v,A,O,"style/consistent-list-newline",g)};for(let v=0;v<s.length;v++){let A=s[v];if(A==="{"){let O=v-1;while(O>=0&&/[ \t]/.test(s[O]))O--;if(O>=0&&s[O]===")")continue;if(O>=1&&s[O]===">"&&s[O-1]==="=")continue;let _=s.slice(Math.max(0,v-60),v);if(/\b(?:function|class|interface|type|enum|try|catch|finally|if|else|for|while|switch)\b[\s\S]*$/.test(_))continue;M(v,"{","}")}else if(A==="[")M(v,"[","]");else if(A==="i"&&s.startsWith("import",v)){let O=s.indexOf("{",v);if(O>-1)M(O,"{","}")}else if(A==="e"&&s.startsWith("export",v)){let O=s.indexOf("{",v);if(O>-1)M(O,"{","}")}}return c}};function Gl(p){let R=p.trim();return R===""||R.startsWith("//")||R.startsWith("/*")}function Nn(p,R){for(let s=R;s<p.length;s++)if(!Gl(p[s]))return s;return-1}function Fe(p,R,s){if(p[R].slice(s).includes("{"))return!0;let n=Nn(p,R+1);if(n>=0){if(p[n].trim().startsWith("{"))return!0}return!1}function kn(p,R,s){let c=p[R].slice(s);if(/\bif\b|\bfor\b|\bwhile\b|\bdo\b/.test(c))return!0;return!1}var bi={meta:{docs:"Enforce curly brackets similar to src-2: require braces when any branch/body requires them"},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let i=0;i<c.length;i++){let g=c[i],a=g.match(/^(\s*)if\s*\(([^)]*)\)/);if(a){let v=a[0].length,A=Fe(c,i,v),O=kn(c,i,v),_=i,U=A,B=O;while(!0){let q=Nn(c,_+1);if(q<0)break;let z=c[q].trim();if(!z.startsWith("else"))break;let Z=z.match(/^else\s+if\s*\(([^)]*)\)/);if(Z){let G=c[q].indexOf(Z[0])+Z[0].length;U=U||Fe(c,q,G),B=B||kn(c,q,G),_=q;continue}else{let G=c[q].indexOf("else")+4;U=U||Fe(c,q,G),B=B||kn(c,q,G),_=q;break}}if(U||B){if(!A)s.push({filePath:R.filePath,line:i+1,column:Math.max(1,g.indexOf("if")+1),ruleId:"style/curly",message:"Expect curly brackets",severity:"warning"});let q=i;while(!0){let z=Nn(c,q+1);if(z<0)break;let Z=c[z],G=Z.trim();if(!G.startsWith("else"))break;let X=G.match(/^else\s+if\s*\(([^)]*)\)/);if(X){let V=Z.indexOf(X[0])+X[0].length;if(!Fe(c,z,V))s.push({filePath:R.filePath,line:z+1,column:Math.max(1,Z.indexOf("else")+1),ruleId:"style/curly",message:"Expect curly brackets",severity:"warning"});q=z;continue}else{let V=Z.indexOf("else")+4;if(!Fe(c,z,V))s.push({filePath:R.filePath,line:z+1,column:Math.max(1,Z.indexOf("else")+1),ruleId:"style/curly",message:"Expect curly brackets",severity:"warning"});break}}}}let M=g.match(/^(\s*)(while|do|for|for\s+await)\b/);if(M){let v=M[0].length,A=Fe(c,i,v),O=kn(c,i,v);if((A||O)&&!A)s.push({filePath:R.filePath,line:i+1,column:Math.max(1,g.indexOf(M[2])+1),ruleId:"style/curly",message:"Expect curly brackets",severity:"warning"})}}let n=Vl(p,R.filePath);for(let i of n)s.push({filePath:R.filePath,line:i.line,column:i.column,ruleId:"style/curly",message:i.message,severity:"warning"});return s}};function Vl(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim(),a=/^if\s*\(/.test(g)?"if":/^else\s+if\s*\(/.test(g)?"else-if":/^else\b/.test(g)?"else":null;if(!a)continue;let M=0;if(a==="if"){let B=i.match(/if\s*\([^)]*\)/);M=B?i.indexOf(B[0])+B[0].length:i.indexOf("if")+2}else if(a==="else-if"){let B=i.match(/else\s+if\s*\([^)]*\)/);M=B?i.indexOf(B[0])+B[0].length:i.indexOf("else")+4}else M=i.indexOf("else")+4;let v=n,A=i.indexOf("{",M);if(A<0){let B=function(z){for(let Z=z;Z<c.length;Z++)if(c[Z].trim()!=="")return Z;return-1}(n+1);if(B<0)continue;if(A=c[B].indexOf("{"),A<0)continue;v=B}let O=0,_=-1;for(let B=v;B<c.length;B++){let q=c[B],z=B===v?Math.max(0,A):0;for(let Z=z;Z<q.length;Z++){let G=q[Z];if(G==="{")O++;else if(G==="}"){if(O--,O===0){_=B;break}}}if(_>=0)break}if(_<0)continue;let U=[];for(let B=v+1;B<_;B++){let q=c[B].trim();if(q===""||/^\/\//.test(q))continue;if(U.push(q),U.length>1)break}if(U.length===1&&_===v+2){let B=U[0],q=/^(?:if|for|while|do|switch|try|catch|else)\b/.test(B),z=/[{}]/.test(B),Z=(B.match(/\(/g)||[]).length,G=(B.match(/\)/g)||[]).length,X=Z!==G,V=!1;for(let K=n+1;K<c.length;K++){let ie=c[K].trim();if(ie===""||ie==="}"||/^\/\//.test(ie))continue;if(!/^else\b/.test(ie))break;let ue=c[K].indexOf("else")+4,me=ie.match(/^else\s+if\s*\([^)]*\)/);if(me)ue=c[K].indexOf(me[0])+me[0].length;let H=K,re=c[K].indexOf("{",ue);if(re<0){let le=function(fe){for(let oe=fe;oe<c.length;oe++)if(c[oe].trim()!=="")return oe;return-1}(K+1);if(le<0)break;if(re=c[le].indexOf("{"),re<0)continue;H=le}let se=0,ne=-1;for(let le=H;le<c.length;le++){let te=c[le],fe=le===H?Math.max(0,re):0;for(let oe=fe;oe<te.length;oe++){let ae=te[oe];if(ae==="{")se++;else if(ae==="}"){if(se--,se===0){ne=le;break}}}if(ne>=0)break}if(ne>=0){let le=0;for(let te=H+1;te<ne;te++){let fe=c[te].trim();if(fe===""||/^\/\//.test(fe))continue;if(le++,le>1){V=!0;break}}}if(V)break}if(!V&&a==="if"){let K=function(ue){for(let me=ue;me<c.length;me++){let H=c[me].trim();if(H!==""&&H!=="}"&&!/^\/\//.test(H))return me}return-1}(_+1);if(K>=0&&/^else\b/.test(c[K].trim())){let ie=c[K].indexOf("else")+4,ue=c[K].trim().match(/^else\s+if\s*\([^)]*\)/);if(ue)ie=c[K].indexOf(ue[0])+ue[0].length;let me=K,H=c[K].indexOf("{",ie);if(H<0){let re=function(ne){for(let le=ne;le<c.length;le++)if(c[le].trim()!=="")return le;return-1}(K+1);if(re>=0)H=c[re].indexOf("{"),me=H>=0?re:me}if(H>=0){let re=0,se=-1;for(let ne=me;ne<c.length;ne++){let le=c[ne],te=ne===me?Math.max(0,H):0;for(let fe=te;fe<le.length;fe++){let oe=le[fe];if(oe==="{")re++;else if(oe==="}"){if(re--,re===0){se=ne;break}}}if(se>=0)break}if(se>=0){let ne=0;for(let le=me+1;le<se;le++){let te=c[le].trim();if(te===""||/^\/\//.test(te))continue;if(++ne>1){V=!0;break}}}}}}if(!q&&!z&&!X&&!V)s.push({line:v+1,column:Math.max(1,c[v].indexOf("{")+1),message:"Unnecessary curly braces around single statement"})}}return s}var yi={meta:{docs:"Enforce dot on the property line in chained method calls",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/),n=We(p);for(let i=0;i<c.length;i++){let g=c[i],a=g.trim();if(!a||a.startsWith("//")||a.startsWith("*")||a.startsWith("/*"))continue;if(n[i+1])continue;if(a.endsWith(".")&&i+1<c.length){let M=c[i+1].trim();if(M&&/^[a-zA-Z_$]/.test(M))s.push({filePath:R.filePath,line:i+1,column:g.length,ruleId:"style/dot-location",message:"Dot should be on the same line as the property",severity:"warning"})}}return s},fix(p){let R=p.split(/\r?\n/),s=[],c=We(p);for(let n=0;n<R.length;n++){let i=R[n];if(i.trim().endsWith(".")&&!c[n+1]&&n+1<R.length){let a=R[n+1],M=a.trim();if(M&&/^[a-zA-Z_$]/.test(M)){s.push(i.replace(/\.\s*$/,""));let v=a.match(/^(\s*)/)?.[1]||"";R[n+1]=`${v}.${M}`;continue}}s.push(i)}return s.join(`
|
|
67
|
-
`)}};function xi(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Ri=["===","!==",">>>","==","!=",">=","<=","&&","||","??","**","<<",">>","+","-","*","/","%","|","&","^",">","<","instanceof","in"],Ud=new RegExp(`^(${Ri.map((p)=>p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")})\\s`),Kl=new Set(["in","instanceof"]),Hl=/^(?:instanceof|in)\s/;function In(p){if(Hl.test(p))return!0;for(let R of Ri){if(Kl.has(R))continue;if(p.startsWith(R)){let s=p[R.length];if(s===void 0||s===" "||s==="\t")return!0}}return!1}function Dn(p){let R=p.match(/^(\s*)/);return R?R[1].length:0}var wi={meta:{docs:"Enforce consistent indentation of continuation lines in multiline binary expressions",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;if(!In(g))continue;if(xi(i,0))continue;let a=n-1;while(a>=0){let A=c[a].trim();if(!A||A.startsWith("//")||A.startsWith("*")||A.startsWith("/*")){a--;continue}if(In(A)){a--;continue}break}if(a<0)continue;let M=Dn(c[a])+2,v=Dn(i);if(v!==M)s.push({filePath:R.filePath,line:n+1,column:v+1,ruleId:"style/indent-binary-ops",message:`Expected indentation of ${M} spaces for binary operator continuation, but found ${v}`,severity:"warning"})}return s},fix(p,R){let s=p.split(/\r?\n/),c=[];for(let n=0;n<s.length;n++){let i=s[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*")){c.push(i);continue}if(!In(g)||xi(i,0)){c.push(i);continue}let a=-1;for(let A=c.length-1;A>=0;A--){let O=c[A].trim();if(!O||O.startsWith("//")||O.startsWith("*")||O.startsWith("/*"))continue;if(In(O))continue;a=A;break}if(a<0){c.push(i);continue}let M=Dn(c[a])+2,v=" ".repeat(M)+g;c.push(v);continue}return c.join(`
|
|
68
|
-
`)}};var ki=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 Ii(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Pi={meta:{docs:"Disallow spaces between function name and opening parenthesis in calls",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;Pn.lastIndex=0;while((a=Pn.exec(i))!==null){let M=a[1],v=a.index;if(Ii(i,v))continue;if(ki.has(M))continue;let A=i.slice(0,v).trimEnd();if(A.endsWith("function")||A.endsWith("function*"))continue;if(/\b(?:get|set)\s*$/.test(A))continue;let O=v+M.length;s.push({filePath:R.filePath,line:n+1,column:O+1,ruleId:"style/function-call-spacing",message:"Unexpected space between function name and parenthesis",severity:"warning"})}}return s},fix(p,R){let s=p.split(/\r?\n/),c=[];for(let n=0;n<s.length;n++){let i=s[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*")){c.push(i);continue}let a=i,M=[],v;Pn.lastIndex=0;while((v=Pn.exec(i))!==null){let A=v[1],O=v.index;if(Ii(i,O))continue;if(ki.has(A))continue;let _=i.slice(0,O).trimEnd();if(_.endsWith("function")||_.endsWith("function*"))continue;if(/\b(?:get|set)\s*$/.test(_))continue;M.push({index:O,fullMatch:v[0],identifier:A})}for(let A=M.length-1;A>=0;A--){let O=M[A],_=O.index,U=_+O.fullMatch.length;a=`${a.slice(0,_)}${O.identifier}(${a.slice(U)}`}c.push(a)}return c.join(`
|
|
69
|
-
`)}};var Mi=/\bfunction\s*\*/g;function vi(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var $i={meta:{docs:"Enforce spacing around * in generator functions (space after, no space before)",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;Mi.lastIndex=0;while((a=Mi.exec(i))!==null){let v=a.index;if(vi(i,v))continue;let A=a[0],O=v+A.indexOf("*"),_=O+1;if(A!=="function*")s.push({filePath:R.filePath,line:n+1,column:O+1,ruleId:"style/generator-star-spacing",message:"Unexpected space before * in generator function",severity:"warning"});if(_<i.length&&i[_]!==" "&&i[_]!=="\t"&&i[_]!==`
|
|
70
|
-
`&&i[_]!=="(")s.push({filePath:R.filePath,line:n+1,column:_+1,ruleId:"style/generator-star-spacing",message:"Missing space after * in generator function",severity:"warning"})}if(g.match(/^(?:async\s+)?\*\s*([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/)){let v=i.indexOf("*",i.indexOf(g.charAt(0)));if(!vi(i,v)){let A=v+1;if(A<i.length&&i[A]!==" "&&i[A]!=="\t")s.push({filePath:R.filePath,line:n+1,column:A+1,ruleId:"style/generator-star-spacing",message:"Missing space after * in generator method",severity:"warning"})}}}return s},fix(p,R){let s=p;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 Ci={meta:{docs:"Enforce newline after if when without braces"},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];if(!i.match(/^\s*if\s*\([^)]*\)\s*([^\s{/].*)$/))continue;s.push({filePath:R.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 Yl=["$","unindent","unIndent"],Li={meta:{docs:"Enforce consistent indentation inside unindent-style tagged templates"},check:(p,R)=>{let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.match(/^\s*/)?.[0]??"",a=/([$A-Z_][\w$]*)\s*`/gi,M;while(M=a.exec(i)){let v=M[1];if(!Yl.includes(v))continue;if(i.slice(M.index+M[0].length).includes("`"))continue;let O=-1;for(let U=n+1;U<c.length;U++)if(c[U].includes("`")){O=U;break}if(O<0)continue;let _=`${g} `;for(let U=n+1;U<O;U++){let B=c[U];if(B.trim()==="")continue;let q=B.match(/^\s*/)?.[0]??"";if(!q.startsWith(_)){s.push({filePath:R.filePath,line:U+1,column:(q.length||0)+1,ruleId:"style/indent-unindent",message:"Consistent indentation in unindent tag",severity:"warning"});break}}}}return s}};var Xl=/^(\s*)(["']?[a-zA-Z_$][a-zA-Z0-9_$]*["']?\s*(?:\?)?):(\S)/;function Si(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Ei={meta:{docs:"Require space after colon in object properties",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a=i.match(Xl);if(a){let v=i.indexOf(":",a[1].length);if(v!==-1&&!Si(i,v)){let A=i[v+1];if(A&&A!==" "&&A!=="\t"&&A!==`
|
|
71
|
-
`)s.push({filePath:R.filePath,line:n+1,column:v+2,ruleId:"style/key-spacing",message:"Missing space after colon in property",severity:"warning"})}}let M=g.match(/^(["']?[a-zA-Z_$][a-zA-Z0-9_$]*["']?)\s+:/);if(M&&!g.match(/^\s*(case|default)\b/)){let v=i.indexOf(":",i.indexOf(M[1])+M[1].length);if(v!==-1&&!Si(i,v))s.push({filePath:R.filePath,line:n+1,column:v+1,ruleId:"style/key-spacing",message:"Unexpected space before colon in property",severity:"warning"})}}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c;n=n.replace(/^(\s*)(["']?[a-zA-Z_$][a-zA-Z0-9_$]*["']?\s*(?:\?)?):(\S)/,"$1$2: $3"),s.push(n)}return s.join(`
|
|
72
|
-
`)}};var Jl=["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"],Ai=new RegExp(`(?:^|[^\\w$.])(${Jl.join("|")})(?=[^\\w$]|$)`,"g");function Ql(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Oi={meta:{docs:"Require space before and after keywords",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;Ai.lastIndex=0;while((a=Ai.exec(i))!==null){let M=a[0].charAt(0)===a[1].charAt(0)?"":a[0].charAt(0),v=a.index+M.length,A=v+a[1].length;if(Ql(i,v))continue;if(v>0){let O=i[v-1];if(O===")"||O==="}")s.push({filePath:R.filePath,line:n+1,column:v+1,ruleId:"style/keyword-spacing",message:`Missing space before keyword '${a[1]}'`,severity:"warning"})}if(A<i.length){let O=i[A];if(O!==" "&&O!=="\t"&&O!==";"&&O!==","&&O!==":"&&O!=="."){if(O==="("&&(a[1]==="if"||a[1]==="for"||a[1]==="while"||a[1]==="switch"||a[1]==="catch"))s.push({filePath:R.filePath,line:n+1,column:A+1,ruleId:"style/keyword-spacing",message:`Missing space after keyword '${a[1]}'`,severity:"warning"})}}}}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c;for(let i of["if","for","while","switch","catch"]){let g=new RegExp(`(\\b${i})\\(`,"g");n=n.replace(g,"$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(`
|
|
73
|
-
`)}};var _i=/^\s*(?:public|private|protected|static|readonly|abstract|override|async|get|set|\*|#|[a-zA-Z_$])/,Ti={meta:{docs:"Require blank line between class members",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/),n=!1,i=0,g=0,a=-1;for(let M=0;M<c.length;M++){let A=c[M].trim();if(A.match(/\bclass\b/)&&(A.includes("{")||M+1<c.length&&c[M+1].trim()==="{"))n=!0,g=i+1;let O=i;for(let _ of A){if(_==="{")i++;if(_==="}")i--}if(n&&i<g){n=!1,a=-1;continue}if(!n)continue;if(O>g&&i===g&&A.endsWith("}")){a=M;continue}if(O===g){if(!A||A.startsWith("//")||A.startsWith("*")||A.startsWith("/*")||A==="}")continue;if(_i.test(A)){if(a!==-1&&M===a+1)s.push({filePath:R.filePath,line:M+1,column:1,ruleId:"style/lines-between-class-members",message:"Missing blank line between class members",severity:"warning"});if(!A.endsWith("{"))a=M}}}return s},fix(p,R){let s=p.split(/\r?\n/),c=[],n=!1,i=0,g=0,a=-1;for(let M=0;M<s.length;M++){let v=s[M],A=v.trim();if(A.match(/\bclass\b/)&&(A.includes("{")||M+1<s.length&&s[M+1].trim()==="{"))n=!0,g=i+1;let O=i;for(let _ of A){if(_==="{")i++;if(_==="}")i--}if(n&&i<g){n=!1,a=-1,c.push(v);continue}if(n&&O>g&&i===g&&A.endsWith("}")){a=M,c.push(v);continue}if(n&&O===g&&A&&!A.startsWith("//")&&!A.startsWith("*")&&!A.startsWith("/*")&&A!=="}"&&_i.test(A)){if(a!==-1&&M===a+1)c.push("");if(!A.endsWith("{"))a=M}c.push(v)}return c.join(`
|
|
74
|
-
`)}};var Wi={meta:{docs:"Limit the number of statements allowed on a single line"},check:(p,R)=>{let s=R.options&&typeof R.options.max==="number"?R.options.max:1,c=[],n=_e(p).split(/\r?\n/),i=(g)=>{let a=ec(g),M=(a>=0?g.slice(0,a):g).replace(/^\s*;+/,""),v=0,A=!1,O=!1,_=!1,U=!1,B=!1,q=!1,z=0,Z="",G=(K)=>{if(K===" "||K==="\t")return;Z=K};for(let K=0;K<M.length;K++){let ie=M[K];if(B){B=!1;continue}if(ie==="\\"){B=!0;continue}if(_){if(U){if(ie==="]")U=!1;continue}if(ie==="["){U=!0;continue}if(ie==="/"){_=!1;while(K+1<M.length&&/[a-z]/i.test(M[K+1]))K++;Z="/"}continue}if(!O&&ie==="'"){A=!A,G(A?"'":"x");continue}if(!A&&ie==='"'){O=!O,G(O?'"':"x");continue}if(A||O)continue;if(ie==="/"&&Ni(Z,M,K)){_=!0;continue}if(!q){if(ie==="f"&&M.slice(K,K+4).match(/^for\b/)){let ue=M.slice(K+3).trimStart(),me=M.length-ue.length;if(M[me]==="("){q=!0,z=1,K=me,Z="(";continue}}}else if(ie==="(")z++;else if(ie===")"){if(z--,z<=0)q=!1}else if(ie===";"){G(ie);continue}if(ie===";")v++;G(ie)}if(v===0)return 1;return M.trimEnd().endsWith(";")?v:v+1};for(let g=0;g<n.length;g++){let a=n[g];if(/^\s*$/.test(a))continue;let M=a.includes(";")?i(a):1;if(M>s)c.push({filePath:R.filePath,line:g+1,column:1,ruleId:"max-statements-per-line",message:`This line has ${M} statements. Maximum allowed is ${s}`,severity:"warning"})}return c}};function ec(p){let R=!1,s=!1,c=!1,n=!1,i=!1,g=!1,a="";for(let M=0;M<p.length;M++){let v=p[M];if(g){g=!1;continue}if(v==="\\"){g=!0;continue}if(n){if(i){if(v==="]")i=!1;continue}if(v==="["){i=!0;continue}if(v==="/"){n=!1;while(M+1<p.length&&/[a-z]/i.test(p[M+1]))M++;a="/"}continue}if(!s&&!c&&v==="'"){R=!R,a=v;continue}if(!R&&!c&&v==='"'){s=!s,a=v;continue}if(!R&&!s&&v==="`"){c=!c,a=v;continue}if(R||s||c)continue;if(v==="/"&&p[M+1]==="/")return M;if(v==="/"&&Ni(a,p,M)){n=!0;continue}if(v!==" "&&v!=="\t")a=v}return-1}function Ni(p,R,s){if(p==="")return!0;if("([{,:;!?&|=<>~^+*%-".includes(p))return!0;if(/[A-Za-z_$]/.test(p)){if(R.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 Di(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var ji={meta:{docs:"Enforce consistent multiline ternary expressions",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a=i.indexOf("?");if(a===-1)continue;if(i[a+1]==="."||i[a+1]==="?")continue;if(Di(i,a))continue;if(i.indexOf(":",a+1)!==-1)continue;for(let v=n+1;v<Math.min(n+10,c.length);v++){let A=c[v].trim();if(A.startsWith(":"))break;let O=A.indexOf(":");if(O>0&&!Di(c[v],O)){if(A.match(/^\w+\s*:/)||A.match(/^case\b/))continue;s.push({filePath:R.filePath,line:v+1,column:c[v].indexOf(":")+1,ruleId:"style/multiline-ternary",message:"In multiline ternary, ':' should be at the start of the line",severity:"warning"});break}}}return s}};var Ui=new RegExp("\\bnew\\s+([A-Z][a-zA-Z0-9_$.]+)(?![a-zA-Z0-9_$])(?:\\s*<[^>]*>)?\\s*(?=[^(;\\n]|$)","g");function tc(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Fi={meta:{docs:"Require parentheses when invoking a constructor with no arguments",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;Ui.lastIndex=0;while((a=Ui.exec(i))!==null){if(tc(i,a.index))continue;if(i.slice(a.index+a[0].length).startsWith("("))continue;if(a[0].includes("new."))continue;s.push({filePath:R.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(p){return p.replace(/\bnew\s+([A-Z][a-zA-Z0-9_$.]+)(?![a-zA-Z0-9_$])(\s*<[^>]*>)?\s*(?=[^(]|$)/g,(R,s,c)=>{if(R.slice(R.indexOf(s)+s.length+(c?.length||0)).trim().startsWith("("))return R;return`new ${s}${c||""}()`})}};var Qd=new RegExp("\\breturn\\s+\\(([^()]*)\\)\\s*[;\\n]","g"),Bi=/^[a-zA-Z_$][a-zA-Z0-9_$.[\]'"`]*$/;var qi={meta:{docs:"Remove redundant parentheses in return statements",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a=new RegExp("^return\\s+\\(([^()]*)\\)\\s*;?\\s*$"),M=g.match(a);if(M){let v=M[1].trim();if(Bi.test(v)||/^['"`]/.test(v)||/^\d/.test(v)||v==="true"||v==="false"||v==="null"||v==="undefined")s.push({filePath:R.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(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c.trim(),i=new RegExp("^return\\s+\\(([^()]*)\\)\\s*(;?)\\s*$"),g=n.match(i);if(g){let a=g[1].trim(),M=g[2];if(Bi.test(a)||/^['"`]/.test(a)||/^\d/.test(a)||a==="true"||a==="false"||a==="null"||a==="undefined"){let v=c.match(/^(\s*)/)?.[1]||"";s.push(`${v}return ${a}${M}`);continue}}s.push(c)}return s.join(`
|
|
75
|
-
`)}};var zi=/(\S)\s+(\.)[a-zA-Z_$]/g,Zi=/(\S)\s+(\?\.)[a-zA-Z_$]/g;function Mn(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Gi={meta:{docs:"Disallow whitespace before . or ?. in property access",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;zi.lastIndex=0;while((a=zi.exec(i))!==null){let M=a.index+a[0].indexOf(".");if(Mn(i,a.index))continue;if(M+1<i.length&&i[M+1]===".")continue;if(M>0&&i[M-1]===".")continue;s.push({filePath:R.filePath,line:n+1,column:M+1,ruleId:"style/no-whitespace-before-property",message:"Unexpected whitespace before property access dot",severity:"warning"})}Zi.lastIndex=0;while((a=Zi.exec(i))!==null){let M=a.index+a[0].indexOf("?.");if(Mn(i,a.index))continue;s.push({filePath:R.filePath,line:n+1,column:M+1,ruleId:"style/no-whitespace-before-property",message:"Unexpected whitespace before optional chaining operator",severity:"warning"})}}return s},fix(p,R){let s=p.split(/\r?\n/),c=[];for(let n=0;n<s.length;n++){let i=s[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*")){c.push(i);continue}let a=i;a=a.replace(/(\S)\s+(\?\.[a-zA-Z_$])/g,(M,v,A,O)=>{if(Mn(i,O))return M;return v+A}),a=a.replace(/(\S)\s+(\.[a-zA-Z_$])/g,(M,v,A,O)=>{if(Mn(i,O))return M;let _=O+M.indexOf(".");if(_+1<a.length&&a[_+1]===".")return M;return v+A}),c.push(a)}return c.join(`
|
|
76
|
-
`)}};function Be(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Vi=/&&/g,Ki=/\|\|/g,Hi=/\?\?/g,Yi=/(?<![&])&(?![&=])/g,Xi=/(?<![|])\|(?![|=])/g,Ji=/\^(?!=)/g;function nc(p){let R=[];Vi.lastIndex=0;let s;while((s=Vi.exec(p))!==null)if(!Be(p,s.index))R.push({op:"&&",group:0,index:s.index});Ki.lastIndex=0;while((s=Ki.exec(p))!==null)if(!Be(p,s.index))R.push({op:"||",group:1,index:s.index});Hi.lastIndex=0;while((s=Hi.exec(p))!==null)if(!Be(p,s.index))R.push({op:"??",group:2,index:s.index});Yi.lastIndex=0;while((s=Yi.exec(p))!==null)if(!Be(p,s.index))R.push({op:"&",group:3,index:s.index});Xi.lastIndex=0;while((s=Xi.exec(p))!==null)if(!Be(p,s.index))R.push({op:"|",group:4,index:s.index});Ji.lastIndex=0;while((s=Ji.exec(p))!==null)if(!Be(p,s.index))R.push({op:"^",group:5,index:s.index});return R.sort((c,n)=>c.index-n.index)}function sc(p,R){if(R.length<2)return!0;let s=[];for(let i of R){let g=0;for(let a=0;a<i.index;a++)if(p[a]==="(")g++;else if(p[a]===")")g--;s.push(g)}let c=new Map;for(let i=0;i<R.length;i++){let g=R[i].group;if(!c.has(g))c.set(g,[]);c.get(g).push(s[i])}let n=[...c.entries()];if(n.length===2){let[,i]=n[0],[,g]=n[1],a=Math.min(...i),M=Math.max(...i),v=Math.min(...g),A=Math.max(...g);if(a>A||v>M)return!0}return!1}var ic=[{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 ^"}],Qi={meta:{docs:"Disallow mixed logical/bitwise operators without parentheses",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a=nc(i);if(a.length<2)continue;let M=new Set(a.map((v)=>v.group));for(let v of ic)if(M.has(v.groups[0])&&M.has(v.groups[1])){let A=a.filter((O)=>O.group===v.groups[0]||O.group===v.groups[1]);if(!sc(i,A)){let O=A.find((_)=>_.group===v.groups[1]);if(O)s.push({filePath:R.filePath,line:n+1,column:O.index+1,ruleId:"style/no-mixed-operators",message:`Unexpected mix of ${v.label} without parentheses`,severity:"warning"})}}}return s}};var er=/(?<![0-9.])\.\d/g,tr=/\d\.(?!\d|\.|\w)/g;function nr(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var sr={meta:{docs:"Disallow floating decimals like .5 or 2.",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;er.lastIndex=0;while((a=er.exec(i))!==null){if(nr(i,a.index))continue;if(a.index>0){let M=i[a.index-1];if(/[a-zA-Z_$)\]]/.test(M))continue}s.push({filePath:R.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"})}tr.lastIndex=0;while((a=tr.exec(i))!==null){if(nr(i,a.index))continue;s.push({filePath:R.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(p){let R=p;return R=R.replace(/(?<![a-zA-Z_$0-9.)\]])\.\d/g,(s)=>`0${s}`),R=R.replace(/(\d)\.(?!\d|\.|\w)/g,(s,c)=>`${c}.0`),R}};var ir={meta:{docs:"Disallow mixed spaces and tabs for indentation",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let g=c[n].match(/^(\s*)/)?.[1]||"";if(!g)continue;let a=g.includes("\t"),M=g.includes(" ");if(a&&M)s.push({filePath:R.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 rr={meta:{docs:"Disallow multiple consecutive spaces",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];if(!i.trim())continue;let g=i.match(/^(\s*)/)?.[1]||"",a=i.slice(g.length),M=/ {2,}/g,v;for(v=M.exec(a);v!==null;v=M.exec(a)){let A=g.length+v.index+1,O=a.slice(0,v.index),_=(O.match(/'/g)||[]).length,U=(O.match(/"/g)||[]).length,B=(O.match(/`/g)||[]).length;if(_%2===1||U%2===1||B%2===1)continue;if(O.includes("//"))continue;if(i.trim().startsWith("*")||i.trim().startsWith("/*"))continue;s.push({filePath:R.filePath,line:n+1,column:A,ruleId:"style/no-multi-spaces",message:"Multiple spaces found",severity:"warning",help:"Remove extra spaces. Use single spaces between tokens."})}}return s}};var or={meta:{docs:"Disallow multiple consecutive blank lines",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/),n=0,i=-1;for(let g=0;g<c.length;g++)if(c[g].trim()===""){if(n++,i===-1)i=g;if(n>1&&g===i+n-1)s.push({filePath:R.filePath,line:g+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 lr={meta:{docs:"Disallow tab characters (when using spaces for indentation)",recommended:!1},check(p,R){let s=[];if(R.config.format?.indentStyle==="tabs")return s;let c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let g=c[n].indexOf("\t");if(g!==-1)s.push({filePath:R.filePath,line:n+1,column:g+1,ruleId:"style/no-tabs",message:"Unexpected tab character",severity:"warning",help:"Use spaces for indentation instead of tabs."})}return s},fix(p,R){let s=R.config.format?.indent??2;return p.replace(/\t/g," ".repeat(s))}};var cr={meta:{docs:"Disallow trailing whitespace at the end of lines",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.match(/(\s+)$/);if(g){let a=i.length-g[1].length+1;s.push({filePath:R.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 ar(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var ur={meta:{docs:"Require spaces inside curly braces in objects and destructuring",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]==="{"&&!ar(i,a)){let M=i[a+1];if(M==="}"||M===void 0||M===`
|
|
77
|
-
`)continue;if(a>0&&i[a-1]==="$")continue;if(M!==" "&&M!=="\t")s.push({filePath:R.filePath,line:n+1,column:a+2,ruleId:"style/object-curly-spacing",message:"Missing space after '{'",severity:"warning"})}if(i[a]==="}"&&!ar(i,a)){let M=a>0?i[a-1]:void 0;if(M==="{"||M===void 0||M===`
|
|
78
|
-
`)continue;if(a+1<i.length&&i.slice(a+1).match(/^[^}]*\$\{/))continue;if(M!==" "&&M!=="\t")s.push({filePath:R.filePath,line:n+1,column:a+1,ruleId:"style/object-curly-spacing",message:"Missing space before '}'",severity:"warning"})}}}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c;n=n.replace(/(?<!\$)\{(\S)/g,(i,g)=>{if(g==="}")return i;return`{ ${g}`}),n=n.replace(/(\S)\}/g,(i,g)=>{if(g==="{"||g==="$")return i;return`${g} }`}),s.push(n)}return s.join(`
|
|
79
|
-
`)}};var fr=/(\&\&|\|\||\?\?|\?|\+|(?<!=)-(?!=)|\*|\/|%|\*\*|\|(?!\|)|&(?!&)|\^|<<|>>>?)\s*$/;function mr(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var pr={meta:{docs:"Enforce operators at the beginning of continued lines",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a=g.match(fr);if(a&&n+1<c.length){let M=c[n+1].trim();if(M&&!M.startsWith("//")&&!M.startsWith("*")){let v=i.lastIndexOf(a[1]);if(!mr(i,v)){if(a[1]==="?"||a[1]===":")continue;s.push({filePath:R.filePath,line:n+1,column:v+1,ruleId:"style/operator-linebreak",message:`Operator '${a[1]}' should be at the beginning of the next line`,severity:"warning"})}}}}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c=0;c<R.length;c++){let n=R[c],i=n.trim();if(!i||i.startsWith("//")||i.startsWith("*")||i.startsWith("/*")||i.endsWith("*/")){s.push(n);continue}let g=i.match(fr);if(g&&c+1<R.length&&g[1]!=="?"&&g[1]!==":"){let a=R[c+1],M=a.trim();if(M&&!M.startsWith("//")&&!M.startsWith("*")){let v=g[1],A=n.lastIndexOf(g[1]);if(mr(n,A)){s.push(n);continue}s.push(n.replace(new RegExp(`\\s*${v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let O=a.match(/^(\s*)/)?.[1]||"";R[c+1]=`${O}${v} ${M}`;continue}}s.push(n)}return s.join(`
|
|
80
|
-
`)}};var dr={meta:{docs:"Disallow empty lines at the beginning and end of blocks",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let g=c[n].trim();if(g.endsWith("{")&&n+1<c.length){if(c[n+1].trim()==="")s.push({filePath:R.filePath,line:n+2,column:1,ruleId:"style/padded-blocks",message:"Unexpected empty line after opening brace",severity:"warning"})}if(g==="}"&&n>0){if(c[n-1].trim()==="")s.push({filePath:R.filePath,line:n,column:1,ruleId:"style/padded-blocks",message:"Unexpected empty line before closing brace",severity:"warning"})}}return s},fix(p){let R=p.split(/\r?\n/),s=new Set;for(let c=0;c<R.length;c++){let n=R[c].trim();if(n.endsWith("{")&&c+1<R.length&&R[c+1].trim()==="")s.add(c+1);if(n==="}"&&c>0&&R[c-1].trim()==="")s.add(c-1)}return R.filter((c,n)=>!s.has(n)).join(`
|
|
81
|
-
`)}};var jn=/^(\s*)(["'])([a-zA-Z_$][a-zA-Z0-9_$]*)\2\s*:/;var hr={meta:{docs:"Remove unnecessary quotes from object property keys",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a=i.match(jn);if(a){let M=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(M))continue;s.push({filePath:R.filePath,line:n+1,column:i.indexOf(a[2])+1,ruleId:"style/quote-props",message:`Unnecessarily quoted property '${M}'`,severity:"warning",help:"Remove quotes from this property key."})}}return s},fix(p){let R=p.split(/\r?\n/),s=[],c=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 R){let i=n,g=n.match(jn);if(g&&!c.has(g[3]))i=n.replace(jn,"$1$3:");s.push(i)}return s.join(`
|
|
82
|
-
`)}};function rc(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var gr=/\.\.\.\s+([a-zA-Z_$])/g,br={meta:{docs:"Disallow space after spread/rest operator (...)",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;gr.lastIndex=0;while((a=gr.exec(i))!==null){if(rc(i,a.index))continue;s.push({filePath:R.filePath,line:n+1,column:a.index+4,ruleId:"style/rest-spread-spacing",message:"Unexpected space after spread operator",severity:"warning"})}}return s},fix(p){return p.replace(/\.\.\.\s+([a-zA-Z_$\[{])/g,"...$1")}};function oc(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var yr={meta:{docs:"Disallow space before semicolons, require space after",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]!==";")continue;if(oc(i,a))continue;if(a>0&&i[a-1]===" "){if(i.slice(0,a).trim().length>0)s.push({filePath:R.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]!==`
|
|
83
|
-
`&&i[a+1]!=="\r"&&i[a+1]!==")"){let M=i.slice(a+1);if(i.slice(0,a).includes(";")||M.includes(";"))s.push({filePath:R.filePath,line:n+1,column:a+2,ruleId:"style/semi-spacing",message:"Missing space after semicolon",severity:"warning"})}}}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c,i=new RegExp(" ;","g");n=n.replace(i,String.fromCharCode(59));let g=new RegExp(";(\\S)","g");n=n.replace(g,(a,M)=>{if(M===";"||M===")")return a;return`; ${M}`}),s.push(n)}return s.join(`
|
|
84
|
-
`)}};var xr=/(\S)\{/g;function lc(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Rr={meta:{docs:"Require space before opening brace of blocks",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;xr.lastIndex=0;while((a=xr.exec(i))!==null){let M=a.index,v=a[1];if(lc(i,M))continue;if(v==="$")continue;if(v==="="||v===":"||v==="("||v===","||v==="[")continue;if(v==="{")continue;if(v===")"||/[a-zA-Z0-9_]/.test(v))s.push({filePath:R.filePath,line:n+1,column:a.index+2,ruleId:"style/space-before-blocks",message:"Missing space before '{'",severity:"warning"})}}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c.replace(/([)a-zA-Z0-9_])\{/g,"$1 {");s.push(n)}return s.join(`
|
|
85
|
-
`)}};var wr=/\bfunction\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s+\(/g,kr=/\bfunction\(/g;function Ir(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Pr={meta:{docs:"Control spacing before ( in function declarations",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;wr.lastIndex=0;while((a=wr.exec(i))!==null){if(Ir(i,a.index))continue;s.push({filePath:R.filePath,line:n+1,column:a.index+a[0].length,ruleId:"style/space-before-function-paren",message:"Unexpected space before function parentheses",severity:"warning"})}kr.lastIndex=0;while((a=kr.exec(i))!==null){if(Ir(i,a.index))continue;if(i.slice(0,a.index+8).match(/function\s+[a-zA-Z_$]/))continue;s.push({filePath:R.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(p){let R=p;return R=R.replace(/\bfunction\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s+\(/g,"function $1("),R=R.replace(/\bfunction\(/g,"function ("),R}};function Mr(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var vr={meta:{docs:"Disallow spaces inside parentheses",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;for(let a=0;a<i.length;a++){if(i[a]==="("&&!Mr(i,a)){let M=i[a+1];if(M===")"||M===void 0||M===`
|
|
86
|
-
`)continue;if(M===" ")s.push({filePath:R.filePath,line:n+1,column:a+2,ruleId:"style/space-in-parens",message:"Unexpected space after '('",severity:"warning"})}if(i[a]===")"&&!Mr(i,a)){if(a===0)continue;let M=i[a-1];if(M==="(")continue;if(M===" "){if(i.slice(0,a).includes("("))s.push({filePath:R.filePath,line:n+1,column:a,ruleId:"style/space-in-parens",message:"Unexpected space before ')'",severity:"warning"})}}}}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c;n=n.replace(/\(\s+(\S)/g,"($1"),n=n.replace(/(\S)\s+\)/g,"$1)"),s.push(n)}return s.join(`
|
|
87
|
-
`)}};var $r=["&&","||","??","+=","-=","*=","/=","%=","**=","<<=",">>=",">>>=","&=","|=","^=","??=","||=","&&="];function cc(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Cr={meta:{docs:"Require spacing around infix operators (&&, ||, ??, assignment operators)",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;for(let a of $r){let M=0,v;while((v=i.indexOf(a,M))!==-1){if(M=v+a.length,cc(i,v))continue;if(a==="&&"&&i[v+2]==="=")continue;if(a==="||"&&i[v+2]==="=")continue;if(a==="??"&&i[v+2]==="=")continue;let A=v>0?i[v-1]:" ",O=v+a.length<i.length?i[v+a.length]:" ";if(A!==" "&&A!=="\t")s.push({filePath:R.filePath,line:n+1,column:v+1,ruleId:"style/space-infix-ops",message:`Missing space before '${a}'`,severity:"warning"});if(O!==" "&&O!=="\t"&&O!==`
|
|
88
|
-
`&&O!=="\r")s.push({filePath:R.filePath,line:n+1,column:v+a.length+1,ruleId:"style/space-infix-ops",message:`Missing space after '${a}'`,severity:"warning"})}}}return s},fix(p){let R=p,s=[...$r].sort((c,n)=>n.length-c.length);for(let c of s){let n=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");R=R.replace(new RegExp(`(\\S)${n}`,"g"),`$1 ${c}`),R=R.replace(new RegExp(`${n}(\\S)`,"g"),`${c} $1`)}return R}};var Lr=["typeof","void","delete","new","throw","yield","await"];function Un(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Sr={meta:{docs:"Require space after word unary operators, disallow space after symbol unary operators",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;for(let A of Lr){let O=new RegExp(`\\b${A}([^\\s;,)])`,"g"),_;while((_=O.exec(i))!==null){if(Un(i,_.index))continue;s.push({filePath:R.filePath,line:n+1,column:_.index+A.length+1,ruleId:"style/space-unary-ops",message:`Missing space after '${A}'`,severity:"warning"})}}let a=/!\s+([a-zA-Z_$({[])/g,M;while((M=a.exec(i))!==null){if(Un(i,M.index))continue;let A=i.slice(0,M.index),O=A.trimEnd().slice(-1),_=new RegExp("[=(<[{,;|&?:+\\-*/!~^%]");if(!O||_.test(O)||A.trimEnd().endsWith("return")||A.trimEnd().endsWith("case"))s.push({filePath:R.filePath,line:n+1,column:M.index+2,ruleId:"style/space-unary-ops",message:"Unexpected space after '!'",severity:"warning"})}let v=/~\s+([a-zA-Z_$({[])/g;while((M=v.exec(i))!==null){if(Un(i,M.index))continue;s.push({filePath:R.filePath,line:n+1,column:M.index+2,ruleId:"style/space-unary-ops",message:"Unexpected space after '~'",severity:"warning"})}}return s},fix(p){let R=p;for(let s of Lr)R=R.replace(new RegExp(`\\b${s}([^\\s;,)])`,"g"),`${s} $1`);return R=R.replace(/!\s+([a-zA-Z_$({[])/g,"!$1"),R=R.replace(/~\s+([a-zA-Z_$({[])/g,"~$1"),R}};var Er={meta:{docs:"Require space after // and /* in comments",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim(),a=i.indexOf("//");if(a!==-1){let v=i.slice(0,a),A=(v.match(/'/g)||[]).length,O=(v.match(/"/g)||[]).length,_=(v.match(/`/g)||[]).length;if(A%2===0&&O%2===0&&_%2===0){if(!v.match(/https?:$/)){let U=i.slice(a+2);if(U.length>0&&U[0]!==" "&&U[0]!=="\t"&&U[0]!=="/"&&U[0]!=="!")s.push({filePath:R.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 M=i.indexOf("/*");if(M!==-1&&i[M+2]!=="*"&&i[M+2]!=="!"){let v=i.slice(0,M),A=(v.match(/'/g)||[]).length,O=(v.match(/"/g)||[]).length,_=(v.match(/`/g)||[]).length;if(A%2===0&&O%2===0&&_%2===0){let U=i.slice(M+2);if(U.length>0&&U[0]!==" "&&U[0]!=="\t"&&U[0]!==`
|
|
89
|
-
`)s.push({filePath:R.filePath,line:n+1,column:M+3,ruleId:"style/spaced-comment",message:"Missing space after '/*'",severity:"warning",help:"Add a space after /* in comments."})}}}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c;n=n.replace(/(\/\/)([^\s/!])/,"$1 $2"),n=n.replace(/(\/\*)([^\s*!])/,"$1 $2"),s.push(n)}return s.join(`
|
|
90
|
-
`)}};var Ar=/^\s*(case\b.+?|default)\s*:/,Or={meta:{docs:"Enforce spacing around colon in switch case/default clauses",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g)continue;let a=g.match(Ar);if(!a)continue;let M=a[1],v=i.indexOf(":",i.indexOf(M)+M.length);if(v===-1)continue;if(v>0&&i[v-1]===" ")s.push({filePath:R.filePath,line:n+1,column:v+1,ruleId:"style/switch-colon-spacing",message:"Unexpected space before colon in switch case",severity:"warning"});if(v+1<i.length&&i[v+1]!==" "&&i[v+1]!=="\t"&&i[v+1]!==`
|
|
91
|
-
`)s.push({filePath:R.filePath,line:n+1,column:v+2,ruleId:"style/switch-colon-spacing",message:"Missing space after colon in switch case",severity:"warning"})}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c,i=c.trim();if(Ar.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(`
|
|
92
|
-
`)}};var _r="${",Tr={meta:{docs:"Disallow spaces inside template literal interpolation curly braces",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n];for(let g=i.indexOf(_r,0);g!==-1;g=i.indexOf(_r,g)){let a=g+2;if(a<i.length&&(i[a]===" "||i[a]==="\t")){if((i.slice(0,g).match(/`/g)||[]).length%2===1)s.push({filePath:R.filePath,line:n+1,column:a+1,ruleId:"style/template-curly-spacing",message:"Unexpected space after '${'",severity:"warning"})}let M=1,v=a;while(v<i.length&&M>0){if(i[v]==="{")M++;if(i[v]==="}")M--;if(M>0)v++}if(M===0&&v>0){let A=i[v-1];if(A===" "||A==="\t"){if((i.slice(0,g).match(/`/g)||[]).length%2===1)s.push({filePath:R.filePath,line:n+1,column:v,ruleId:"style/template-curly-spacing",message:"Unexpected space before '}'",severity:"warning"})}}g=a}}return s},fix(p){return p.replace(/\$\{\s+([^}]*?)\s+\}/g,"${$1}")}};var qe=/([a-zA-Z_$][a-zA-Z0-9_$]*)\s+`/g;function Wr(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Nr=new Set(["return","case","typeof","void","delete","throw","new","in","of","await","yield","export","default","extends","else","instanceof"]),Dr={meta:{docs:"Disallow space between tag function and template literal",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;qe.lastIndex=0;for(a=qe.exec(i);a!==null;a=qe.exec(i)){let M=a[1],v=a.index;if(Wr(i,v))continue;if(Nr.has(M))continue;let A=v+M.length;s.push({filePath:R.filePath,line:n+1,column:A+1,ruleId:"style/template-tag-spacing",message:"Unexpected space between tag function and template literal",severity:"warning"})}}return s},fix(p,R){let s=p.split(/\r?\n/),c=[];for(let n=0;n<s.length;n++){let i=s[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*")){c.push(i);continue}let a=i,M=[],v;qe.lastIndex=0;for(v=qe.exec(i);v!==null;v=qe.exec(i)){let A=v[1],O=v.index;if(Wr(i,O))continue;if(Nr.has(A))continue;M.push({index:O,fullMatch:v[0],identifier:A})}for(let A=M.length-1;A>=0;A--){let O=M[A],_=O.index,U=_+O.fullMatch.length;a=a.slice(0,_)+O.identifier+"`"+a.slice(U)}c.push(a)}return c.join(`
|
|
93
|
-
`)}};var jr={meta:{docs:"Require parentheses around immediately invoked function expressions (IIFEs)",recommended:!0},check(p,R){let s=[],c=/[^a-zA-Z_$](function\s*\([^)]*\)\s*\{[^}]*\})\s*\(/g,n;for(n=c.exec(p);n!==null;n=c.exec(p)){if(n.index>0&&p[n.index]==="(")continue;let i=p.slice(0,n.index).split(`
|
|
94
|
-
`).length,g=p.lastIndexOf(`
|
|
95
|
-
`,n.index),a=n.index-g;s.push({filePath:R.filePath,line:i,column:a,ruleId:"style/wrap-iife",message:"Wrap immediately invoked function expressions in parentheses",severity:"warning"})}return s},fix(p){return p.replace(/([^a-zA-Z_$(\n])(function\s*\([^)]*\)\s*\{[^}]*\})\s*\(/g,"$1($2)(")}};var Ur=/\byield\s*\*/g;function ac(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Fr={meta:{docs:"Enforce spacing around * in yield* expressions (no space before *, space after)",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;Ur.lastIndex=0;while((a=Ur.exec(i))!==null){let M=a.index;if(ac(i,M))continue;let v=a[0],A=M+v.length-1,O=A+1;if(v!=="yield*")s.push({filePath:R.filePath,line:n+1,column:A+1,ruleId:"style/yield-star-spacing",message:"Unexpected space before * in yield expression",severity:"warning"});if(O<i.length&&i[O]!==" "&&i[O]!=="\t"&&i[O]!==`
|
|
96
|
-
`)s.push({filePath:R.filePath,line:n+1,column:O+1,ruleId:"style/yield-star-spacing",message:"Missing space after * in yield expression",severity:"warning"})}}return s},fix(p,R){let s=p;return s=s.replace(/\byield\s+\*/g,"yield*"),s=s.replace(/\byield\*(\S)/g,"yield* $1"),s}};var Br={name:"style",rules:{"brace-style":e(ri),curly:e(bi),"max-statements-per-line":e(Wi),"if-newline":e(Ci),"consistent-chaining":e(mi),"consistent-list-newline":e(gi),"indent-unindent":e(Li),"no-multi-spaces":b(rr),"no-multiple-empty-lines":b(or),"no-trailing-spaces":b(cr),"keyword-spacing":e(Oi),"arrow-spacing":e(si),"space-infix-ops":e(Cr),"object-curly-spacing":e(ur),"spaced-comment":e(Er),"block-spacing":e(ii),"space-before-blocks":e(Rr),"comma-spacing":e(ai),"semi-spacing":e(yr),"rest-spread-spacing":e(br),"generator-star-spacing":e($i),"yield-star-spacing":e(Fr),"function-call-spacing":e(Pi),"template-tag-spacing":e(Dr),"no-whitespace-before-property":e(Gi),"key-spacing":e(Ei),"computed-property-spacing":e(fi),"array-bracket-spacing":e(Qs),"space-in-parens":e(vr),"template-curly-spacing":e(Tr),"space-unary-ops":e(Sr),"switch-colon-spacing":e(Or),"comma-dangle":e(ci),"arrow-parens":e(ti),"space-before-function-paren":e(Pr),"quote-props":e(hr),"no-floating-decimal":e(sr),"new-parens":e(Fi),"no-extra-parens":e(qi),"wrap-iife":e(jr),"comma-style":e(ui),"dot-location":e(yi),"operator-linebreak":e(pr),"multiline-ternary":e(ji),"padded-blocks":e(dr),"lines-between-class-members":e(Ti),"no-mixed-operators":e(Qi),"indent-binary-ops":e(wi),"no-tabs":e(lr),"no-mixed-spaces-and-tabs":e(ir)}};var qr={meta:{docs:"Enforce consistent member delimiter style in interfaces and type literals",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/),n=!1,i=0,g=0;for(let a=0;a<c.length;a++){let M=c[a],v=M.trim();if(!v||v.startsWith("//")||v.startsWith("*")||v.startsWith("/*"))continue;if(v.match(/\b(interface|type)\b.*\{/))n=!0,g=i+1;for(let A of v){if(A==="{")i++;if(A==="}")i--}if(n&&i<g){n=!1;continue}if(!n||i!==g)continue;if(v==="}"||v==="};"||v==="},")continue;if(v.endsWith(",")){if(v.startsWith("|")||v.startsWith("&"))continue;s.push({filePath:R.filePath,line:a+1,column:M.length,ruleId:"ts/member-delimiter-style",message:"Expected semicolon delimiter in interface, found comma",severity:"warning"})}if(!v.endsWith(";")&&!v.endsWith(",")&&!v.endsWith("{")&&!v.endsWith("(")){if(v.match(/^\w+[\s?]*:/)||v.match(/^\[/)||v.match(/^readonly\b/))s.push({filePath:R.filePath,line:a+1,column:M.length+1,ruleId:"ts/member-delimiter-style",message:"Missing semicolon delimiter in interface member",severity:"warning"})}}return s},fix(p){let R=p.split(/\r?\n/),s=[],c=!1,n=0,i=0;for(let g=0;g<R.length;g++){let a=R[g],M=a.trim();if(M.match(/\b(interface|type)\b.*\{/))c=!0,i=n+1;let v=n;for(let A of M){if(A==="{")n++;if(A==="}")n--}if(c&&n<i){c=!1,s.push(a);continue}if(c&&v===i&&M!=="}"&&M!=="};"&&M!=="},"){let A=a;if(M.endsWith(","))A=a.replace(/,\s*$/,";");s.push(A);continue}s.push(a)}return s.join(`
|
|
97
|
-
`)}};var zr={meta:{docs:"Disallow the use of the `any` type - it defeats the purpose of TypeScript type safety"},check:(p,R)=>{let s=[];if(!/\.tsx?$/.test(R.filePath))return s;let c=p.split(/\r?\n/),n=!1;for(let i=0;i<c.length;i++){let g=c[i],a=g;if(n){let U=g.indexOf("*/");if(U>=0)g=g.slice(U+2),n=!1;else continue}let M=g.indexOf("/*"),v=g.indexOf("//");if(M>=0&&(v===-1||M<v)){let U=g.indexOf("*/",M+2);if(U>=0)g=g.slice(0,M)+g.slice(U+2);else n=!0,g=g.slice(0,M)}if(v>=0)g=g.slice(0,v);let A=g.replace(/(['"`])(?:(?!\1)[^\\]|\\.)*?\1/g,'""'),O=/\b(any)\b/g,_;while((_=O.exec(A))!==null){let U=_.index,B=A[U-1]||" ",q=A[U+3]||" ",z=A.slice(Math.max(0,U-10),U),Z=A.slice(U+3,Math.min(A.length,U+10));if(/\w/.test(B)||/\w/.test(q))continue;if(/:/.test(z)||/</.test(z)||/\bas\s*$/.test(z)||/,/.test(z)||/\|/.test(z)||/&/.test(z)||/\[/.test(Z)||/>/.test(Z)||/,/.test(Z)||/\|/.test(Z)||/extends\s+$/.test(z)||/=\s*$/.test(z)){let X=a.indexOf("any",Math.max(0,U-5));s.push({filePath:R.filePath,line:i+1,column:X>=0?X+1:U+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:(p)=>{let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c;n=n.replace(/:\s*any\b(?!\s*\))/g,(i)=>i.replace("any","unknown")),s.push(n)}return s.join(`
|
|
98
|
-
`)}};var Zr={meta:{docs:"Require promises to be handled - must be awaited, returned, or have .catch() called"},check:(p,R)=>{let s=[];if(!/\.tsx?$/.test(R.filePath))return s;let c=p.split(/\r?\n/),n=!1;for(let i=0;i<c.length;i++){let g=c[i],a=g;if(n){let _=g.indexOf("*/");if(_>=0)g=g.slice(_+2),n=!1;else continue}let M=g.indexOf("/*"),v=g.indexOf("//");if(M>=0&&(v===-1||M<v)){let _=g.indexOf("*/",M+2);if(_>=0)g=g.slice(0,M)+g.slice(_+2);else n=!0,g=g.slice(0,M)}if(v>=0)g=g.slice(0,v);let A=g.replace(/(['"`])(?:(?!\1)[^\\]|\\.)*?\1/g,'""');if(/\b(?:await|return|void)\s/.test(A))continue;if(/\.(?:then|catch|finally)\s*\(/.test(A))continue;let O=[/\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 _ of O){let U=A.match(_);if(!U)continue;let B=A.indexOf(U[0]),q=A.slice(0,B).trim();if(/\b(?:const|let|var)\s+[\w$]+\s*=\s*$/.test(q))continue;if(/[\w$]+\s*=\s*$/.test(q))continue;if(/\breturn\s+$/.test(q))continue;if(/\(\s*$/.test(q)||/,\s*$/.test(q))continue;let z=A.slice(B+U[0].length),Z=1,G=U[0].length;while(G<z.length&&Z>0){if(z[G]==="(")Z++;else if(z[G]===")")Z--;G++}let X=z.slice(G).trim();if(/^\.(?:then|catch|finally)\s*\(/.test(X))continue;if(X===""||X.startsWith(";")){let V=a.indexOf(U[0]);s.push({filePath:R.filePath,line:i+1,column:V>=0?V+1:B+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 Gr={meta:{docs:"Disallow promises in places not designed to handle them (conditionals, logical expressions)"},check:(p,R)=>{let s=[];if(!/\.tsx?$/.test(R.filePath))return s;let c=p.split(/\r?\n/),n=!1;for(let i=0;i<c.length;i++){let g=c[i],a=g;if(n){let z=g.indexOf("*/");if(z>=0)g=g.slice(z+2),n=!1;else continue}let M=g.indexOf("/*"),v=g.indexOf("//");if(M>=0&&(v===-1||M<v)){let z=g.indexOf("*/",M+2);if(z>=0)g=g.slice(0,M)+g.slice(z+2);else n=!0,g=g.slice(0,M)}if(v>=0)g=g.slice(0,v);let A=g.replace(/(['"`])(?:(?!\1)[^\\]|\\.)*?\1/g,'""'),O=A.match(/\bif\s*\(\s*(!?)\s*([\w$]+\s*\([^)]*\))/);if(O){let z=O[1],Z=O[2];if(/async|Async|fetch|Fetch|load|Load|get|Get|save|Save/.test(Z)){let G=A.slice(0,A.indexOf(O[0])),X=A.slice(A.indexOf("if (")+4);if(!/\bawait\s/.test(X)){let V=a.indexOf(Z);s.push({filePath:R.filePath,line:i+1,column:V>=0?V+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 _=/(?:async|Async|fetch|Fetch|load|Load|get|Get|save|Save|Promise\.)[\w$]*\s*\([^)]*\)/g,U;while((U=_.exec(A))!==null){let z=U.index,Z=U[0],G=A.slice(Math.max(0,z-10),z),X=A.slice(z+Z.length,Math.min(A.length,z+Z.length+10));if(/(?:&&|\|\|)\s*$/.test(G)||/^\s*(?:&&|\|\|)/.test(X)){if(!/\bawait\s*$/.test(G)){let K=a.indexOf(Z,Math.max(0,z-5));s.push({filePath:R.filePath,line:i+1,column:K>=0?K+1:z+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 V=A.slice(Math.max(0,z-20),z);if(/\?\s*$/.test(G)||/\?[^:]*$/.test(V)){if(!/\bawait\s*$/.test(G)){let K=a.indexOf(Z,Math.max(0,z-5));s.push({filePath:R.filePath,line:i+1,column:K>=0?K+1:z+1,ruleId:"ts/no-misused-promises",message:"Promise used in ternary expression without await.",severity:"error",help:"Add await before the async call"})}}}let B=A.match(/\b(?:while|for)\s*\([^)]*(?:async|Async|fetch|Fetch|load|Load|get|Get)[\w$]*\s*\([^)]*\)/);if(B){if(!/\bawait\s/.test(B[0])){let z=a.indexOf(B[0]);s.push({filePath:R.filePath,line:i+1,column:z>=0?z+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 q=A.match(/\.(forEach|map|filter|reduce|every|some|find|findIndex)\s*\(\s*async\s*(?:\(|[\w$]+\s*=>)/);if(q){if(q[1]==="forEach"){let Z=a.indexOf(q[0]);s.push({filePath:R.filePath,line:i+1,column:Z>=0?Z+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 Vr={meta:{docs:"Disallow require() in TypeScript files; prefer ESM imports"},check:(p,R)=>{let s=[];if(!/\.ts$/.test(R.filePath))return s;let c=p.split(/\r?\n/),n=!1;for(let i=0;i<c.length;i++){let g=c[i],a=g;if(n){let _=a.indexOf("*/");if(_>=0)a=a.slice(_+2),n=!1;else continue}let M=a.indexOf("/*"),v=a.indexOf("//");if(M>=0&&(v===-1||M<v)){let _=a.indexOf("*/",M+2);if(_>=0)a=a.slice(0,M)+a.slice(_+2);else n=!0,a=a.slice(0,M)}if(v>=0)a=a.slice(0,v);let A=a.trim();if(!A)continue;if(/\bimport\s*\(/.test(A))continue;let O=A.indexOf("require(");if(O>=0){s.push({filePath:R.filePath,line:i+1,column:g.indexOf("require(")+1||O+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(A)){let _=g.indexOf("require(");s.push({filePath:R.filePath,line:i+1,column:_>-1?_+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 Kr={meta:{docs:"Disallow top-level await in TypeScript/JavaScript files"},check:(p,R)=>{let s=[],c=R.filePath.split(".").pop()||"";if(!["ts","tsx","mts","cts","js","mjs","cjs"].includes(c))return s;let n=_e(p),i=0,g=0,a=1;for(let M=0;M<n.length;M++){let v=n[M];if(g++,v===`
|
|
99
|
-
`){a++,g=0;continue}if(v==="{"){i++;continue}if(v==="}"){if(i>0)i--;continue}if(v==="a"&&n.slice(M,M+5)==="await"){let A=n.slice(Math.max(0,M-6),M),O=/for\s+$/.test(A),_=M===0||/[^$\w]/.test(n[M-1]),U=/[^$\w]/.test(n[M+5]||" ");if(!O&&_&&U&&i===0)s.push({filePath:R.filePath,line:a,column:g,ruleId:"ts/no-top-level-await",message:"Do not use top-level await",severity:"error"});M+=4,g+=4}}return s}};var Hr={meta:{docs:"Disallow `exports =` in TypeScript; prefer ESM export default"},check:(p,R)=>{let s=[],c=R.filePath.split(".").pop()||"";if(!["ts","tsx","mts","cts","d.ts"].includes(c))return s;let n=p.split(/\r?\n/);for(let i=0;i<n.length;i++){let M=n[i].replace(/\/\*.*?\*\//g,"").replace(/\/\/.*$/,"").match(/\bexports\s*=\s*/);if(M)s.push({filePath:R.filePath,line:i+1,column:(M.index||0)+1,ruleId:"ts/no-ts-export-equal",message:"Use ESM `export default` instead of `exports =`",severity:"error"})}return s}};var Yr={meta:{docs:"Disallow assignment of `any` typed values to variables - unsafe assignments bypass type checking"},check:(p,R)=>{let s=[];if(!/\.tsx?$/.test(R.filePath))return s;let c=p.split(/\r?\n/),n=!1;for(let i=0;i<c.length;i++){let g=c[i],a=g;if(n){let G=g.indexOf("*/");if(G>=0)g=g.slice(G+2),n=!1;else continue}let M=g.indexOf("/*"),v=g.indexOf("//");if(M>=0&&(v===-1||M<v)){let G=g.indexOf("*/",M+2);if(G>=0)g=g.slice(0,M)+g.slice(G+2);else n=!0,g=g.slice(0,M)}if(v>=0)g=g.slice(0,v);let A=g.replace(/(['"`])(?:(?!\1)[^\\]|\\.)*?\1/g,'""'),O=/(\w+)\s+as\s+any/g,_;while((_=O.exec(A))!==null){let G=_[1],X=_.index,V=A.slice(X+_[0].length).trim(),K=A.slice(0,X).trim();if(/=\s*$/.test(K)&&!/==|===|!=|!==/.test(K)){let ie=a.indexOf(_[0]);s.push({filePath:R.filePath,line:i+1,column:ie>=0?ie+1:X+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 U=["JSON.parse","eval","Function","require"];for(let G of U){let X=new RegExp(`\\b${G.replace(".","\\.")}\\s*\\(`,"g");X.lastIndex=0;while((_=X.exec(A))!==null){let V=_.index,K=A.slice(0,V).trim(),ie=K.match(/(?:const|let|var)\s+([\w$]+)\s*=\s*$/);if(ie){let H=ie[1];if(!new RegExp(`\\b${H}\\s*:\\s*\\w+`).test(A)){let se=a.indexOf(_[0]);s.push({filePath:R.filePath,line:i+1,column:se>=0?se+1:V+1,ruleId:"ts/no-unsafe-assignment",message:`Unsafe assignment from ${G}() without type annotation. This function returns 'any'.`,severity:"error",help:`Add a type annotation to ${H} or use a type assertion with a specific type`})}}let ue=K.match(/([\w$.]+)\s*=\s*$/),me=/(?:const|let|var)\s+/.test(K);if(ue&&!ie&&!me){let H=a.indexOf(_[0]);s.push({filePath:R.filePath,line:i+1,column:H>=0?H+1:V+1,ruleId:"ts/no-unsafe-assignment",message:`Unsafe assignment from ${G}() which returns 'any'.`,severity:"error",help:"Consider adding a type assertion with a specific type"})}}}let B=/(?:const|let|var)\s+([\w$]+)\s*:\s*any\s*=/,q=A.match(B);if(q){let G=q[1],X=a.indexOf(q[0]);s.push({filePath:R.filePath,line:i+1,column:X>=0?X+1:1,ruleId:"ts/no-unsafe-assignment",message:`Variable '${G}' 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 z=/(?:const|let|var)\s+(?:\{[^}]+\}|\[[^\]]+\])\s*=\s*([\w$]+)/,Z=A.match(z);if(Z){let G=Z[1];if(/^(?:params|query|body|req|res|response|data|result)$/.test(G));}}return s}};var Xr={meta:{docs:"Prefer nullish coalescing operator (??) over logical OR (||) when checking for null/undefined"},check:(p,R)=>{let s=[];if(!/\.tsx?$/.test(R.filePath))return s;let c=p.split(/\r?\n/),n=!1;for(let i=0;i<c.length;i++){let g=c[i],a=g.split(""),M=a.length,v=0;if(n){let B=g.indexOf("*/");if(B<0)continue;for(let q=0;q<=B+1;q++)a[q]=" ";n=!1,v=B+2}let A=null;for(;v<M;v++){let B=a[v];if(A){if(B==="\\"){if(a[v]=" ",v+1<M)a[v+1]=" ",v++;continue}if(B===A){A=null;continue}a[v]=" ";continue}if(B==="/"&&a[v+1]==="/"){for(let q=v;q<M;q++)a[q]=" ";break}if(B==="/"&&a[v+1]==="*"){let q=g.indexOf("*/",v+2);if(q<0){for(let z=v;z<M;z++)a[z]=" ";n=!0;break}for(let z=v;z<=q+1;z++)a[z]=" ";v=q+1;continue}if(B==='"'||B==="'"||B==="`")A=B}let O=a.join(""),_=/\|\|/g,U;while((U=_.exec(O))!==null){let B=U.index,q=B-1,z=0,Z=0,G=0;while(q>=0){let H=O[q];if(H===")")z++;else if(H==="("){if(z===0){q++;break}z--}else if(H==="}")Z++;else if(H==="{"){if(Z===0){q++;break}Z--}else if(H==="]")G++;else if(H==="["){if(G===0){q++;break}G--}else if(z===0&&Z===0&&G===0){if(new RegExp("[;,=:?]").test(H)){q++;break}if(H==="&"||H==="|"){q++;break}}q--}if(q<0)q=0;let X=O.slice(q,B).trim();if(/[<>!=]/.test(X))continue;if(/\b(?:true|false)\b/.test(X))continue;let V=B+2,K=V;z=0,Z=0,G=0;while(K<O.length){let H=O[K];if(H==="(")z++;else if(H===")"){if(z===0)break;z--}else if(H==="{")Z++;else if(H==="}"){if(Z===0)break;Z--}else if(H==="[")G++;else if(H==="]"){if(G===0)break;G--}else if(z===0&&Z===0&&G===0){if(new RegExp("[;,?:]").test(H))break;if(H==="&"||H==="|"&&O[K+1]==="|")break}K++}let ie=O.slice(V,K).trim(),ue=/^["'`\d]/.test(ie)||/^\{/.test(ie)||/^[\w$]+\(/.test(ie)||/^[\w$.[\]]+$/.test(ie),me=/^[\w$]+$/.test(X)||/^[\w$.?[\]()]+$/.test(X);if(ue&&me)s.push({filePath:R.filePath,line:i+1,column:B+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:(p)=>{let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c,i=new RegExp("(\\b[\\w$.]+)\\s*\\|\\|\\s*([^|&]+?)(?=\\s*[;,)\\]}]|$)","g");n=n.replace(i,(g,a,M)=>{if(/\b(?:true|false)\b/.test(M.trim()))return g;return`${a} ?? ${M}`}),s.push(n)}return s.join(`
|
|
100
|
-
`)}};var Jr={meta:{docs:"Prefer optional chaining (?.) over chained logical AND (&&) for property access"},check:(p,R)=>{let s=[];if(!/\.tsx?$/.test(R.filePath))return s;let c=p.split(/\r?\n/),n=!1;for(let i=0;i<c.length;i++){let g=c[i],a=g;if(n){let q=g.indexOf("*/");if(q>=0)g=g.slice(q+2),n=!1;else continue}let M=g.indexOf("/*"),v=g.indexOf("//");if(M>=0&&(v===-1||M<v)){let q=g.indexOf("*/",M+2);if(q>=0)g=g.slice(0,M)+g.slice(q+2);else n=!0,g=g.slice(0,M)}if(v>=0)g=g.slice(0,v);let A=g.replace(/(['"`])(?:(?!\1)[^\\]|\\.)*?\1/g,'""'),O=/(\b[\w$]+)\s*&&\s*\1\.([\w$]+)/g,_;while((_=O.exec(A))!==null){let q=_[1],z=_[2],Z=_.index,G=a.indexOf(_[0],Math.max(0,Z-5));s.push({filePath:R.filePath,line:i+1,column:G>=0?G+1:Z+1,ruleId:"ts/prefer-optional-chain",message:`Prefer optional chaining over && for property access: ${q}?.${z}`,severity:"error",help:`Use \`${q}?.${z}\` instead of \`${q} && ${q}.${z}\``})}let U=/([\w$]+\.[\w$.]+)\s*&&\s*\1\.([\w$]+)/g;U.lastIndex=0;while((_=U.exec(A))!==null){let q=_[1],z=_[2],Z=_.index,G=a.indexOf(_[0],Math.max(0,Z-5));s.push({filePath:R.filePath,line:i+1,column:G>=0?G+1:Z+1,ruleId:"ts/prefer-optional-chain",message:`Prefer optional chaining over && for nested property access: ${q}?.${z}`,severity:"error",help:`Use \`${q}?.${z}\` instead of \`${q} && ${q}.${z}\``})}let B=A.split(/\s*&&\s*/);if(B.length>=3)for(let q=0;q<B.length-2;q++){let z=B[q].trim(),Z=B[q+1].trim(),G=B[q+2].trim();if(Z.startsWith(`${z}.`)&&G.startsWith(`${Z}.`)){let X=a.indexOf(z);s.push({filePath:R.filePath,line:i+1,column:X>=0?X+1:1,ruleId:"ts/prefer-optional-chain",message:"Prefer optional chaining over multiple && checks for nested properties",severity:"error",help:`Use optional chaining like \`${z}?.${Z.slice(z.length+1)}?.${G.slice(Z.length+1)}\``});break}}}return s},fix:(p)=>{let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c;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(`
|
|
101
|
-
`)}};function uc(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var Qr=/([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,eo={meta:{docs:"Require consistent spacing around type annotation colons",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a;Qr.lastIndex=0;while((a=Qr.exec(i))!==null){if(uc(i,a.index))continue;let M=a[0],v=M.indexOf(":"),A=a.index+v;if(v>0&&M[v-1]===" "&&!M.startsWith("?")){if(!a[1].endsWith("?")||M[v-1]===" "){if(i[A-1]===" "&&!/\?\s*$/.test(a[1]))s.push({filePath:R.filePath,line:n+1,column:A+1,ruleId:"ts/type-annotation-spacing",message:"Unexpected space before colon in type annotation",severity:"warning"})}}if(A+1<i.length&&i[A+1]!==" "&&i[A+1]!=="\t")s.push({filePath:R.filePath,line:n+1,column:A+2,ruleId:"ts/type-annotation-spacing",message:"Missing space after colon in type annotation",severity:"warning"})}}return s},fix(p){let R=p.split(/\r?\n/),s=[];for(let c of R){let n=c;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(`
|
|
102
|
-
`)}};function to(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var no=/([A-Za-z_$][A-Za-z0-9_$]*)\s*<(\s+)/g,so=/(\s+)>(?!=)/g,fc=/([A-Za-z_$][A-Za-z0-9_$]*)\s*<\s+/g,mc=/\s+>(?!=)/g,io={meta:{docs:"Disallow spaces inside TypeScript generic angle brackets",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;no.lastIndex=0;let a;while((a=no.exec(i))!==null){let M=a.index+a[1].length,v=i.indexOf("<",M);if(v===-1)continue;if(to(i,v))continue;s.push({filePath:R.filePath,line:n+1,column:v+2,ruleId:"ts/type-generic-spacing",message:"Unexpected space after '<' in generic type",severity:"warning"})}so.lastIndex=0;while((a=so.exec(i))!==null){let M=a.index+a[1].length;if(to(i,M))continue;let v=i.slice(0,M);if(!/[A-Za-z_$][A-Za-z0-9_$]*\s*</.test(v))continue;s.push({filePath:R.filePath,line:n+1,column:M+1,ruleId:"ts/type-generic-spacing",message:"Unexpected space before '>' in generic type",severity:"warning"})}}return s},fix(p,R){let s=p.split(/\r?\n/),c=[];for(let n of s){let i=n.trim();if(!i||i.startsWith("//")||i.startsWith("*")||i.startsWith("/*")){c.push(n);continue}let g=n;if(g=g.replace(fc,(a,M)=>`${M}<`),/[A-Za-z_$][A-Za-z0-9_$]*\s*</.test(g))g=g.replace(mc,">");c.push(g)}return c.join(`
|
|
103
|
-
`)}};function pc(p,R){let s=p.slice(0,R);if(s.includes("//"))return!0;let c=(s.match(/'/g)||[]).length,n=(s.match(/"/g)||[]).length,i=(s.match(/`/g)||[]).length;return c%2===1||n%2===1||i%2===1}var ro=/([a-zA-Z_$][a-zA-Z0-9_$?]*):(\S)/g,co={meta:{docs:"Require space after colon in named tuple members",recommended:!0},check(p,R){let s=[],c=p.split(/\r?\n/);for(let n=0;n<c.length;n++){let i=c[n],g=i.trim();if(!g||g.startsWith("//")||g.startsWith("*")||g.startsWith("/*"))continue;let a=oo(i);for(let M of a){ro.lastIndex=0;let v;while((v=ro.exec(M.text))!==null){let O=M.start+v.index+v[1].length;if(pc(i,O))continue;if(!lo(i))continue;s.push({filePath:R.filePath,line:n+1,column:O+2,ruleId:"ts/type-named-tuple-spacing",message:"Missing space after colon in named tuple member",severity:"warning"})}}}return s},fix(p,R){let s=p.split(/\r?\n/),c=[];for(let n of s){let i=n.trim();if(!i||i.startsWith("//")||i.startsWith("*")||i.startsWith("/*")){c.push(n);continue}if(!lo(n)){c.push(n);continue}let g=n,a=oo(n);for(let M=a.length-1;M>=0;M--){let v=a[M],A=v.text.replace(/([a-zA-Z_$][a-zA-Z0-9_$?]*):(\S)/g,"$1: $2");if(A!==v.text)g=g.slice(0,v.start)+A+g.slice(v.start+v.text.length)}c.push(g)}return c.join(`
|
|
104
|
-
`)}};function oo(p){let R=[],s=0,c=-1;for(let n=0;n<p.length;n++)if(p[n]==="["){if(s===0)c=n;s++}else if(p[n]==="]"){if(s--,s===0&&c>=0)R.push({start:c,text:p.slice(c,n+1)}),c=-1}return R}function lo(p){let R=p.trim();return/\btype\s/.test(R)||/:\s*\[/.test(R)||/=\s*\[/.test(R)||/\bas\s/.test(R)||/<[^>]*\[/.test(R)||/\bextends\s/.test(R)||/\bimplements\s/.test(R)}var ao={name:"ts",rules:{"no-require-imports":e(Vr),"no-top-level-await":e(Kr),"no-ts-export-equal":e(Hr),"no-explicit-any":e(zr),"prefer-nullish-coalescing":e(Xr),"prefer-optional-chain":e(Jr),"no-floating-promises":e(Zr),"no-misused-promises":e(Gr),"no-unsafe-assignment":e(Yr),"member-delimiter-style":e(qr),"type-annotation-spacing":e(eo),"type-generic-spacing":e(io),"type-named-tuple-spacing":e(co)}};var uo={name:"unused-imports",rules:{"no-unused-vars":e(Te),"no-unused-imports":e(Te)}};var dc={markdown:()=>import.meta.require("./chunk-t4eg5fx5.js").markdownPlugin,shell:()=>import.meta.require("./chunk-1r811fef.js").shellPlugin,spell:()=>import.meta.require("./chunk-861zc8zq.js").spellPlugin,lockfile:()=>import.meta.require("./chunk-he3fbz3w.js").lockfilePlugin,publint:()=>import.meta.require("./chunk-0wjnsb7e.js").publintPlugin},fo=new Map;function hc(p){let R=fo.get(p);if(!R)R=dc[p](),fo.set(p,R);return R}function gc(p,R,s){let c=()=>hc(p).rules[R],n={get meta(){return c().meta},check:(i,g)=>c().check(i,g)};if(s)n.fix=(i,g)=>c().fix(i,g);return n}function et(p){let R={};for(let[s,c]of Object.entries(ps[p]))R[s]=gc(p,s,c);return{name:p,rules:R}}var mo=null;function Fn(){return mo??=[ss,ms,Vs,Gs,Br,Xs,ao,et("markdown"),et("shell"),et("spell"),gs,et("lockfile"),et("publint"),uo,bs],[...mo]}var Rc=rt("pickier");function bo(){return Rc}function ze(...p){if(r.TRACE)bo().debug("[pickier:trace]",p)}async function ho(p,R,s){let c,n=new Promise((i,g)=>{c=setTimeout(()=>g(Error(`Timeout after ${R}ms at ${s}`)),R)});try{let i=await Promise.race([p,n]);return clearTimeout(c),i}catch(i){throw bo().error(`[pickier:error] ${s} failed:`,i?.message||i),ze("withTimeout error:",s,i),i}}function yo(p){if(p.length===0)return"";let R=new Map;for(let c of p){let n=R.get(c.filePath)||[];n.push(c),R.set(c.filePath,n)}let s="";for(let[c,n]of R){s+=`
|
|
105
|
-
${t.bold(`\x1B[4m${c}\x1B[24m`)}
|
|
106
|
-
`;let i;try{i=go(c,"utf8")}catch{for(let a of n){let M=a.severity==="error"?t.red("error"):t.yellow("warn ");s+=` ${a.line}:${a.column} ${M} ${a.message} ${t.blue(a.ruleId)}
|
|
107
|
-
`}continue}let g=i.split(/\r?\n/);for(let a of n){let M=a.severity==="error"?t.red("!"):t.yellow("!"),v=t.blue(a.ruleId);s+=`
|
|
108
|
-
${M} ${v}: ${a.message}
|
|
109
|
-
`;let A=2,O=2,_=Math.max(1,a.line-A),U=Math.min(g.length,a.line+O),q=String(U).length;s+=` ${t.gray(" ,-")}${t.gray(`[:${a.line}:${a.column}]`)}
|
|
110
|
-
`;for(let z=_;z<=U;z++){let Z=String(z).padStart(q),G=g[z-1]||"";if(z===a.line)s+=` ${t.gray(Z)} ${t.gray("|")} ${t.red(",-> ")}${G}
|
|
111
|
-
`;else if(z===a.line+1&&O>0)s+=` ${t.gray(Z)} ${t.gray("|")} ${t.red("| ")}${G}
|
|
112
|
-
`;else if(z===a.line+O&&O>1)s+=` ${t.gray(Z)} ${t.gray("|")} ${t.red("`-> ")}${G}
|
|
113
|
-
`;else s+=` ${t.gray(Z)} ${t.gray("| ")}${G}
|
|
114
|
-
`}if(s+=` ${t.gray(" `----")}
|
|
115
|
-
`,a.help)s+=` ${t.blue("help")}: ${a.help}
|
|
116
|
-
`}}return s}function xo(p){if(p.length===0)return"";let R=new Map;for(let g of p){let a=R.get(g.filePath)||[];a.push(g),R.set(g.filePath,a)}let s=t.red("error"),c=t.yellow("warn "),n=new Map,i="";for(let[g,a]of R){i+=`
|
|
117
|
-
${t.bold(`\x1B[4m${g}\x1B[24m`)}
|
|
118
|
-
`;for(let M of a){let v=M.severity==="error"?s:c,A=n.get(M.ruleId);if(A===void 0)A=t.blue(M.ruleId),n.set(M.ruleId,A);let _=`${M.line}:${M.column}`.padStart(6),U=60,B=M.message.padEnd(U);i+=`${_} ${v} ${B} ${A}
|
|
119
|
-
`}}return i}async function W(p,R){ze("runFormat:start",{globs:p,options:R});let s=await l(R.config),c=p.length?p:["."],n=y(c);ze("patterns",n);let i=new Set((R.ext||s.format.extensions.join(",")).split(",").map((z)=>{let Z=z.trim();return Z.startsWith(".")?Z:`.${Z}`})),g=r.TIMEOUT_MS,M=n.some((z)=>{let Z=z.replace(/\/?\*\*(?:\/\*+)?$/,"");return!(yc(Z)?Z:xc(process.cwd(),Z)).startsWith(process.cwd())})?m(f):m(s.ignores),v=h(M),A=[];if(n.length===1&&/\*\*\/\*$/.test(n[0])){let z=n[0].replace(/\/?\*\*\/\*$/,"");try{let{readdirSync:Z,statSync:G}=await import("fs"),{join:X}=await import("path"),V=[z];while(V.length){let K=V.pop(),ie=Z(K);for(let ue of ie){let me=X(K,ue),H=G(me);if(v(me))continue;if(H.isDirectory())V.push(me);else A.push(me)}}}catch{A=await ho(u(n,{dot:!1,ignore:M,onlyFiles:!0,absolute:!0}),g,"glob")}}else A=await ho(u(n,{dot:!1,ignore:M,onlyFiles:!0,absolute:!0}),g,"glob");ze("globbed entries",A.length);let _=A.filter((z)=>{if(v(z))return!1;let Z=z.lastIndexOf(".");if(Z<0)return!0;let G=z.slice(Z);return i.has(G)});ze("filtered files",_.length);let U=0,B=[];for(let z of _){ze("format start",po(process.cwd(),z));let Z=go(z,"utf8"),G=d(Z,s,z),X=G!==Z;if(R.write){if(X)bc(z,G,"utf8")}if(X)B.push(po(process.cwd(),z));U++}let q=B.length;if(q>0){for(let z of B)console.log(t.gray(` ${z}`));console.log(R.write?t.gray(`Formatted ${q} of ${U} file(s).`):t.yellow(`${q} of ${U} file(s) need formatting. Run with --write to fix.`))}else if(R.verbose!==void 0?R.verbose:s.verbose)console.log(t.gray(`Checked ${U} files, all formatted.`));return R.check&&q>0?1:0}import{mkdirSync as wc,readFileSync as kc,writeFileSync as Ic}from"fs";import{dirname as Pc,resolve as Mc}from"path";var vc=".pickiercache";function Bn(p){return Bun.hash(p).toString(36)}function $c(p,R){let s=JSON.stringify({cfg:p,options:{formatOnly:!!R._formatOnly,fix:!!R.fix,dryRun:!!R.dryRun,ext:R.ext}},(c,n)=>typeof n==="function"?`fn:${n.toString()}`:n instanceof RegExp?`re:${n}`:n);return`${T}:${Bn(s)}`}function Ro(p,R){let s=R.cache??p.lint?.cache??!1,c=(R.fix||R._formatOnly)&&!R.dryRun;return!!s&&!c}function wo(p,R,s=vc){let c=Mc(process.cwd(),s),n=$c(p,R),i={};try{let a=JSON.parse(kc(c,"utf8"));if(a.key===n&&a.files&&typeof a.files==="object")i=a.files}catch{}let g={};return{get(a,M){let v=i[a];if(v&&v.hash===Bn(M))return g[a]=v,v.issues;return},set(a,M,v){g[a]={hash:Bn(M),issues:v}},save(){try{wc(Pc(c),{recursive:!0}),Ic(c,JSON.stringify({key:n,files:g}))}catch{}}}}import{chmodSync as Cc,existsSync as ko}from"fs";import{resolve as qn}from"path";var __dirname="/home/runner/work/pickier/pickier/packages/pickier/src",Lc=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":(p)=>p.pluginRules?.["pickier/sort-exports"]?.[1]||{}};function Sc(p,R){let s=Mo[R.id]?Mo[R.id](p):R.options;return{id:R.id,severity:R.severity??null,options:s??null}}function Ec(p){return{quotes:o(p,"quotes",["style/quotes"],"warn")??null,indent:o(p,"indent",["style/indent"],"warn")??null,"no-debugger":o(p,"no-debugger",["noDebugger"])??null,"no-console":o(p,"no-console",["noConsole"])??null,"no-template-curly-in-string":o(p,"no-template-curly-in-string",["noTemplateCurlyInString"])??null,"no-cond-assign":o(p,"no-cond-assign",["noCondAssign"])??null}}function Ac(p){return{quotes:p.format.quotes,indent:p.format.indent,indentStyle:p.format.indentStyle??"spaces"}}function vo(p){return/\.(?:ts|js|tsx|jsx|mts|mjs|cts|cjs)$/.test(p)}function $o(p,R){if(process.env.PICKIER_NATIVE==="0"||R.fix||R._formatOnly)return null;if((p.plugins??[]).some((a)=>typeof a==="string"||Io.has(a.name)||Po.has(a.name)))return null;let s=Oc();if(!s)return null;let c=Ec(p),n=[],i=[],g=!1;if(D(p).forEach((a,M)=>{if(Io.has(a.plugin)&&Lc.has(a.id))n.push(Sc(p,a)),i.push(M);else if(!Po.has(a.plugin))g=!0}),n.length===0&&Object.values(c).every((a)=>a===null))return null;return{request:{format:Ac(p),builtins:c,rules:n},binary:s,positions:i,nativeRules:n.map((a)=>a.id),hybrid:g}}function Oc(){if(process.env.PICKIER_NATIVE_BINARY)return ko(process.env.PICKIER_NATIVE_BINARY)?process.env.PICKIER_NATIVE_BINARY:null;let p=`${process.platform}-${process.arch}`,R=process.platform==="win32"?"pickier-native.exe":"pickier-native";return[qn(__dirname,"native",p,R),qn(__dirname,"../dist/native",p,R),qn(__dirname,"../../zig/zig-out/bin/pickier-zig")].find((c)=>ko(c))??null}function Co(p,R,s,c,n){let i=Buffer.from(Eo(p,R,c)),g=So(s,()=>Bun.spawnSync([s,"lint-batch"],{stdin:i,stdout:"pipe",stderr:"pipe"}));if(!g||g.exitCode!==0)return null;return Ao(g.stdout.toString(),p,n)}async function Lo(p,R,s,c){let n=Buffer.from(Eo(p,R)),i=So(s,()=>Bun.spawn([s,"lint-batch"],{stdin:n,stdout:"pipe",stderr:"ignore"}));if(!i)return null;let[g,a]=await Promise.all([new Response(i.stdout).text(),i.exited]);if(a!==0)return null;return Ao(g,p,c)}function So(p,R){try{return R()}catch(s){if(s?.code!=="EACCES")return null;try{return Cc(p,493),R()}catch{return null}}}function Eo(p,R,s){return JSON.stringify({...R,...s&&{threads:s},files:p})}var _c=2;function Ao(p,R,s){let c;try{let n=JSON.parse(p);if(n?.v!==_c)return null;c=n.f}catch{return null}if(!Array.isArray(c)||c.length!==R.length)return null;return c.map((n,i)=>{if(n===null)return null;let{s:g,i:a}=n,M=R[i],v=[];for(let A=0;A<a.length;A+=7){let O={filePath:M,line:a[A],column:a[A+1],ruleId:g[a[A+2]],message:g[a[A+3]],severity:a[A+4]===0?"error":"warning"};if(a[A+5]>=0)O.help=g[a[A+5]];if(s)O.pos=a[A+6]<0?-1:s[a[A+6]];v.push(O)}return v})}function Oo(p,R){let s=p,c=R,n=[],i=new Set,g=(v)=>{let A=`${v.line}:${v.column}:${v.ruleId}`;if(i.has(A))return;i.add(A);let O={filePath:v.filePath,line:v.line,column:v.column,ruleId:v.ruleId,message:v.message,severity:v.severity};if(v.help!==void 0)O.help=v.help;n.push(O)},a=0,M=0;while(a<s.length||M<c.length)if(M>=c.length||a<s.length&&s[a].pos<=c[M].pos)g(s[a++]);else g(c[M++]);return n}import{existsSync as Tc}from"fs";import{availableParallelism as Wc}from"os";var Nc=32,Dc=8,jc=4;function _o(p){let R=r.WORKERS;if(R!==null)return Math.min(R,p);if(p<Nc)return 0;return Math.min(Math.max(1,Wc()-1),Math.ceil(p/Dc))}function Uc(){for(let p of["./lint-worker.ts","./lint-worker.js","./src/lint-worker.js"]){let R=new URL(p,import.meta.url);try{if(R.protocol==="file:"&&Tc(Bun.fileURLToPath(R)))return R.href}catch{}}return null}async function To(p,R,s,c,n=Uc()){let i=Array(p.length);if(n!==null){let g=0,a=()=>{let v=[];while(v.length<jc&&g<p.length)v.push([g,p[g]]),g++;return v},M=[];try{await new Promise((v,A)=>{let O=0,_=()=>{let U;try{U=new Worker(n)}catch{return}M.push(U),O++;let B=[],q=!1,z=()=>{if(q)return;if(q=!0,U.terminate(),O--,O===0)v()},Z=()=>{if(B=a(),B.length===0)z();else U.postMessage({type:"lint",batch:B})};U.onmessage=(X)=>{let V=X.data;if(V.type==="done"){for(let[K,ie]of V.results)i[K]=ie;Z()}else if(V.type==="error")A(Error(V.message))};let G=()=>{B=[],z()};U.onerror=G,U.addEventListener("close",G);try{U.postMessage({type:"init",options:R})}catch{z();return}Z()};for(let U=0;U<s;U++)_();if(O===0)v()})}finally{for(let v of M)v.terminate()}}for(let g=0;g<p.length;g++)if(i[g]===void 0)i[g]=await c(p[g]);return i}var Fc=rt("pickier:lint");function Ie(){return Fc}function Ce(...p){if(r.TRACE)Ie().error("[pickier:trace]",p)}async function N(p,R,s="untitled",c){if(c?.aborted)throw Error("AbortError");En();let n=Ne(p),i=De(p),g=it(s,p,R,n,i);if(c?.aborted)throw Error("AbortError");try{let a=await Sn(s,p,R);for(let M of a){if(c?.aborted)throw Error("AbortError");if(Ae(M.ruleId,M.line,n))continue;if(i.has(M.line)&&Cn(M.ruleId))continue;g.push({filePath:M.filePath,line:M.line,column:M.column,ruleId:M.ruleId,message:M.message,severity:M.severity,...M.help&&{help:M.help}})}}catch{}return g}function I(p,R,s="untitled"){En();let c=Xo(s,p,R,Ne(p),De(p));if(c=Yo(s,c,R),Jo(s,c,R))c=Jc(c,R,Ne(c),De(c));return c}async function F(p,R,s){Ce("runLintProgrammatic:start",{globs:p,options:R});let c=await l(R.config);if(s?.aborted)throw Error("AbortError");let n=p.length?p:["."],i=y(n),g=R.ext||c.lint.extensions.join(","),a=new Set(g.split(",").map((se)=>{let ne=se.trim();return ne.startsWith(".")?ne:`.${ne}`})),M=r.TIMEOUT_MS,A=i.some((se)=>{let ne=se.replace(/\/?\*\*\/*\*\*$/,""),le=Ze(ne)?ne:Ge(process.cwd(),ne),te=process.cwd();return le!==te&&!le.startsWith(te+Vo)})?m(f):m(c.ignores),O=h(A),_=[];if(i.length===1&&!/[*?[\]{}()!]/.test(i[0]))try{if(vn(i[0]).isFile())_=[Ze(i[0])?i[0]:Ge(process.cwd(),i[0])]}catch{}let B=i.length===1&&/\*\*\/*\*$/.test(i[0]);if(!_.length&&B){let se=i[0].replace(/\/?\*\*\/*\*\*$/,""),ne=Ze(se)?se:Ge(process.cwd(),se);try{let le=[ne];while(le.length){if(s?.aborted)throw Error("AbortError");let te=le.pop(),fe=Zo(te);for(let oe of fe){let ae=Go(te,oe),be=vn(ae);if(O(ae))continue;if(be.isDirectory())le.push(ae);else _.push(ae)}}}catch{_=await st(u(i,{dot:!1,ignore:A,onlyFiles:!0,absolute:!0}),M,"glob")}}else if(!_.length)_=await st(u(i,{dot:!1,ignore:A,onlyFiles:!0,absolute:!0}),M,"glob");if(s?.aborted)throw Error("AbortError");let q=0,z=0,Z=0,G=0,X=0,V=[];for(let se of _){if(q++,se.replace(/\\/g,"/").includes("/node_modules/")){Z++;continue}if(O(se)){G++;continue}if(!P(se,a)){X++;continue}V.push(se),z++}Ce("filter:programmatic",{total:q,included:z,node_modules:Z,ignored:G,wrongExt:X});let K=r.CONCURRENCY,me=(await Ko(V,K,async(se)=>{if(s?.aborted)throw Error("AbortError");En();let ne=Yn(se,"utf8"),le=Ne(ne),te=De(ne),fe=it(se,ne,c,le,te);try{let oe=await Sn(se,ne,c);for(let ae of oe){if(s?.aborted)throw Error("AbortError");if(Ae(ae.ruleId,ae.line,le))continue;if(te.has(ae.line)&&Cn(ae.ruleId))continue;fe.push({filePath:ae.filePath,line:ae.line,column:ae.column,ruleId:ae.ruleId,message:ae.message,severity:ae.severity,...ae.help&&{help:ae.help}})}}catch{}{let oe=new Set;fe=fe.filter((ae)=>{let be=`${ae.line}:${ae.column}:${ae.ruleId}`;if(oe.has(be))return!1;return oe.add(be),!0})}if(R.fix){let oe=Xo(se,ne,c,le,te);if(oe=Yo(se,oe,c),oe!==ne){let ae=Ne(oe),be=De(oe);if(fe=it(se,oe,c,ae,be),!R.dryRun)Hn(se,oe,"utf8")}}return fe})).flat(),H=me.filter((se)=>se.severity==="error").length,re=me.filter((se)=>se.severity==="warning").length;return{errors:H,warnings:re,issues:me}}function Bc(p){return p.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function qc(p){return p.replace(/-([a-z])/g,(R,s)=>s.toUpperCase())}function Ne(p){let R=new Map,s=new Set,c=new Map,n=new Map,i=p.split(/\r?\n/),g=new Set;for(let v=0;v<i.length;v++){let A=i[v].trim(),O=v+1,_=A.match(/^\/\/\s*(?:eslint|pickier)-disable-next-line(?:\s+(\S.*))?$/);if(_){let Z=_[1]?.replace(/\s+--\s.*$/,""),G=Z?Z.split(",").map((X)=>X.trim()).filter(Boolean):["*"];if(G.length>0){let X=O+1,V=R.get(X)||new Set;for(let K of G)V.add(K);R.set(X,V)}continue}let U=A.match(/^\/\*\s*(?:eslint|pickier)-disable(?:\s+([^*]+))?\s*\*\//);if(U){let Z=U[1]?.trim().replace(/\s+--\s.*$/,"");if(!Z||Z==="")c.set(O,new Set(["*"])),g.add("*");else{let G=Z.split(",").map((V)=>V.trim()).filter(Boolean),X=c.get(O)||new Set;for(let V of G)X.add(V),g.add(V);c.set(O,X)}if(v===0)if(!Z||Z==="")s.add("*");else{let G=Z.split(",").map((X)=>X.trim()).filter(Boolean);for(let X of G)s.add(X)}continue}let B=A.match(/^\/\*\s*(?:eslint|pickier)-enable(?:\s+([^*]+))?\s*\*\//);if(B){let Z=B[1]?.trim();if(!Z||Z==="")n.set(O,new Set(["*"])),g.clear();else{let G=Z.split(",").map((V)=>V.trim()).filter(Boolean),X=n.get(O)||new Set;for(let V of G)X.add(V),g.delete(V);n.set(O,X)}continue}let q=A.match(/^\/\/\s*(?:eslint|pickier)-disable(?:\s+(\S.*))?$/);if(q){let Z=q[1]?.trim().replace(/\s+--\s.*$/,"");if(!Z||Z==="")c.set(O,new Set(["*"])),g.add("*");else{let G=Z.split(",").map((V)=>V.trim()).filter(Boolean),X=c.get(O)||new Set;for(let V of G)X.add(V),g.add(V);c.set(O,X)}continue}let z=A.match(/^\/\/\s*(?:eslint|pickier)-enable(?:\s+(\S.*))?$/);if(z){let Z=z[1]?.trim();if(!Z||Z==="")n.set(O,new Set(["*"])),g.clear();else{let G=Z.split(",").map((V)=>V.trim()).filter(Boolean),X=n.get(O)||new Set;for(let V of G)X.add(V),g.delete(V);n.set(O,X)}}}let a=Array.from(c.keys()).sort((v,A)=>v-A),M=Array.from(n.keys()).sort((v,A)=>v-A);return{nextLine:R,fileLevel:s,rangeDisable:c,rangeEnable:n,sortedDisableLines:a,sortedEnableLines:M}}function Ae(p,R,s){if(s instanceof Map){let a=s.get(R);if(!a||a.size===0)return!1;return tt(p,a)}if(s.fileLevel.size>0){if(tt(p,s.fileLevel))return!0}let c=s.nextLine.get(R);if(c&&tt(p,c))return!0;let n=!1,i=0,g=0;while(!0){let a=i<s.sortedDisableLines.length?s.sortedDisableLines[i]:Number.POSITIVE_INFINITY,M=g<s.sortedEnableLines.length?s.sortedEnableLines[g]:Number.POSITIVE_INFINITY,v=Math.min(a,M);if(v>=R)break;if(a===v){let O=s.rangeDisable.get(a);if(tt(p,O))n=!0;i++;continue}let A=s.rangeEnable.get(M);if(A.has("*")||tt(p,A))n=!1;g++}return n}function tt(p,R){if(R.size===0)return!1;if(R.has("*"))return!0;if(R.has(p))return!0;let s=Bc(p);if(R.has(s)||R.has(qc(p)))return!0;for(let c of R)if(!c.includes("/")){if(p.endsWith(`/${c}`))return!0}if(!p.includes("/")){for(let c of R)if(c.endsWith(`/${p}`))return!0}return!1}function Cn(p){return p!=="spaced-comment"&&!p.endsWith("/spaced-comment")}function zc(p,R){if(p.help)return p;let s=R.includes("/")?R.split("/")[1]:R,c;if(s.startsWith("no-"))c=`Remove or refactor this ${s.replace("no-","").replace(/-/g," ")}. Check the rule documentation for more details or disable with: // eslint-disable-next-line ${R}`;else if(s.startsWith("prefer-"))c=`Consider using ${s.replace("prefer-","").replace(/-/g," ")} instead. This is a best practice recommendation. Disable with: // eslint-disable-next-line ${R} if needed`;else if(s.includes("sort")||s.includes("order"))c=`Reorder these items according to the rule requirements, or use --fix to auto-sort. Disable with: // eslint-disable-next-line ${R}`;else if(s.includes("indent")||s.includes("spacing")||s.includes("newline"))c=`Fix the formatting issue. Run with --fix to automatically format. Disable with: // eslint-disable-next-line ${R}`;else c=`Fix this issue or disable the rule with: // eslint-disable-next-line ${R}. Check the rule documentation for more details`;return{...p,help:c}}async function st(p,R,s){let c,n=new Promise((i,g)=>{c=setTimeout(()=>g(Error(`Timeout after ${R}ms at ${s}`)),R)});try{let i=await Promise.race([p,n]);return clearTimeout(c),i}catch(i){throw Ie().error(`[pickier:error] ${s} failed:`,i?.message||i),Ce("withTimeout error:",s,i),i}}async function Ko(p,R,s){let c=Array(p.length);if(p.length===0)return c;let n=0,i=Math.max(1,Math.min(Math.max(1,R),p.length));async function g(){while(n<p.length){let a=n++;c[a]=await s(p[a],a)}}return await Promise.all(Array.from({length:i},g)),c}var Wo=new WeakMap;function Zc(p){let R=Fn();if(p.plugins&&p.plugins.length>0){let s=new Set(["pickier","style","regexp","ts"]),c=p.plugins.filter((i)=>typeof i!=="string");R=c.some((i)=>s.has(i.name))?R:[];for(let i of c)R.push(i)}return R}function Gc(p,R){let s={...p.pluginRules||{},...p.rules||{}};if(p.rules?.noUnusedCapturingGroup)s["regexp/no-unused-capturing-group"]=p.rules.noUnusedCapturingGroup;let c={"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(c))if(s[n])s[i]=s[n];for(let n of[p.pluginRules,p.rules])for(let i of Object.keys(n||{})){if(i.includes("/"))continue;for(let g of R)if(g.rules&&Object.prototype.hasOwnProperty.call(g.rules,i))s[`${g.name}/${i}`]=n[i]}return s}function Ln(p){let R=Wo.get(p);if(R)return R;let s=Zc(p),c=Gc(p,s),n=[],i=[],g=new Set(["no-debugger"]),a=new Set(["no-debugger"]),M=new Set;for(let A of s)for(let O in A.rules){let _=`${A.name}/${O}`,U=L(c,_);if(!U.enabled)continue;if(M.has(O))continue;M.add(O);let B=A.rules[O],q={pluginName:A.name,ruleName:O,fullRuleId:_,rule:B,severity:U.severity,options:U.options};if(typeof B?.check==="function")n.push(q);else if(U.severity==="error")n.push(q);if(typeof B?.fix==="function")i.push(q),g.add(_),a.add(O)}let v={checkRules:n,fixRules:i,fixableRuleIds:g,fixableBareRuleNames:a};return Wo.set(p,v),v}function D(p){return Ln(p).checkRules.map((R)=>({id:R.fullRuleId,plugin:R.pluginName,severity:R.severity,options:R.options}))}function Vc(p,R){return/\.(?:sh|bash|zsh|ksh|dash)$/.test(p)||/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/.test(R)}function Kc(p){return/(?:^|[/\\])(?:bun\.lock|bun\.lockb|package-lock\.json|pnpm-lock\.yaml|yarn\.lock|npm-shrinkwrap\.json)$/.test(p)}function Ho(p,R,s){switch(p.pluginName){case"markdown":return R.endsWith(".md");case"shell":return Vc(R,s);case"publint":return/(?:^|[/\\])package\.json$/.test(R);case"lockfile":return Kc(R);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(R);default:return!0}}async function Sn(p,R,s,c){let n=[],i=Ln(s),g={filePath:p,config:s};for(let a=0;a<i.checkRules.length;a++){let M=i.checkRules[a];if(c?.has(M.fullRuleId)||!Ho(M,p,R))continue;let v=n.length;if(await Hc(M,p,R,g,n),c)for(let A=v;A<n.length;A++)n[A].pos=a}return n}async function Hc(p,R,s,c,n){let{fullRuleId:i,rule:g,severity:a}=p;if(!g||typeof g.check!=="function"){if(a==="error")n.push({filePath:R,line:1,column:1,ruleId:`${i}-internal`,message:"Rule missing implementation (check function is undefined)",severity:"error"});return}try{Ce("rule:start",i);let M=r.RULE_TIMEOUT_MS,v={...c,options:p.options},A=performance.now(),O=await st(Promise.resolve().then(()=>g.check(s,v)),M,`rule:${i}`),_=performance.now()-A;if(_>M)n.push({filePath:R,line:1,column:1,ruleId:`${i}-internal`,message:`Rule exceeded timeout budget: ${Math.round(_)}ms > ${M}ms`,severity:"error"});Ce("rule:end",i,Array.isArray(O)?O.length:0);for(let U of O){let B=zc(U,i);if(a)n.push({...B,severity:a});else n.push(B)}}catch(M){n.push({filePath:R,line:1,column:1,ruleId:`${i}-internal`,message:`Rule threw: ${M?.message||M}`,severity:"error"})}}var Yc=/\.(?:[cm]?[jt]sx?|vue|svelte|stx)$/i;function Xc(p,R,s){if(!Yc.test(s)||!p.includes("`"))return R;let c=p.split(/\r?\n/),n=R.split(/\r?\n/);if(c.length!==n.length)return R;let i=We(p),g=0;for(let a=0;a<n.length;a++)if(i[a]&&n[a]!==c[a])n[a]=c[a],g++;return g>0?n.join(`
|
|
120
|
-
`):R}function Yo(p,R,s){let c=Ln(s),n={filePath:p,config:s},i=R,g=!0,a=0;while(g&&a++<E){g=!1;for(let M of c.fixRules){if(!Ho(M,p,i))continue;let v={...n,options:M.options},A=M.rule.fix(i,v),O=M.rule.meta?.editsStringContent?A:Xc(i,A,p);if(O!==i)i=O,g=!0}}return i}function Xo(p,R,s,c,n){if(!o(s,"no-debugger",["noDebugger"])||!R.includes("debugger"))return R;let g=p.split(".").pop()?.toLowerCase()??"",a=g==="sh"||g==="bash"||g==="zsh"||g==="ksh"||g==="dash"||/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/.test(R);if(g==="md"||g==="yaml"||g==="yml"||g==="json"||g==="jsonc"||a)return R;let M=/^\s*debugger\b/,v=Xn(R),A=R.split(/\r?\n/),O=[],_=!1;for(let U=0;U<A.length;U++){let B=A[U],q=U+1;if(M.test(B)&&!n.has(q)&&!v.has(q)&&!Ae("no-debugger",q,c)){_=!0;continue}O.push(B)}return _?O.join(`
|
|
121
|
-
`):R}function Jo(p,R,s){let c=o(s,"indent",["style/indent"],"warn");if(!c)return;let n=p.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(R))return;return c}function Jc(p,R,s,c){let n=R.format.indent,i=R.format.indentStyle,g=Xn(p),a=p.split(/\r?\n/),M=!1;for(let v=0;v<a.length;v++){let A=a[v],O=v+1;if(c.has(O)||g.has(O)||Ae("indent",O,s))continue;let _=0;while(_<A.length&&(A.charCodeAt(_)===32||A.charCodeAt(_)===9))_++;if(_===0)continue;let U=A.slice(0,_);if(!C(U,n,i,A))continue;let B;if(i==="tabs"){let q=0,z=0;for(let G=0;G<U.length;G++)if(U.charCodeAt(G)===9)z++;else q++;let Z=Math.floor(q/n);B="\t".repeat(z+Z)}else{let q=0;for(let Z=0;Z<U.length;Z++)if(U.charCodeAt(Z)===9)q+=n;else q++;let z=Math.floor(q/n)*n;B=" ".repeat(z)}if(B!==U)a[v]=B+A.slice(_),M=!0}return M?a.join(`
|
|
122
|
-
`):p}var nt=null;function En(){nt=null,es()}function Xn(p){if(nt!==null&&nt.content===p)return nt.lines;let R=Qc(p);return nt={content:p,lines:R},R}var Ue=0,zn=1,Zn=2,No=3,Do=4,Gn=5,jo=6,Vn=1,Uo=2;function Qc(p){let R=new Set;if(!p.includes("`"))return R;let s=[],c=!1,n=Ue,i=1,g=0,a=-1,M=0,v=p.length;for(let A=0;A<v;A++){let O=p.charCodeAt(A);if(O===10){if(n===No)n=Ue;i++,M=A+1,a=-1;continue}if(n===Ue&&c&&g!==i)R.add(i),g=i;if(n!==Ue){switch(n){case zn:case Zn:if(O===92)A++;else if(n===zn&&O===39||n===Zn&&O===34)n=Ue;break;case Do:if(O===42&&p.charCodeAt(A+1)===47)A++,n=Ue;break;case Gn:if(O===92)A++;else if(O===91)n=jo;else if(O===47)n=Ue;break;case jo:if(O===92)A++;else if(O===93)n=Gn;break}continue}if(c){if(O===92){A++;continue}if(O===96){s.pop(),c=s.length>0&&s[s.length-1]===Vn;continue}if(O===36&&p.charCodeAt(A+1)===123){s.push(Uo),c=!1,A++;continue}continue}if(O===96){if(s.push(Vn),c=!0,g!==i)R.add(i),g=i;continue}if(O===39){n=zn;continue}if(O===34){n=Zn;continue}if(O===47){let _=p.charCodeAt(A+1);if(_===47){n=No,A++;continue}if(_===42){n=Do,A++;continue}if(Jn(a<0?"":p[a],p.slice(M,A+1),A-M)){n=Gn;continue}}if(O===125&&s.length>0&&s[s.length-1]===Uo){s.pop(),c=s.length>0&&s[s.length-1]===Vn;continue}if(!(O===32||O>=9&&O<=13||O>=128&&/\s/.test(p[A])))a=A}return R}function Fo(p,R){let s=p.match(R);if(!s||s.index===void 0)return null;let c=s.index+s[0].length-1,n=0;for(let i=c;i<p.length;i++)if(p[i]==="(")n++;else if(p[i]===")"){if(n--,n===0)return p.slice(c+1,i)}return null}function Bo(p){let R="",s=0;for(let c of p){if(c==="("){s++;continue}if(c===")"){s=Math.max(0,s-1);continue}if(s===0)R+=c}return R}function qo(p){if(!p.includes("/"))return p;let R="",s=0;while(s<p.length){if(p[s]==="/"){if(p[s+1]==="/"||p[s+1]==="*")return R+p.slice(s);let c=p.slice(0,s).trimEnd();if(Jn(c[c.length-1]??"",p,s)){s++;let n=!1;while(s<p.length){if(p[s]==="\\"){s+=2;continue}if(p[s]==="[")n=!0;else if(p[s]==="]")n=!1;else if(p[s]==="/"&&!n){s++;while(s<p.length&&/[gimsuvy]/.test(p[s]))s++;break}s++}continue}}R+=p[s],s++}return R}function Jn(p,R,s){if(p==="")return!0;if("([{,:;!?&|=<>~^+*%-".includes(p))return!0;if(/[A-Za-z_$]/.test(p)){let n=R.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(p){if(!p.includes("/"))return p;let R="",s=0,c=null,n=!1;while(s<p.length){let i=p[s],g=p[s+1];if(n){R+=i,n=!1,s++;continue}if(i==="\\"&&c){n=!0,R+=i,s++;continue}if(!c){if(i==='"'){c="double",R+=i,s++;continue}if(i==="'"){c="single",R+=i,s++;continue}if(i==="`"){c="template",R+=i,s++;continue}if(i==="/"&&g==="/")break;if(i==="/"&&g==="*"){s+=2;while(s<p.length){if(p[s]==="*"&&p[s+1]==="/"){s+=2;break}s++}R+=" ";continue}R+=i,s++}else{if(c==="double"&&i==='"'||c==="single"&&i==="'"||c==="template"&&i==="`")c=null;R+=i,s++}}return R}function De(p){let R=new Set,s="code",c=1,n=!1,i=!1,g=!1,a=[];for(let M=0;M<p.length;M++){let v=p[M],A=p[M+1],O=M>0?p[M-1]:"";if(v===`
|
|
123
|
-
`){if(g&&s==="block-comment")R.add(c);else if(!n&&i&&s!=="block-comment")R.add(c);else if(!n&&s==="block-comment")R.add(c);if(c++,n=!1,i=!1,g=s==="block-comment",s==="line-comment")s="code";continue}switch(s){case"code":if(v==="/"&&A==="/")s="line-comment",i=!0,M++;else if(v==="/"&&A==="*"){let _=!1;if(M>0){let U=M-1;while(U>0&&(p[U]===" "||p[U]==="\t"))U--;let B=p[U];if("=([{,;!&|?:~^%+-".includes(B)&&B!==`
|
|
124
|
-
`)_=!0;else if(/[a-z]/.test(B)){let q=p.slice(Math.max(0,U-6),U+1);if(/\b(?:return|case|typeof|void|in|of|new|throw|delete)$/.test(q))_=!0}}if(_){n=!0,M++;while(M<p.length){if(p[M]==="\\"){M+=2;continue}if(p[M]==="/"){M++;break}if(p[M]===`
|
|
125
|
-
`)break;M++}while(M<p.length&&/[gimsuy]/.test(p[M]))M++;M--}else i=!0,s="block-comment",M++}else if(v==="/"&&A!==void 0){let _=!1;if(M>0){let U=M-1;while(U>0&&(p[U]===" "||p[U]==="\t"))U--;let B=p[U];if("=([{,;!&|?:~^%+-".includes(B)||B===`
|
|
126
|
-
`)_=!0;else if(/[a-z]/.test(B)){let q=p.slice(Math.max(0,U-6),U+1);if(/\b(?:return|case|typeof|void|in|of|new|throw|delete)$/.test(q))_=!0}}if(_){n=!0,M++;while(M<p.length){if(p[M]==="\\"){M+=2;continue}if(p[M]==="/"){M++;break}if(p[M]===`
|
|
127
|
-
`)break;M++}while(M<p.length&&/[gimsuy]/.test(p[M]))M++;M--}else n=!0}else if(v==="'")s="string-single",n=!0;else if(v==='"')s="string-double",n=!0;else if(v==="`")s="string-template",n=!0;else if(v==="{"){if(a.length)a[a.length-1]++;n=!0}else if(v==="}"){if(a.length)if(a[a.length-1]===0)a.pop(),s="string-template";else a[a.length-1]--;n=!0}else if(v!==" "&&(v<"\t"||v>"\r")&&(v<"\x80"||!/\s/.test(v)))n=!0;break;case"string-single":if(v==="\\"){M++;break}if(v==="'")s="code";break;case"string-double":if(v==="\\"){M++;break}if(v==='"')s="code";break;case"string-template":if(v==="\\"){M++;break}if(v==="$"&&A==="{"){a.push(0),s="code",M++;break}if(v==="`")s="code";break;case"line-comment":break;case"block-comment":if(v==="*"&&A==="/")s="code",M++;break}}if(g&&s==="block-comment")R.add(c);else if(!n&&i&&s!=="block-comment")R.add(c);else if(!n&&s==="block-comment")R.add(c);return R}function it(p,R,s,c,n){let i=[],g=R.split(/\r?\n/),a=s.format.quotes,M=p.split(".").pop()?.toLowerCase()??"",v=M==="md",A=M==="sh"||M==="bash"||M==="zsh"||M==="ksh"||M==="dash"||/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/.test(R),O=o(s,"quotes",["style/quotes"],"warn"),_=!O||M==="json"||M==="jsonc"||M==="lock"||v||M==="yaml"||M==="yml"||M==="stx"||M==="html"||M==="htm"||M==="vue"||A||p.endsWith("bun.lock"),U=v||M==="yaml"||M==="yml"||M==="json"||M==="jsonc"||A,B=Jo(p,R,s),q=!1,z=o(s,"no-debugger",["noDebugger"]),Z=o(s,"no-console",["noConsole"]),G=o(s,"no-template-curly-in-string",["noTemplateCurlyInString"]),X=o(s,"no-cond-assign",["noCondAssign"]),V=/\bconsole\.log\s*\(/,K=/^\s*debugger\b/,ie=new Set;if(M==="md"){let me=!1;for(let H=0;H<g.length;H++){if(/^(?:`{3,}|~{3,})/.test(g[H].trim())){me=!me;continue}if(me)ie.add(H+1)}}let ue=Xn(R);for(let me=0;me<g.length;me++){let H=g[me],re=me+1;if(n.has(re))continue;if(!_&&!ue.has(re)){let le=zo(qo(H)),te=S(le,a);if(te.length>0&&!q){if(!Ae("quotes",re,c))i.push({filePath:p,line:re,column:(te[0]||0)+1,ruleId:"quotes",message:"Inconsistent quote style",severity:O,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"}'`});q=!0}}let se=0;while(se<H.length&&(H.charCodeAt(se)===32||H.charCodeAt(se)===9))se++;let ne=se>0?H.slice(0,se):"";if(B&&ne.length>0&&!ie.has(re)&&!ue.has(re)&&C(ne,s.format.indent,s.format.indentStyle,H)){if(!Ae("indent",re,c))i.push({filePath:p,line:re,column:1,ruleId:"indent",message:"Incorrect indentation detected",severity:B,help:`Use ${s.format.indentStyle==="spaces"?`${s.format.indent} spaces`:"tabs"} for indentation. Configure with format.indent and format.indentStyle in your config`})}if(!U&&z&&!ue.has(re)&&K.test(H)){if(!Ae("no-debugger",re,c))i.push({filePath:p,line:re,column:1,ruleId:"no-debugger",message:"Unexpected debugger statement",severity:z,help:"Remove debugger statements before committing code. Use breakpoints in your IDE instead, or run with --fix to auto-remove"})}if(!U&&Z&&!ue.has(re)&&V.test(H)){let le=H.indexOf("//"),te=H.indexOf("console.");if(le!==-1&&te>le);else{let fe=null;for(let oe=0;oe<H.length;oe++){let ae=H[oe];if(!fe){if(ae==='"')fe="double";else if(ae==="'")fe="single";else if(ae==="`")fe="template";else if(H.slice(oe).startsWith("console.")){let be=oe+1;if(!Ae("no-console",re,c))i.push({filePath:p,line:re,column:be,ruleId:"no-console",message:"Unexpected console call",severity:Z,help:"Remove console statements before committing. Use a proper logging library or disable this rule if console output is intentional"});break}}else if(fe==="double"&&ae==='"'||fe==="single"&&ae==="'"||fe==="template"&&ae==="`"){let be=0;for(let Q=oe-1;Q>=0&&H[Q]==="\\";Q--)be++;if(be%2===0)fe=null}}}}if(G&&!ue.has(re)){let le=H,te=null,fe=!1,oe=!1,ae="",be="";for(let Q=0;Q<le.length;Q++){let Y=le[Q];if(fe){if(be==="\\"){be=Y;continue}if(oe){if(Y==="]")oe=!1}else if(Y==="[")oe=!0;else if(Y==="/"){fe=!1;while(Q+1<le.length&&/[a-z]/i.test(le[Q+1]))Q++;ae="/"}be=Y;continue}if(!te){if(Y==='"'){te="double",be=Y;continue}if(Y==="'"){te="single",be=Y;continue}if(Y==="`"){te="template",be=Y;continue}if(Y==="/"&&le[Q+1]!=="/"&&le[Q+1]!=="*"&&Jn(ae,le,Q)){fe=!0,oe=!1,be=Y;continue}if(Y!==" "&&Y!=="\t")ae=Y}else if(te==="double"&&Y==='"'||te==="single"&&Y==="'"||te==="template"&&Y==="`"){if(be!=="\\")te=null}else if(Y==="$"&&le[Q+1]==="{"&&be!=="\\"&&te!=="template"){if(!Ae("no-template-curly-in-string",re,c))i.push({filePath:p,line:re,column:Q+1,ruleId:"no-template-curly-in-string",message:"Unexpected template string expression in normal string",severity:G,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}be=Y}}if(!U&&X&&!ue.has(re)){let te=zo(qo(H)).replace(/'[^']*'|"[^"]*"/g,'""'),fe=(Q)=>/[^=!<>]=(?![=>])/.test(Q),oe=(Q)=>{let Y=H.match(Q);if(Y&&Y.index!==void 0)return Y.index+Y[0].length;return Math.max(1,H.indexOf("(")+1)},ae=Fo(te,/\b(?:if|while)\s*\(/);if(ae){let Q=Bo(ae);if(fe(Q)){if(!Ae("no-cond-assign",re,c))i.push({filePath:p,line:re,column:oe(/\b(?:if|while)\s*\(/),ruleId:"no-cond-assign",message:"Unexpected assignment within a conditional expression",severity:X,help:"Use === or == for comparison instead of = (assignment). Wrap intentional assignments in extra parentheses."})}}let be=Fo(te,/\bfor\s*\(/);if(be){let Q=be.split(";");if(Q.length>=2){let Y=Bo(Q[1]);if(fe(Y)){if(!Ae("no-cond-assign",re,c))i.push({filePath:p,line:re,column:oe(/\bfor\s*\(/),ruleId:"no-cond-assign",message:"Unexpected assignment within a conditional expression",severity:X,help:"Use === or == for comparison instead of = (assignment). Wrap intentional assignments in extra parentheses."})}}}}}return i}async function x(p,R,s){En();let c=Yn(p,"utf8");if(s._formatOnly){let M=d(c,R,p);if(M!==c)if(!s.dryRun)Hn(p,M,"utf8");else return[{filePath:p,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 ea(p,c,R,s._nativeRules);let n=Ne(c),g=/\.(?:ts|js|tsx|jsx|mts|mjs|cts|cjs)$/.test(p)?De(c):new Set,a=it(p,c,R,n,g);try{let M=await Sn(p,c,R);for(let v of M){if(Ae(v.ruleId,v.line,n))continue;if(g.has(v.line)&&Cn(v.ruleId))continue;a.push({filePath:v.filePath,line:v.line,column:v.column,ruleId:v.ruleId,message:v.message,severity:v.severity,...v.help&&{help:v.help}})}}catch{}{let M=new Set;a=a.filter((v)=>{let A=`${v.line}:${v.column}:${v.ruleId}`;if(M.has(A))return!1;return M.add(A),!0})}if(s.fix){let M=I(c,R,p);if(M!==c){let v=Ne(M),A=De(M);if(a=it(p,M,R,v,A),!s.dryRun)Hn(p,M,"utf8");if(s.dryRun&&(s.verbose!==void 0?s.verbose:R.verbose))Ie().debug(t.gray(`dry-run: would apply fixes in ${$n(process.cwd(),p)}`))}}return Ce("scan done",$n(process.cwd(),p),a.length),a}var Kn=null;async function ea(p,R,s,c){if(Kn?.ids!==c)Kn={ids:c,set:new Set(c)};let n=await Sn(p,R,s,Kn.set);if(n.length===0)return n;let i=Ne(R),g=De(R),a=[];for(let M of n){if(Ae(M.ruleId,M.line,i))continue;if(g.has(M.line)&&Cn(M.ruleId))continue;a.push({filePath:M.filePath,line:M.line,column:M.column,ruleId:M.ruleId,message:M.message,severity:M.severity,...M.help&&{help:M.help},pos:M.pos})}return a}async function j(p,R){if(r.DIAGNOSTICS||r.TRACE)await Ie().ready();try{return await ta(p,R)}finally{await w()}}async function ta(p,R){Ce("runLint:start",{globs:p,options:R});let s=r.DIAGNOSTICS;if(s)Ie().info("[pickier:diagnostics] Starting lint process...");try{if(s)Ie().info("[pickier:diagnostics] Loading config...");let c=await l(R.config);Ce("config:loaded",{reporter:c.lint.reporter,ext:c.lint.extensions.join(",")});let n=p.length?p:["."],i=y(n);if(Ce("patterns",i),s)Ie().info(`[pickier:diagnostics] Patterns to search: ${i.join(", ")}`);let g=R.ext||c.lint.extensions.join(","),a=new Set(g.split(",").map((Q)=>{let Y=Q.trim();return Y.startsWith(".")?Y:`.${Y}`}));if(s)Ie().info(`[pickier:diagnostics] File extensions: ${Array.from(a).join(", ")}`);let M=r.TIMEOUT_MS;if(s)Ie().info(`[pickier:diagnostics] Glob timeout: ${M}ms`);let v=i.some((Q)=>{let Y=Q.replace(/\/?\*\*\/*\*\*$/,""),ce=Ze(Y)?Y:Ge(process.cwd(),Y),ee=process.cwd();return ce!==ee&&!ce.startsWith(ee+Vo)}),A=v?m(f):m(c.ignores),O=h(A);if(s){if(Ie().info(`[pickier:diagnostics] Globbing outside project: ${v}, ignore patterns: ${A.length}`),v)Ie().info(`[pickier:diagnostics] Using universal ignores: ${f.slice(0,5).join(", ")}... (${f.length} total)`)}let _=[],U=i.length===1&&!/[*?[\]{}()!]/.test(i[0]);if(s)Ie().info(`[pickier:diagnostics] Starting file discovery... (nonGlobSingle: ${U})`);if(U)try{if(vn(i[0]).isFile())_=[Ze(i[0])?i[0]:Ge(process.cwd(),i[0])]}catch{}let B=i.length===1&&/\*\*\/*\*$/.test(i[0]);if(!_.length&&B){let Q=i[0].replace(/\/?\*\*\/*\*\*$/,"");if(s)Ie().info(`[pickier:diagnostics] Using fast directory scan for: ${Q}`);try{let ce=[Ze(Q)?Q:Ge(process.cwd(),Q)],ee=0;while(ce.length){let J=ce.pop();if(ee++,s&&ee%100===0)Ie().info(`[pickier:diagnostics] Scanned ${ee} directories, ${_.length} files found so far...`);let he=Zo(J);for(let Re of he){let pe=Go(J,Re),Pe=vn(pe);if(O(pe))continue;if(Pe.isDirectory())ce.push(pe);else _.push(pe)}}if(s)Ie().info(`[pickier:diagnostics] Fast scan complete: ${ee} directories, ${_.length} total files`)}catch(Y){if(s)Ie().info(`[pickier:diagnostics] Fast scan failed: ${Y?.message}, falling back to glob`);_=await st(u(i,{dot:!1,ignore:A,onlyFiles:!0,absolute:!0}),M,"glob")}}else if(!_.length){if(s)Ie().info(`[pickier:diagnostics] Using glob with timeout ${M}ms...`);if(_=await st(u(i,{dot:!1,ignore:A,onlyFiles:!0,absolute:!0}),M,"glob"),s)Ie().info(`[pickier:diagnostics] glob found ${_.length} files`)}if(Ce("globbed entries",_.length),s)Ie().info(`[pickier:diagnostics] File discovery complete: ${_.length} files found`);if(_.length>1e4){if(Ie().warn(`[pickier:warn] Found ${_.length} files. This seems unusually high and may cause memory issues.`),Ie().warn("[pickier:warn] Consider checking your ignore patterns or being more specific with your glob pattern."),Ie().warn("[pickier:warn] Common culprits: node_modules, build directories, cache folders, or vendor dependencies."),_.length>1e5)return Ie().error(`[pickier:error] File count exceeds 100,000 (${_.length}). This will likely cause out-of-memory errors.`),Ie().error("[pickier:error] Aborting to prevent crash. Please refine your glob pattern or ignore patterns."),1}if(s)Ie().info(`[pickier:diagnostics] Filtering ${_.length} files by extension and ignore patterns...`);let q=0,z=0,Z=0,G=0,X=0,V=[];for(let Q of _){if(q++,s&&q%1000===0)Ie().info(`[pickier:diagnostics] Filtering progress: ${q}/${_.length} files checked, ${z} included...`);if(Q.replace(/\\/g,"/").includes("/node_modules/")){Z++;continue}if(O(Q)){G++;continue}if(!P(Q,a)){X++;continue}V.push(Q),z++}if(Ce("filter:cli",{total:q,included:z,node_modules:Z,ignored:G,wrongExt:X}),Ce("filtered files",V.length),s)Ie().info("[pickier:diagnostics] Filtering complete:"),Ie().info(`[pickier:diagnostics] Total files found: ${q}`),Ie().info(`[pickier:diagnostics] Files to lint: ${z}`),Ie().info(`[pickier:diagnostics] Excluded (node_modules): ${Z}`),Ie().info(`[pickier:diagnostics] Excluded (ignored): ${G}`),Ie().info(`[pickier:diagnostics] Excluded (wrong extension): ${X}`);if(V.length>5000){if(Ie().warn(`[pickier:warn] After filtering, ${V.length} files will be linted. This may take a while and use significant memory.`),V.length>50000)return Ie().error(`[pickier:error] ${V.length} files to lint exceeds safe limit (50,000). This will likely cause out-of-memory errors.`),Ie().error("[pickier:error] Aborting to prevent crash. Please be more specific with your glob pattern."),Ie().error("[pickier:error] Example: Instead of '../stx', try '../stx/src' or '../stx/packages/core'"),1}let K=r.CONCURRENCY;if(s)Ie().info(`[pickier:diagnostics] Starting to process ${V.length} files with concurrency ${K}...`);let ie=0,ue=async(Q)=>{if(s){if(ie++,ie===1||ie%10===0||ie===V.length)Ie().info(`[pickier:diagnostics] Processing file ${ie}/${V.length}: ${$n(process.cwd(),Q)}`)}return x(Q,c,R)},me=async(Q,Y=R)=>{if(Q.length===0)return[];let ce=Y===R?ue:(J)=>x(J,c,Y),ee=s||r.TRACE?0:_o(Q.length);return ee>1?To(Q,Y,ee,ce):Ko(Q,K,ce)},H=s||r.TRACE?null:$o(c,R),re=async(Q)=>{let Y=Array(Q.length);if(H){let J=Q.flatMap((Re,pe)=>vo(Re)?[pe]:[]),he=J.map((Re)=>Q[Re]);if(he.length>0&&H.hybrid){let[Re,pe]=await Promise.all([Lo(he,H.request,H.binary,H.positions),me(he,{...R,_nativeRules:H.nativeRules})]);if(Re)J.forEach((Pe,Me)=>{if(Re[Me])Y[Pe]=Oo(Re[Me],pe[Me])});Ce("native",{files:he.length,linted:Re?Re.filter(Boolean).length:0,hybrid:!0})}else if(he.length>0){let Re=Co(he,H.request,H.binary);if(Re)J.forEach((pe,Pe)=>{if(Re[Pe])Y[pe]=Re[Pe]});Ce("native",{files:he.length,linted:Re?Re.filter(Boolean).length:0})}}let ce=Q.flatMap((J,he)=>Y[he]===void 0?[he]:[]),ee=await me(ce.map((J)=>Q[J]));return ce.forEach((J,he)=>{Y[J]=ee[he]}),Y},se;if(Ro(c,R)){let Q=wo(c,R),Y=V.map((J)=>{try{return Yn(J,"utf8")}catch{return null}});se=Array(V.length);let ce=[];for(let J=0;J<V.length;J++){let he=Y[J]===null?void 0:Q.get(V[J],Y[J]);if(he)se[J]=he;else ce.push(J)}let ee=await re(ce.map((J)=>V[J]));ce.forEach((J,he)=>{if(se[J]=ee[he],Y[J]!==null)Q.set(V[J],Y[J],ee[he])}),Q.save(),Ce("cache",{hits:V.length-ce.length,misses:ce.length})}else se=await re(V);let ne=se.flat();if(s)Ie().info(`[pickier:diagnostics] Processing complete! Found ${ne.length} issues total`);let le=0,te=0;for(let Q of ne)if(Q.severity==="error")le++;else if(Q.severity==="warning")te++;if(Ce("issues:summary",{errors:le,warnings:te}),s)Ie().info(`[pickier:diagnostics] Errors: ${le}, Warnings: ${te}`);let fe=R.reporter||c.lint.reporter,oe=R.verbose!==void 0?R.verbose:c.verbose;if(fe==="json")console.log(JSON.stringify({errors:le,warnings:te,issues:ne},null,2));else if(fe==="compact")for(let Q of ne)console.log(`${$n(process.cwd(),Q.filePath)}:${Q.line}:${Q.column} ${Q.severity} ${Q.ruleId} ${Q.message}`);else if(ne.length>0)console.log(oe?yo(ne):xo(ne));if(ne.length>0&&fe!=="json"){let Q=le+te,Y=Q===1?"problem":"problems",ce=le===1?"error":"errors",ee=te===1?"warning":"warnings",J=Ln(c),he=0,Re=0;for(let pe of ne){let Pe=pe.ruleId;if(J.fixableRuleIds.has(Pe)||J.fixableBareRuleNames.has(Pe)){if(pe.severity==="error")he++;else if(pe.severity==="warning")Re++}}if(console.log(),console.log(t.red(`\u2716 ${Q} ${Y} (${le} ${ce}, ${te} ${ee})`)),he>0||Re>0){let pe=he===1?"error":"errors",Pe=Re===1?"warning":"warnings";console.log(t.gray(` ${he} ${pe} and ${Re} ${Pe} potentially fixable with the \`--fix\` option.`))}}if(oe&&fe!=="json")console.log(t.gray(`Scanned ${V.length} files, found ${le} errors and ${te} warnings.`));let ae=R.maxWarnings??c.lint.maxWarnings,be=r.FAIL_ON_WARNINGS;if(le>0)return Ce("runLint:end",1),1;if(be&&te>0)return Ce("runLint:end",1),1;if(ae>=0&&te>ae)return Ce("runLint:end",1),1;return Ce("runLint:end",0),0}catch(c){return Ie().error("[pickier:error] runLint failed:",c?.message||c),Ce("runLint:exception",c),1}}
|
|
128
|
-
export{w,W,N,I,F,D,x,j};
|