@ls-stack/extended-lint 1.0.0 → 2.0.0
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/README.md +20 -121
- package/dist/extended-lint.d.mts +12 -3
- package/dist/extended-lint.d.ts +12 -3
- package/dist/extended-lint.js +9 -42
- package/dist/extended-lint.mjs +9 -42
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -6,134 +6,33 @@ To use any of these rules, you need to install the package:
|
|
|
6
6
|
pnpm add -D @lucasols/eslint-plugin-extended-lint
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
There is no `typescript` peer dependency (only an optional `eslint` one), so it works with any TypeScript version (including TypeScript 7) or none at all, and also as an [oxlint JS plugin](https://oxc.rs/docs/guide/usage/linter/js-plugins).
|
|
10
|
+
|
|
9
11
|
And then configure it in your eslint config:
|
|
10
12
|
|
|
11
13
|
```json
|
|
12
14
|
{
|
|
13
15
|
"plugins": ["@lucasols/extended-lint"],
|
|
14
16
|
"rules": {
|
|
15
|
-
"@lucasols/extended-lint
|
|
17
|
+
"@lucasols/extended-lint/<rule-name>": "error"
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
`
|
|
23
|
-
`
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Good
|
|
41
|
-
|
|
42
|
-
```ts
|
|
43
|
-
function foo({ a, b }: { a: string; b: string }) {
|
|
44
|
-
// ...
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
It will also work with the react `FC` type:
|
|
49
|
-
|
|
50
|
-
Bad
|
|
51
|
-
|
|
52
|
-
```ts
|
|
53
|
-
const Foo: FC<{ a: string; b: string }> = ({ a }) => {
|
|
54
|
-
/* ^ b is declared but not used in the component */
|
|
55
|
-
// ...
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Good
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
const Foo: FC<{ a: string; b: string }> = ({ a, b }) => {
|
|
63
|
-
// ...
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
- This rule will not work in all situations, as it does not checks all possible usages of referenced types.
|
|
68
|
-
|
|
69
|
-
## `no-commented-out-code`
|
|
70
|
-
|
|
71
|
-
Checks if there are commented code. Block comments are ignored.
|
|
72
|
-
|
|
73
|
-
Examples
|
|
74
|
-
|
|
75
|
-
Bad:
|
|
76
|
-
|
|
77
|
-
```ts
|
|
78
|
-
// function foo() {
|
|
79
|
-
// // ...
|
|
80
|
-
// }
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Good:
|
|
84
|
-
|
|
85
|
-
```ts
|
|
86
|
-
/*
|
|
87
|
-
function foo() {
|
|
88
|
-
// ...
|
|
89
|
-
}
|
|
90
|
-
*/
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
- This rule will not detect all possible commented code, and can give false negatives.
|
|
94
|
-
|
|
95
|
-
## `no-call-with-infered-generics`
|
|
96
|
-
|
|
97
|
-
This rule disallows calling functions with inferred generics.
|
|
98
|
-
|
|
99
|
-
The rule options types are as follows:
|
|
100
|
-
|
|
101
|
-
````ts
|
|
102
|
-
type Options = [
|
|
103
|
-
{
|
|
104
|
-
functions: Array<{
|
|
105
|
-
name: string;
|
|
106
|
-
minGenerics?: number;
|
|
107
|
-
allowAny?: boolean;
|
|
108
|
-
disallowTypes?: string[];
|
|
109
|
-
}>;
|
|
110
|
-
anyAliases?: string[];
|
|
111
|
-
}
|
|
112
|
-
];
|
|
113
|
-
|
|
114
|
-
Examples:
|
|
115
|
-
|
|
116
|
-
Bad:
|
|
117
|
-
|
|
118
|
-
```ts
|
|
119
|
-
// @typescript-eslint/no-call-with-inferred-generics: ["error", { functions: ["foo"] }]
|
|
120
|
-
|
|
121
|
-
function foo<T>(arg: T) {
|
|
122
|
-
// ...
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
foo('bar') // Error: Generics must be defined explicitly
|
|
126
|
-
foo<any>('bar') // Error: 'any' is not allowed in generics
|
|
127
|
-
````
|
|
128
|
-
|
|
129
|
-
Good:
|
|
130
|
-
|
|
131
|
-
```ts
|
|
132
|
-
// @typescript-eslint/no-call-with-inferred-generics: ["error", { functions: ["foo"] }]
|
|
133
|
-
function foo<T>(arg: T) {
|
|
134
|
-
// ...
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
foo<string>('bar') // OK
|
|
138
|
-
```
|
|
139
|
-
|
|
22
|
+
Rules are being migrated to [`@ls-stack/fast-lint`](../fast-lint), where these now live (same names and options, so
|
|
23
|
+
`@ls-stack/<rule>` configs and disable comments keep working there): `improved-no-unnecessary-condition`,
|
|
24
|
+
`strict-casting` (also replaces the removed `no-unnecessary-casting`), `no-unnecessary-void-on-promise`,
|
|
25
|
+
`advanced-no-restricted-syntax` (now `no-restricted-syntax`), `no-default-export`, `no-reexport`, `no-relative-imports`,
|
|
26
|
+
`no-sync-dynamic-import`, `no-leaked-text-in-jsx`, `no-static-style-prop`, `no-non-camel-case-functions`,
|
|
27
|
+
`prefer-named-functions`, `no-call-with-explicit-generics`, `no-call-with-inferred-generics`, `no-unnecessary-typing`,
|
|
28
|
+
`no-type-guards`, `use-state-setter-naming`, `require-lazy-execution`, `no-unnecessary-iife`, `require-description`,
|
|
29
|
+
`no-write-only-ref`, `no-commented-out-code`, `react-single-export`, `no-unused-optional-args`,
|
|
30
|
+
`no-unused-type-props-in-args`, `no-unused-t-state-field`, `no-unused-selected-values`, `no-optional-root-props`,
|
|
31
|
+
`no-redundant-function-params`, `react-no-module-level-single-use-values`, `require-reads-to-var-prop`,
|
|
32
|
+
`prefer-react-hook-alternative`, `sort-react-components-and-styles`, `use-types-directly-above-usage` and
|
|
33
|
+
`react-compiler-extra`. The `rules-of-hooks` and `exhaustive-deps` forks were removed; use `eslint-plugin-react-hooks`
|
|
34
|
+
(or oxlint's built-in rules) instead.
|
|
35
|
+
|
|
36
|
+
Remaining rules: `collapse-simple-objs-in-one-line`, `no-data-attributes-on-components`, `no-restricted-comments`,
|
|
37
|
+
`no-unnecessary-async-on-jsx-props`, `no-unnecessary-describe`, `no-unused-obj-props`, `react-compiler-migration`,
|
|
38
|
+
`require-usage-explanation`, `template-indent` and `use-top-level-regex`.
|
package/dist/extended-lint.d.mts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
type ExtendedLintRuleListener = {
|
|
2
|
+
visit(node: unknown): void;
|
|
3
|
+
}['visit'];
|
|
4
|
+
type ExtendedLintRule = {
|
|
5
|
+
meta?: object;
|
|
6
|
+
create(context: never): Record<string, ExtendedLintRuleListener | undefined>;
|
|
7
|
+
};
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
type ExtendedLintPlugin = {
|
|
10
|
+
rules: Record<string, ExtendedLintRule>;
|
|
11
|
+
};
|
|
12
|
+
declare const extendedLintPlugin: ExtendedLintPlugin;
|
|
4
13
|
|
|
5
|
-
export { extendedLintPlugin as default, extendedLintPlugin };
|
|
14
|
+
export { type ExtendedLintPlugin, extendedLintPlugin as default, extendedLintPlugin };
|
package/dist/extended-lint.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
type ExtendedLintRuleListener = {
|
|
2
|
+
visit(node: unknown): void;
|
|
3
|
+
}['visit'];
|
|
4
|
+
type ExtendedLintRule = {
|
|
5
|
+
meta?: object;
|
|
6
|
+
create(context: never): Record<string, ExtendedLintRuleListener | undefined>;
|
|
7
|
+
};
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
type ExtendedLintPlugin = {
|
|
10
|
+
rules: Record<string, ExtendedLintRule>;
|
|
11
|
+
};
|
|
12
|
+
declare const extendedLintPlugin: ExtendedLintPlugin;
|
|
4
13
|
|
|
5
|
-
export { extendedLintPlugin as default, extendedLintPlugin };
|
|
14
|
+
export { type ExtendedLintPlugin, extendedLintPlugin as default, extendedLintPlugin };
|
package/dist/extended-lint.js
CHANGED
|
@@ -1,44 +1,11 @@
|
|
|
1
|
-
"use strict";var kr=Object.create;var rt=Object.defineProperty;var jr=Object.getOwnPropertyDescriptor;var Mr=Object.getOwnPropertyNames;var Lr=Object.getPrototypeOf,_r=Object.prototype.hasOwnProperty;var $r=(e,t)=>{for(var o in t)rt(e,o,{get:t[o],enumerable:!0})},Nn=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Mr(t))!_r.call(e,i)&&i!==o&&rt(e,i,{get:()=>t[i],enumerable:!(r=jr(t,i))||r.enumerable});return e};var Oe=(e,t,o)=>(o=e!=null?kr(Lr(e)):{},Nn(t||!e||!e.__esModule?rt(o,"default",{value:e,enumerable:!0}):o,e)),zr=e=>Nn(rt({},"__esModule",{value:!0}),e);var Ta={};$r(Ta,{default:()=>Sa,extendedLintPlugin:()=>Dr});module.exports=zr(Ta);var le=require("@typescript-eslint/utils"),w=require("zod/v4");var Rn=require("@typescript-eslint/utils"),wn=Oe(require("zod/v4"));function v(e){let o=Rn.ESLintUtils.RuleCreator(r=>`https://github.com/lucasols/extended-lint#${r}`)(e);return{name:e.name,rule:o}}function k(e){return wn.toJSONSchema(e)}var Ur=w.z.object({disallow:w.z.array(w.z.object({selector:w.z.string(),message:w.z.string(),replace:w.z.optional(w.z.union([w.z.string(),w.z.object({regex:w.z.string(),with:w.z.string()})])),replaceType:w.z.optional(w.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:w.z.optional(w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.optional(w.z.array(w.z.object({atIndex:w.z.number(),value:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))),message:w.z.string(),replaceWith:w.z.optional(w.z.string()),ignoreRegex:w.z.optional(w.z.string())}))),__dev_simulateFileName:w.z.optional(w.z.string()),mustMatchSyntax:w.z.optional(w.z.array(w.z.object({includeRegex:w.z.string(),excludeRegex:w.z.optional(w.z.string()),mustCallFn:w.z.optional(w.z.array(w.z.object({anyCall:w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.array(w.z.object({atIndex:w.z.number(),literal:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))})),message:w.z.optional(w.z.string())}))),mustMatchSelector:w.z.optional(w.z.array(w.z.object({selector:w.z.string(),message:w.z.string()}))),mustHaveExport:w.z.optional(w.z.array(w.z.object({name:w.z.string(),type:w.z.enum(["function","variable","any"]).default("any"),message:w.z.string()})))})))}),Et=v({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[k(Ur)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let o={},{mustMatchSyntax:r,__dev_simulateFileName:i,disallow:s,disallowFnCalls:n}=t,a=i??e.filename,p=[],l=new Map,d=new Set,m=new Map,u=new Set,f=new Map;function c(E){for(let I of E.specifiers)I.type===le.AST_NODE_TYPES.ImportSpecifier&&I.imported.type===le.AST_NODE_TYPES.Identifier&&I.imported.name!==I.local.name&&f.set(I.local.name,I.imported.name)}function g(E){if(E.declaration){if(E.declaration.type===le.AST_NODE_TYPES.FunctionDeclaration&&E.declaration.id){let I=E.declaration.id.name;for(let D of Array.from(u)){let[M,U]=D.split(":");M===I&&(U==="function"||U==="any")&&u.delete(D)}}else if(E.declaration.type===le.AST_NODE_TYPES.VariableDeclaration){for(let I of E.declaration.declarations)if(I.id.type===le.AST_NODE_TYPES.Identifier){let D=I.id.name;for(let M of Array.from(u)){let[U,Z]=M.split(":");U===D&&(Z==="variable"||Z==="any")&&u.delete(M)}}}}for(let I of E.specifiers)if(I.exported.type===le.AST_NODE_TYPES.Identifier){let D=I.exported.name;for(let M of Array.from(u)){let[U,Z]=M.split(":");U===D&&Z==="any"&&u.delete(M)}}}function T(E){E.id.type===le.AST_NODE_TYPES.Identifier&&E.init?.type===le.AST_NODE_TYPES.Identifier&&f.set(E.id.name,E.init.name)}function y(E){return f.get(E)??E}function C(E,I){return y(E)===I||E===I}for(let{includeRegex:E,excludeRegex:I,mustCallFn:D,mustMatchSelector:M,mustHaveExport:U}of r??[]){let h=function(x){let P=x;for(let{name:j,value:Y}of Z??[])P=P.replaceAll(j,Y);return P};var b=h;let Z=Jr(a,new RegExp(E));if(Z&&!(I&&new RegExp(I).test(a))){for(let{anyCall:x,message:P}of D??[]){let j=`Expected file to call the function: ${x.map(({fn:Y})=>Y).join(" or ")}`;d.add(j),p.push(Y=>{let{callee:q}=Y;if(q.type===le.AST_NODE_TYPES.Identifier){for(let{fn:ne,withArgs:Q}of x)if(q.name===ne){d.delete(j);for(let F of Q){let J=Y.arguments[F.atIndex],L=typeof F.literal=="string"?h(F.literal):F.literal;if(!J){e.report({node:Y,messageId:"default",data:{message:`Missing argument with value "${L}" at index ${F.atIndex}${P?`: ${h(P)}`:""}`}});continue}if(J.type!==le.AST_NODE_TYPES.Literal){e.report({node:J,messageId:"default",data:{message:`Argument at position ${F.atIndex} should the literal "${L}"${P?`: ${h(P)}`:""}`}});continue}J.value!==L&&e.report({node:J,messageId:"default",data:{message:`Argument should have the value "${L}"${P?`: ${h(P)}`:""}`},fix:ae=>ae.replaceText(J,typeof L=="string"?`'${L}'`:String(L))})}break}}})}for(let{selector:x,message:P}of M??[])m.set(x,h(P)),l.set(h(x),()=>{m.delete(x)});for(let{name:x,type:P,message:j}of U??[]){let Y=h(x),q=h(j);u.add(`${Y}:${P}:${q}`)}}}for(let{fn:E,withArgs:I,message:D,replaceWith:M,ignoreRegex:U}of n??[])U&&new RegExp(U).test(a)||p.push(Z=>{let{callee:h}=Z;if(h.type!==le.AST_NODE_TYPES.Identifier||!C(h.name,E))return;if(I)for(let P of I){let j=Z.arguments[P.atIndex];if(!j){e.report({node:Z,messageId:"default",data:{message:`Missing argument with value "${P.value}" at index ${P.atIndex}: ${D}`}});return}if(j.type!==le.AST_NODE_TYPES.Literal||j.value!==P.value)return}let x=P=>M?P.replaceText(Z,M):null;e.report({node:Z,messageId:"default",data:{message:D},suggest:M?[{messageId:"default",data:{message:`Replace with "${M}"`},fix:x}]:void 0})});function A(E,I){let D=o[E];D?o[E]=M=>{D(M),I(M)}:o[E]=I}for(let{selector:E,message:I,replace:D,replaceType:M="suggestion"}of s??[]){if(E==="CallExpression"){p.push(U=>{S(D,U,I,M)});continue}o[E]=U=>{S(D,U,I,M)}}if(l.size>0)for(let[E,I]of l)A(E,I);return p.length>0&&(o.CallExpression=E=>{if(E.type===le.AST_NODE_TYPES.CallExpression)for(let I of p)I(E)}),o.ImportDeclaration=E=>{E.type===le.AST_NODE_TYPES.ImportDeclaration&&c(E)},o.ExportNamedDeclaration=E=>{E.type===le.AST_NODE_TYPES.ExportNamedDeclaration&&g(E)},o.VariableDeclarator=E=>{E.type===le.AST_NODE_TYPES.VariableDeclarator&&T(E)},o["Program:exit"]=E=>{for(let I of d)e.report({node:E,messageId:"default",data:{message:I}});for(let[,I]of m)e.report({node:E,messageId:"default",data:{message:I}});for(let I of u){let[D,M,U]=I.split(":");e.report({node:E,messageId:"default",data:{message:`Missing required export "${D}" of type ${M}: ${U}`}})}},o;function S(E,I,D,M){let U=Z=>{if(!E)return null;if(typeof E=="string")return Z.replaceText(I,E);{let h=new RegExp(E.regex),x=e.sourceCode.getText(I);return Z.replaceText(I,x.replace(h,E.with))}};e.report({node:I,messageId:"default",data:{message:D},fix:E&&M==="autofix"?U:void 0,suggest:E&&M==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof E=="string"?E:E.with}"`},fix:U}]:void 0})}}});function Jr(e,t){let o=[],r=t.exec(e);if(!r)return null;let[i,...s]=r;o.push({name:"$0_lowercase",value:i.toLowerCase()}),o.push({name:"$0_capitalize",value:Fn(i)}),o.push({name:"$0_uncapitalize",value:On(i)}),o.push({name:"$0",value:i});for(let n=0;n<s.length;n++){let a=`$${n+1}`,p=s[n];p!==void 0&&(o.push({name:`${a}_lowercase`,value:p.toLowerCase()}),o.push({name:`${a}_capitalize`,value:Fn(p)}),o.push({name:`${a}_uncapitalize`,value:On(p)}),o.push({name:a,value:p}))}return o}function Fn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function On(e){return e.charAt(0).toLowerCase()+e.slice(1)}var V=require("@typescript-eslint/utils"),De=require("zod/v4");var Vr=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vn="collapse-simple-objs-in-one-line",Xr=De.z.object({maxLineLength:De.z.number().optional(),maxProperties:De.z.number().optional(),nestedObjMaxLineLength:De.z.number().optional(),nestedObjMaxProperties:De.z.number().optional(),ignoreTypesWithSuffix:De.z.array(De.z.string()).optional()}),Wr=Vr({name:vn,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[k(Xr)]},defaultOptions:[{}],create(e,[t]){let o=e.sourceCode,r=t.ignoreTypesWithSuffix??[],i=t.maxProperties??2,s=t.nestedObjMaxLineLength??t.maxLineLength,n=t.nestedObjMaxProperties??3;function a(l){if(l.type===V.AST_NODE_TYPES.ObjectExpression){let d=l.parent.type===V.AST_NODE_TYPES.Property,m=d?n:i,u=l.properties.length;if(u>m)return!1;if(u===1){let c=l.properties[0];return!c||c.type===V.AST_NODE_TYPES.Property&&c.value.type===V.AST_NODE_TYPES.ObjectExpression||c.type===V.AST_NODE_TYPES.Property&&c.value.type===V.AST_NODE_TYPES.ArrayExpression&&!c.value.elements.every(T=>T&&xt(T))?!1:{text:o.getText(c),isNested:d,propsSize:u}}let f=[];for(let c of l.properties){if(c.type===V.AST_NODE_TYPES.Property&&!xt(c.value))return!1;f.push(o.getText(c))}return{text:f.join(", "),isNested:d,propsSize:u}}else{let d=l.parent.parent?.type===V.AST_NODE_TYPES.TSPropertySignature,m=d?n:i,u=l.members.length;if(u>m)return!1;if(r.length>0&&l.parent.type===V.AST_NODE_TYPES.TSTypeAliasDeclaration){let c=l.parent.id.name;if(r.some(g=>c.endsWith(g)))return!1}if(u===1){let c=l.members[0];return!c||c.type===V.AST_NODE_TYPES.TSPropertySignature&&c.typeAnnotation?.typeAnnotation.type===V.AST_NODE_TYPES.TSTypeLiteral?!1:{text:o.getText(c),isNested:d,propsSize:1}}if(l.parent.type===V.AST_NODE_TYPES.TSIntersectionType||l.parent.type===V.AST_NODE_TYPES.TSUnionType&&l.parent.types[0]!==l)return!1;let f=[];for(let c of l.members){if(c.type!==V.AST_NODE_TYPES.TSPropertySignature)return!1;let g=c.typeAnnotation?.typeAnnotation;if(!g||g.type===V.AST_NODE_TYPES.TSTypeLiteral||!Dn(g))return!1;if(g.type===V.AST_NODE_TYPES.TSTypeReference&&g.typeArguments){if(g.typeArguments.params.length>1)return!1;let y=g.typeArguments.params[0];if(!y||!Dn(y))return!1}let T=o.getText(c).trim();(T.endsWith(";")||T.endsWith(","))&&(T=T.slice(0,-1)),f.push(T)}return{text:f.join("; "),isNested:d,propsSize:u}}}function p(l){if(l.loc.start.line===l.loc.end.line)return;if(l.parent.type!==V.AST_NODE_TYPES.JSXExpressionContainer){let g=0,T=!1,y=o.getTokenAfter(l,{filter:A=>A.type!==V.AST_TOKEN_TYPES.Punctuator||T?!0:A.value===","?(g++,!1):A.value===";"?(g++,T=!0,!1):A.value===")"||A.value==="}"?(g++,!1):!0});if(g>4)return;let C=y?.type===V.AST_TOKEN_TYPES.Template&&y.value.startsWith(`}
|
|
2
|
-
`);if(
|
|
3
|
-
`)||
|
|
4
|
-
`,o.range[1]);return(r!==-1?r:t.text.length)-o.range[1]}function Yr(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var ht={name:vn,rule:Wr};var Ge=require("@typescript-eslint/utils"),$e=require("zod/v4");var qr=$e.z.object({functions:$e.z.array($e.z.string().or($e.z.object({name:$e.z.string(),message:$e.z.string()})))});function Zr(e){if(e.type===Ge.AST_NODE_TYPES.Identifier)return e.name;if(e.type===Ge.AST_NODE_TYPES.MemberExpression&&e.property.type===Ge.AST_NODE_TYPES.Identifier&&e.object.type===Ge.AST_NODE_TYPES.Identifier)return`${e.object.name}.${e.property.name}`}var bt=v({name:"no-call-with-explicit-generics",meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)",noExplicitGenericsCustom:"{{ message }}"},schema:[k(qr)]},defaultOptions:[{functions:[]}],create(e,[t]){let o=new Map,r=new Map;for(let s of t.functions){let n=typeof s=="string"?s:s.name,a=typeof s=="string"?void 0:s.message;n.startsWith("*.")?r.set(n.slice(2),a):o.set(n,a)}function i(s){if(o.has(s))return{message:o.get(s)};let n=s.indexOf(".");if(n!==-1){let a=s.slice(n+1);if(r.has(a))return{message:r.get(a)}}}return{CallExpression(s){let n=Zr(s.callee);if(!n||!s.typeArguments)return;let a=i(n);a&&(a.message?e.report({node:s,messageId:"noExplicitGenericsCustom",data:{message:a.message}}):e.report({node:s,messageId:"noExplicitGenerics",data:{functionName:n}}))}}}});var Te=require("@typescript-eslint/utils"),Gr=Te.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),kn="no-call-with-inferred-generics",Hr=Gr({name:kn,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics",typeOfUsedInGenerics:"Function '{{ functionName }}' should not be called with 'typeof' in generics",unknownUsedInGenerics:"Function '{{ functionName }}' should not be called with 'unknown' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}},disallowTypeOf:{type:"boolean"},disallowUnknown:{type:"boolean"}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let o=new Map(t.functions.map(s=>[s.name,s])),r=t.functions.some(s=>s.disallowTypeOf),i=new Set;return{...r&&{TSTypeAliasDeclaration(s){s.typeAnnotation.type===Te.AST_NODE_TYPES.TSTypeQuery&&i.add(s.id.name)}},CallExpression(s){let{callee:n}=s;if(n.type!==Te.AST_NODE_TYPES.Identifier)return;let a=o.get(n.name);if(!a)return;let{minGenerics:p=1,allowAny:l,disallowTypes:d=t.disallowTypes,disallowTypeOf:m,disallowUnknown:u}=a;(s.typeArguments?.params.length||0)<(p||0)&&e.report({node:s,messageId:"missingGenericDeclaration",data:{functionName:n.name,minGenerics:p||0}}),!(l&&!d)&&(s.typeArguments?.params.some(c=>!l&&c.type===Te.AST_NODE_TYPES.TSAnyKeyword||d&&c.type===Te.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===Te.AST_NODE_TYPES.Identifier&&d.includes(c.typeName.name))&&e.report({node:s,messageId:"anyUsedInGenerics",data:{functionName:n.name}}),u&&s.typeArguments?.params.some(c=>c.type===Te.AST_NODE_TYPES.TSUnknownKeyword)&&e.report({node:s,messageId:"unknownUsedInGenerics",data:{functionName:n.name}}),m&&s.typeArguments?.params.some(c=>c.type===Te.AST_NODE_TYPES.TSTypeQuery||c.type===Te.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===Te.AST_NODE_TYPES.Identifier&&i.has(c.typeName.name))&&e.report({node:s,messageId:"typeOfUsedInGenerics",data:{functionName:n.name}}))}}}}),Ct={name:kn,rule:Hr};var Ln=require("@typescript-eslint/utils"),Kr=Ln.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_n="no-commented-out-code",Qr=["function ","class ","interface ","enum ","namespace ","import ","export ","const ","let ","var ","return ","throw ","try {","catch (","finally {","async ","await ","case ","switch (","while (","for (","default:"],eo=/^\s*return\s+/,to=/^\s*type\s+[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*\s*(?:=|<)/u,no=/^\s*(?:break|continue)(?:;|\s+[A-Za-z_$][\w$]*;?)?\s*$/,ro=/\w=("|'|`)/,oo=/\w+:\s*('|"|`)/,io=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,so=/\w+-\w+:/,ao=/\w+_\w+:/,po=/\?\s+\w/,lo=/:\s+\w/,co=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,uo=/^\s*\d+[,}]/,fo=/^\s*\[[^\]]*\][,}]/,mo=/^\s*\{[^}]*\}[,}]/,yo=/\.\w+\(/,go=/\[\w+\]/,So=/^\s*(['"`]).+?\1\s*:/,To=/^<[A-Z]\w*(\s|>|\/)/,Eo=/^<[a-z]+(\s|>|\/)/,xo=/<[A-Z]\w*(\s.*)?>/,ho=/<\/[A-Z]\w*>/,bo=/<[a-z]+(\s.*)?>/,Co=/<\/[a-z]+>/,Ao=/^\s*[*\s]*$/,Io=/^[a-zA-Z]/,Po=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,No=/^[a-z][A-Za-z0-9_/-]*:\s+[A-Za-z][\w'-]*(?:\s+[A-Za-z][\w'-]*){2,}/,Ro=/\s\([A-Za-z][\w\s,.'/-]*\)/g,wo=/```[\s\S]*?```/g,Fo=/`[^`]*`/g,jn=/[a-zA-Z0-9]/,Oo=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Do=/[{}[\]()`=<>]/,vo=/:\s*(['"`[{(]|\w+\s*=>)/,ko=/\bif\s*\(|\belse\b|=>/,re={returnStatement:eo,typeAliasDeclaration:to,stringAssignment:ro,objectPropertyWithQuotes:oo,computedPropertyAssignment:io,kebabCaseProperty:so,snakeCaseProperty:ao,ternaryOperator:po,colonWithWord:lo,quotedString:co,numberWithComma:uo,arrayWithComma:fo,objectWithComma:mo,methodCall:yo,arrayAccess:go,quotedPropertyKey:So,jsxSelfClosing:To,jsxElement:Eo,jsxOpeningTag:xo,jsxClosingTag:ho,htmlOpeningTag:bo,htmlClosingTag:Co,jsdocComment:Ao};function jo(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&Io.test(r)&&r.includes(" "))return!0}let t=e.trim();if(t.length===0||Oo.test(t))return!1;let o=t.includes("(")?t.replace(Ro,""):t;return Do.test(o)||vo.test(t)||ko.test(t)?!1:!!(t.includes(":")&&(Po.test(t)||No.test(t)))}var Mo=[") {","return;",re.returnStatement,re.typeAliasDeclaration,no,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",re.stringAssignment,");",re.objectPropertyWithQuotes,re.computedPropertyAssignment,re.kebabCaseProperty,re.snakeCaseProperty,"&&","||","()",re.ternaryOperator,re.colonWithWord,re.quotedString,re.numberWithComma,re.arrayWithComma,re.objectWithComma,re.methodCall,re.arrayAccess,"?.(","??","=>",re.quotedPropertyKey],Lo=["/>","</",re.jsxSelfClosing,re.jsxElement,re.jsxOpeningTag,re.jsxClosingTag,re.htmlOpeningTag,re.htmlClosingTag],Mn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint","cspell:","spell-checker:"],_o=Kr({name:_n,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(r,i){if(r.startsWith("/"))return!1;let s=r.trimStart();if(r.startsWith("*")||s.startsWith("eslint-disable")||r.includes("@deprecated")||r.includes("@example")||r.includes("@param")||r.includes("@returns")||r.includes("@throws")||r.includes("typescript-eslint")||r.includes("@ts-")||r.includes("prettier-ignore")||re.jsdocComment.test(r))return!1;for(let n of Mn)if(s.startsWith(n))return!1;if(r.includes("https://")||jo(s))return!1;if(i==="Block"){for(let n of Lo)if(typeof n=="string"){if(r.includes(n))return{wrongPattern:n}}else if(n.test(r))return{wrongPattern:`regex(${n.toString()})`};return!1}for(let n of Qr)if(s.startsWith(n))return{wrongPattern:n};for(let n of Mo)if(typeof n=="string"){if(r.includes(n))return{wrongPattern:n}}else if(n.test(r))return{wrongPattern:`regex(${n.toString()})`};return!1}function o(r,i){let s=r,n=s.trim();if(n.startsWith("`")&&(n.endsWith("`,")||n.endsWith("`;")||n.endsWith("`")))return s;if(i==="Block"&&s.includes("```")){let l=s.split(wo);l.some(m=>jn.test(m))&&(s=l.join(""))}if(!s.includes("`"))return s;let a=s.split(Fo);return a.some(l=>jn.test(l))?a.join(""):s}return{Program(){let i=e.sourceCode.getAllComments();for(let s of i){let n=o(s.value,s.type),a=t(n,s.type);a&&e.report({node:s,messageId:"commentedOutCode",data:{wrongPattern:a.wrongPattern,allowedPrefixes:Mn.join(", ")}})}}}}}),At={name:_n,rule:_o};var ot=require("@typescript-eslint/utils"),$o=ot.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),$n="no-default-export",zo=$o({name:$n,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let o of t.specifiers)o.exported.type===ot.TSESTree.AST_NODE_TYPES.Identifier&&o.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),It={name:$n,rule:zo};var zn=require("@typescript-eslint/utils"),Uo=zn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Un="no-leaked-text-in-jsx",Jo=[",",";","[","]","(",")"],Vo=Uo({name:Un,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let o=t.value.trim();if(!o)return;let r="";Jo.includes(o)?r=o:o.includes("&&")?r="&&":o.includes("||")?r="||":o.endsWith("? (")&&(r="? ("),r&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:r}})}}}}),Pt={name:Un,rule:Vo};var ve=require("@typescript-eslint/utils"),Xo=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Vn="no-non-camel-case-functions",Wo=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Jn(e){if(e.typeName.type!==ve.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:o}=e.typeName;return t.type===ve.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&o.name==="Element"}var Bo=Xo({name:Vn,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Wo.test(t.id.name)){let o=t.returnType?.typeAnnotation;if(o&&(o.type===ve.AST_NODE_TYPES.TSTypeReference?Jn(o):o.type===ve.AST_NODE_TYPES.TSUnionType&&o.types.some(i=>i.type===ve.AST_NODE_TYPES.TSTypeReference&&Jn(i))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),Nt={name:Vn,rule:Bo};var G=require("@typescript-eslint/utils");var Rt=require("@typescript-eslint/utils");function Ve(e,t,o=1/0){if(o!==0&&e.parent)return e.type===t?e:Ve(e.parent,t,o===1/0?o:o-1)}function*wt(e){yield e,e.parent&&(yield*wt(e.parent))}function Ft(e,t){for(let o of e){let r=t(o);if(r!=null&&r!==!1)return r}}function Wn(e,t,o){let i=o.getDeclaredVariables(e).find(s=>s.name===t||s.identifiers[0]?.parent.type===Rt.AST_NODE_TYPES.Property&&s.identifiers[0].parent.key.type===Rt.AST_NODE_TYPES.Identifier&&s.identifiers[0].parent.key.name===t);return i?i.references.filter(s=>!s.init):[]}function Xn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Yo(e,t){return e[t]}function Re(e,t,o){let r=o.visitorKeys,i=new Set;function s(n){if(i.has(n))return!1;if(i.add(n),t(n)===!0)return!0;let p=r[n.type];if(p)for(let l of p){let d=Yo(n,l);if(d){if(Array.isArray(d)){for(let m of d)if(Xn(m)&&s(m))return!0}else if(Xn(d)&&s(d))return!0}}return!1}s(e)}var qo=G.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Bn="no-optional-root-props",Zo=qo({name:Bn,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(r){let s=e.sourceCode.getDeclaredVariables(r)[0];if(!s||s.references.length!==1)return!1;let n=s.references[0];if(!n)return!1;for(let a of wt(n.identifier)){if("returnType"in a||a.type===G.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let p=a.parent;if(!p)return!1;if(p.type===G.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&p.parent.type===G.TSESTree.AST_NODE_TYPES.TSTypeReference&&p.parent.typeName.type===G.TSESTree.AST_NODE_TYPES.Identifier&&p.parent.typeName.name==="FC"){let d=Ve(p.parent.parent,G.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!d)return!1;let m=it(d,e.sourceCode);return m?!(m.parent.type===G.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===G.TSESTree.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(a.type===G.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(p.type===G.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let l=Ve(p,G.TSESTree.AST_NODE_TYPES.VariableDeclaration);return l?!!it(l,e.sourceCode):!1}if(p.type===G.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!it(p,e.sourceCode)}return!1}function o(r){r.key.type!==G.TSESTree.AST_NODE_TYPES.Identifier||!r.optional||e.report({node:r.key,messageId:"optionalNotAllowed",data:{propertyName:r.key.name},suggest:[{messageId:"suggestion",fix:i=>{let s=Ve(r,G.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!s)return null;let n=e.sourceCode.getText(s);return i.replaceText(s,n.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(r){if(r.typeAnnotation.type===G.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(st(r)||!t(r)))for(let i of r.typeAnnotation.members)i.type===G.TSESTree.AST_NODE_TYPES.TSPropertySignature&&o(i)},TSInterfaceDeclaration(r){if(!(st(r)||!t(r)))for(let i of r.body.body)i.type===G.TSESTree.AST_NODE_TYPES.TSPropertySignature&&o(i)},TSTypeReference(r){if(r.typeName.type!==G.TSESTree.AST_NODE_TYPES.Identifier||r.typeName.name!=="FC"||!r.typeArguments?.params[0])return;let i=r.typeArguments.params[0];if(i.type!==G.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let s=Ve(r.parent,G.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!s)return;let n=it(s,e.sourceCode);if(!(!n||n.parent.type===G.TSESTree.AST_NODE_TYPES.CallExpression&&n.parent.callee.type===G.TSESTree.AST_NODE_TYPES.Identifier&&n.parent.callee.name==="memo"))for(let p of i.members)p.type===G.TSESTree.AST_NODE_TYPES.TSPropertySignature&&o(p)}}}});function st(e){return e?e.parent?.type===G.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===G.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function it(e,t){if(st(e))return;let o;if(e.type===G.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===G.TSESTree.AST_NODE_TYPES.Identifier&&(o=e.declarations[0].id)}else{if(!e.id)return;o=e.id}if(!o)return;let r=t.getScope(e);e.type===G.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&r.upper&&(r=r.upper);let i=r.variables.find(n=>n.identifiers.includes(o));if(!i)return;let s=i.references.filter(n=>n.identifier!==o);if(!(s.length!==1||!s[0])&&!st(s[0].identifier.parent.parent))return s[0].identifier}var Ot={name:Bn,rule:Zo};var ke=require("@typescript-eslint/utils");var He=v({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let t=new Set;function o(i){return i?i.type===ke.AST_NODE_TYPES.Identifier?t.has(i.name):i.type===ke.AST_NODE_TYPES.MemberExpression?o(i.object):!1:!1}function r(i){return i.type!==ke.AST_NODE_TYPES.TSTypeReference||i.typeArguments?!1:i.typeName.type===ke.AST_NODE_TYPES.Identifier&&t.has(i.typeName.name)}return{ImportDeclaration(i){for(let s of i.specifiers)t.add(s.local.name)},ExportNamedDeclaration(i){if(i.source){e.report({node:i,messageId:"noReexport"});return}if(i.declaration?.type===ke.AST_NODE_TYPES.VariableDeclaration)for(let s of i.declaration.declarations)o(s.init)&&e.report({node:i,messageId:"noReexport"});i.declaration?.type===ke.AST_NODE_TYPES.TSTypeAliasDeclaration&&r(i.declaration.typeAnnotation)&&e.report({node:i,messageId:"noReexport"}),i.specifiers.length>0&&e.report({node:i,messageId:"noReexport"})},ExportDefaultDeclaration(i){i.declaration.type===ke.AST_NODE_TYPES.Identifier&&t.has(i.declaration.name)&&e.report({node:i,messageId:"noReexport"})},ExportAllDeclaration(i){e.report({node:i,messageId:"noReexport"})}}}});var Yn=require("@typescript-eslint/utils"),at=Oe(require("path")),we=require("zod/v4");var Go=Yn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),qn="no-relative-imports",Ho=we.z.object({find:we.z.string(),replacement:we.z.string()}),Ko=we.z.object({aliases:we.z.array(Ho),rootDir:we.z.string().optional(),allowNotFoundAliases:we.z.boolean().optional(),_dev_simulateFileName:we.z.string().optional()}),Qo=Go({name:qn,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[k(Ko)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let o=t._dev_simulateFileName??e.filename;function r(n){return n.startsWith(".")||n.startsWith("..")}function i(n,a){let p=at.default.dirname(a);return at.default.resolve(p,n)}function s(n){let a=t.rootDir??process.cwd(),p=at.default.relative(a,n);if(p.startsWith("."))return null;p.startsWith("/")||(p=`/${p}`);for(let{find:l,replacement:d}of t.aliases)if(p.startsWith(d)){let m=p.replace(d,l);return{alias:l,newPath:m}}return null}return{ImportDeclaration(n){let a=n.source.value;if(!r(a))return;let p=i(a,o),l=s(p);!l&&t.allowNotFoundAliases||e.report({node:n,messageId:l?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:l?.alias},fix:l?d=>d.replaceText(n.source,`'${l.newPath}'`):void 0})}}}}),Dt={name:qn,rule:Qo};var oe=require("@typescript-eslint/utils"),vt=require("zod/v4");var ei=vt.z.object({customMessage:vt.z.string().optional()}),kt=v({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[k(ei)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function o(r){switch(r.type){case oe.AST_NODE_TYPES.Literal:return!0;case oe.AST_NODE_TYPES.ObjectExpression:return r.properties.every(i=>i.type===oe.AST_NODE_TYPES.Property?i.computed||i.value.type===oe.AST_NODE_TYPES.Identifier&&i.key.type===oe.AST_NODE_TYPES.Identifier&&i.key.name===i.value.name?!1:o(i.value):!1);case oe.AST_NODE_TYPES.ArrayExpression:return r.elements.every(i=>i?i.type===oe.AST_NODE_TYPES.SpreadElement?!1:o(i):!0);case oe.AST_NODE_TYPES.TemplateLiteral:return r.expressions.length===0;case oe.AST_NODE_TYPES.ConditionalExpression:case oe.AST_NODE_TYPES.LogicalExpression:case oe.AST_NODE_TYPES.BinaryExpression:case oe.AST_NODE_TYPES.UnaryExpression:case oe.AST_NODE_TYPES.CallExpression:case oe.AST_NODE_TYPES.MemberExpression:case oe.AST_NODE_TYPES.Identifier:case oe.AST_NODE_TYPES.ArrowFunctionExpression:case oe.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(r){if(r.name.type===oe.AST_NODE_TYPES.JSXIdentifier&&r.name.name==="style"&&r.value){let i=null;r.value.type===oe.AST_NODE_TYPES.JSXExpressionContainer?r.value.expression.type!==oe.AST_NODE_TYPES.JSXEmptyExpression&&(i=r.value.expression):r.value.type===oe.AST_NODE_TYPES.Literal&&(i=r.value),i&&o(i)&&e.report({node:r,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var Ke=require("@typescript-eslint/utils"),ze=Oe(require("zod/v4"));var ti=ze.object({alternativeMsgs:ze.object({inArrayFind:ze.string().optional(),inArrayFilter:ze.string().optional()}).optional(),__dev_simulateFileName:ze.string().optional()});function ni(e){return e.typeAnnotation.type!==Ke.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var ri=/(typeGuards|type-guards)\.(ts|tsx)$/;function oi(e){return ri.test(e)}function ii(e){let t=e.parent;for(;t;){if(t.type===Ke.AST_NODE_TYPES.CallExpression&&t.callee.type===Ke.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===Ke.AST_NODE_TYPES.Identifier){let o=t.callee.property.name;if(o==="filter"||o==="find")return{method:o}}t=t.parent}return null}var jt=v({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[k(ti)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let o=t.__dev_simulateFileName??e.filename;if(oi(o))return{};function r(i){if(!ni(i))return;let s=ii(i);if(t.alternativeMsgs&&s){let n=s.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(n){let a=s.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:i,messageId:a,data:{message:n}});return}}e.report({node:i,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":r,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":r,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":r}}});var Ue=require("@typescript-eslint/utils");var si="no-unnecessary-async-on-jsx-props";function ai(e){if(e.body.type!==Ue.AST_NODE_TYPES.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let o=t[0];return!o||o.type!==Ue.AST_NODE_TYPES.ExpressionStatement?!1:o.expression.type===Ue.AST_NODE_TYPES.AwaitExpression}var Mt=v({name:si,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(o){ai(o)&&e.report({node:o,messageId:"unnecessaryAsyncInJsxProp",fix(r){let i=e.sourceCode,s=[],n=i.getFirstToken(o,p=>p.value==="async");if(n){let p=i.getTokenAfter(n);p?s.push(r.replaceTextRange([n.range[0],p.range[0]],"")):s.push(r.remove(n))}function a(p){if(p.type===Ue.AST_NODE_TYPES.AwaitExpression){let l=i.getFirstToken(p);if(l&&l.value==="await"){let d=i.getTokenAfter(l);d?s.push(r.replaceTextRange([l.range[0],d.range[0]],"")):s.push(r.remove(l))}}if(p.type===Ue.AST_NODE_TYPES.BlockStatement)for(let l of p.body)a(l);else p.type===Ue.AST_NODE_TYPES.ExpressionStatement&&a(p.expression)}return a(o.body),s}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var ye=require("@typescript-eslint/utils"),pt=Oe(require("zod/v4"));var pi=pt.object({ignoreWithDescription:pt.string().optional()}),Lt=v({name:"no-unnecessary-describe",meta:{type:"suggestion",docs:{description:"Disallow unnecessary describe blocks that wrap all tests in a file"},messages:{unnecessaryDescribe:"Describe blocks that solely wrap all tests in the file are unnecessary, they just add unnecessary nesting to the code. The file itself should be enough to group tests. Remove it.",removeDescribe:"Remove the describe block"},hasSuggestions:!0,schema:[k(pi)]},defaultOptions:[{}],create(e,[t]){let o=e.getSourceCode(),r=o.ast;function i(p){let l=p.arguments[0];return l&&l.type===ye.AST_NODE_TYPES.Literal&&typeof l.value=="string"?l.value:null}function s(p){return!p||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(p)}function n(p){return p.length!==1?!1:r.body.filter(d=>{if(d.type===ye.AST_NODE_TYPES.ExpressionStatement){let m=d.expression;if(m.type===ye.AST_NODE_TYPES.CallExpression&&m.callee.type===ye.AST_NODE_TYPES.Identifier){let u=m.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(u)}}return!1}).length===0}function a(p){let l=p.arguments[1];if(l&&(l.type===ye.AST_NODE_TYPES.FunctionExpression||l.type===ye.AST_NODE_TYPES.ArrowFunctionExpression)&&l.body.type===ye.AST_NODE_TYPES.BlockStatement){let d=l.body.body;return d.length===0?"":d.map(u=>o.text.slice(u.range[0],u.range[1])).join(`
|
|
5
|
-
|
|
6
|
-
`)}return""}return{Program(){let p=[];for(let u of r.body)u.type===ye.AST_NODE_TYPES.ExpressionStatement&&u.expression.type===ye.AST_NODE_TYPES.CallExpression&&u.expression.callee.type===ye.AST_NODE_TYPES.Identifier&&u.expression.callee.name==="describe"&&u.expression.arguments.length===2&&p.push(u.expression);if(!n(p))return;let[l]=p;if(!l)return;let d=i(l);if(s(d))return;let m=r.body.find(u=>u.type===ye.AST_NODE_TYPES.ExpressionStatement&&u.expression===l);!m||m.type!==ye.AST_NODE_TYPES.ExpressionStatement||e.report({node:l,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(u){let f=a(l);return f?u.replaceText(m,f):null}}]})}}}});var Qe=require("@typescript-eslint/utils"),Ce=Oe(require("zod/v4"));var li=Ce.object({methods:Ce.union([Ce.array(Ce.string()),Ce.literal("array")])}),_t=v({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[k(li)]},defaultOptions:[{methods:"array"}],create(e,[t]){let o=t.methods,r=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function i(a){return Array.isArray(o)?o.includes(a):r.has(a)}function s(a){let{callee:p}=a;if(p.type===Qe.AST_NODE_TYPES.MemberExpression){let l=p.property;if(l.type===Qe.AST_NODE_TYPES.Identifier)return l.name}return null}function n(a,p){if(a.type!==Qe.AST_NODE_TYPES.Identifier||!a.typeAnnotation)return;let l=p.parent;if(l.type===Qe.AST_NODE_TYPES.CallExpression){let d=s(l);d&&i(d)&&l.arguments.indexOf(p)===0&&e.report({node:a.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(u){return a.typeAnnotation?u.remove(a.typeAnnotation):null}})}}return{ArrowFunctionExpression(a){for(let p of a.params)n(p,a)},FunctionExpression(a){for(let p of a.params)n(p,a)}}}});var me=require("@typescript-eslint/utils");var $t=v({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===me.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==me.AST_NODE_TYPES.ObjectExpression||t.id.type===me.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===me.AST_NODE_TYPES.ExportNamedDeclaration)return;let o=new Map;for(let n of t.init.properties)n.type===me.AST_NODE_TYPES.Property&&n.key.type===me.AST_NODE_TYPES.Identifier&&o.set(n.key.name,n);if(o.size===0||t.id.type!==me.AST_NODE_TYPES.Identifier)return;let r=ci(t,e.sourceCode);if(r.length===0)return;let i=t.init.properties.some(n=>n.type!==me.AST_NODE_TYPES.Property?!1:n.value.type===me.AST_NODE_TYPES.FunctionExpression),s=new Set;for(let n of r){if(n.identifier.parent.type!==me.AST_NODE_TYPES.MemberExpression)return;let a=n.identifier.parent;if(a.object!==n.identifier)return;if(a.computed)if(a.property.type===me.AST_NODE_TYPES.Literal&&typeof a.property.value=="string")s.add(a.property.value);else return;else{if(a.property.type!==me.AST_NODE_TYPES.Identifier)return;s.add(a.property.name)}if(a.parent.type===me.AST_NODE_TYPES.CallExpression&&i)return}for(let[n,a]of o)s.has(n)||e.report({node:a,messageId:"unusedObjectProperty",data:{name:n}})}}}});function ci(e,t){let o=t.getDeclaredVariables(e);if(o.length!==1)return[];let r=o[0];return r?r.references.filter(i=>i.identifier!==e.id):[]}var $=require("@typescript-eslint/utils"),zt=require("zod/v4");var ui=zt.z.object({ignoreArgsMatching:zt.z.string().optional()}),Ut=v({name:"no-unused-optional-args",meta:{type:"problem",docs:{description:"Detect unused optional function arguments in non-exported functions"},messages:{unusedOptionalArg:"Optional parameter '{{name}}' is never used",unusedOptionalProp:"Optional prop '{{name}}' is never provided"},schema:[k(ui)]},defaultOptions:[{}],create(e,[t]){let o=[];function r(n){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(n):!1}function i(n){return n.type===$.AST_NODE_TYPES.ExportNamedDeclaration||n.type===$.AST_NODE_TYPES.ExportDefaultDeclaration||n.parent?.type===$.AST_NODE_TYPES.ExportNamedDeclaration||n.parent?.type===$.AST_NODE_TYPES.ExportDefaultDeclaration}function s(n){let a=[];for(let p=0;p<n.length;p++){let l=n[p];if(!l||l.type!==$.AST_NODE_TYPES.Identifier)continue;let d=l.name;if(!r(d)){if(l.optional&&l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===$.AST_NODE_TYPES.TSTypeLiteral){let m=l.typeAnnotation.typeAnnotation,u=[];for(let f of m.members)f.type===$.AST_NODE_TYPES.TSPropertySignature&&f.key.type===$.AST_NODE_TYPES.Identifier&&u.push({name:f.key.name,optional:f.optional===!0});u.some(f=>f.optional)?a.push({param:l,index:p,name:d,isObjectParam:!0,objectProps:u}):a.push({param:l,index:p,name:d,isObjectParam:!1})}else if(l.optional)a.push({param:l,index:p,name:d,isObjectParam:!1});else if(l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===$.AST_NODE_TYPES.TSTypeLiteral){let m=l.typeAnnotation.typeAnnotation,u=[];for(let f of m.members)f.type===$.AST_NODE_TYPES.TSPropertySignature&&f.key.type===$.AST_NODE_TYPES.Identifier&&u.push({name:f.key.name,optional:f.optional===!0});u.some(f=>f.optional)&&a.push({param:l,index:p,name:d,isObjectParam:!0,objectProps:u})}}}return a}return{FunctionDeclaration(n){if(i(n))return;let a=s(n.params);a.length!==0&&o.push({node:n,declarationNode:n,optionalParams:a})},VariableDeclarator(n){if(n.id.type!==$.AST_NODE_TYPES.Identifier||!n.init||n.init.type!==$.AST_NODE_TYPES.ArrowFunctionExpression&&n.init.type!==$.AST_NODE_TYPES.FunctionExpression||i(n.parent.parent))return;let p=[...s(n.init.params)];if(n.id.typeAnnotation&&n.id.typeAnnotation.typeAnnotation.type===$.AST_NODE_TYPES.TSTypeReference){let l=n.id.typeAnnotation.typeAnnotation;if(l.typeName.type===$.AST_NODE_TYPES.Identifier&&l.typeName.name==="FC"){let d=l.typeArguments;if(d&&d.params.length===1){let m=d.params[0];if(m&&m.type===$.AST_NODE_TYPES.TSTypeLiteral){let u=[];for(let f of m.members)f.type===$.AST_NODE_TYPES.TSPropertySignature&&f.key.type===$.AST_NODE_TYPES.Identifier&&u.push({name:f.key.name,optional:f.optional===!0});u.some(f=>f.optional)&&p.push({param:n.id,index:0,name:"props",isObjectParam:!0,objectProps:u})}}}}p.length!==0&&o.push({node:n.init,declarationNode:n,optionalParams:p})},"Program:exit"(){for(let n of o){let p=e.sourceCode.getDeclaredVariables(n.declarationNode)[0];if(!p)continue;let l=p.references.filter(u=>u.identifier!==p.identifiers[0]);if(l.length===0)continue;let d=!1;for(let u of l){let f=u.identifier.parent;if(f.type===$.AST_NODE_TYPES.CallExpression&&u.identifier.type===$.AST_NODE_TYPES.Identifier&&f.arguments.includes(u.identifier)){d=!0;break}if(f.type===$.AST_NODE_TYPES.ReturnStatement){d=!0;break}if(f.type===$.AST_NODE_TYPES.Property&&f.parent.type===$.AST_NODE_TYPES.ObjectExpression&&f.parent.parent.type===$.AST_NODE_TYPES.ReturnStatement){d=!0;break}if(f.type===$.AST_NODE_TYPES.JSXExpressionContainer){d=!0;break}}if(d)continue;let m=[];for(let u of l){let f=u.identifier.parent;if(f.type===$.AST_NODE_TYPES.CallExpression&&f.callee===u.identifier){let c=f.arguments.length,g=f.arguments.some(y=>y.type===$.AST_NODE_TYPES.SpreadElement);if(g){d=!0;break}let T={argCount:c,hasSpread:g};for(let y of n.optionalParams)if(y.isObjectParam&&y.index<c){let C=f.arguments[y.index];if(C?.type===$.AST_NODE_TYPES.ObjectExpression){let A={};for(let S of C.properties)S.type===$.AST_NODE_TYPES.Property&&S.key.type===$.AST_NODE_TYPES.Identifier&&(A[S.key.name]=!0);T.objectArgs||(T.objectArgs=[]),T.objectArgs[y.index]=A}else if(C){d=!0;break}}m.push(T)}else if(f.type===$.AST_NODE_TYPES.JSXOpeningElement&&f.name===u.identifier){let c=f.attributes.some(T=>T.type===$.AST_NODE_TYPES.JSXSpreadAttribute);if(c){d=!0;break}let g={argCount:1,hasSpread:c};for(let T of n.optionalParams)if(T.isObjectParam&&T.index===0){let y={};for(let C of f.attributes)C.type===$.AST_NODE_TYPES.JSXAttribute&&C.name.type===$.AST_NODE_TYPES.JSXIdentifier&&(y[C.name.name]=!0);g.objectArgs||(g.objectArgs=[]),g.objectArgs[0]=y}m.push(g)}}if(!(d||m.length===0))for(let u of n.optionalParams)if(u.isObjectParam&&u.objectProps)for(let f of u.objectProps){if(!f.optional)continue;let c=!1;for(let g of m)if(g.objectArgs&&g.objectArgs[u.index]){let T=g.objectArgs[u.index];if(T&&T[f.name]){c=!0;break}}c||e.report({node:u.param,messageId:"unusedOptionalProp",data:{name:f.name}})}else{let f=!1;for(let c of m)if(c.argCount>u.index){f=!0;break}f||e.report({node:u.param,messageId:"unusedOptionalArg",data:{name:u.name}})}}}}}});var H=require("@typescript-eslint/utils"),je=require("zod/v4");var fi=je.z.object({selectors:je.z.array(je.z.object({name:je.z.string(),selectorProp:je.z.string().optional(),selectorArgPos:je.z.number().optional(),returnProp:je.z.string().optional()}))}),mi=H.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Zn="no-unused-selected-values",Jt={name:Zn,rule:mi({name:Zn,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[k(fi)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:o=[]}=t,r=new Map(o.map(i=>[i.name,i]));return{VariableDeclarator(i){let s=null;if(i.init?.type===H.AST_NODE_TYPES.CallExpression&&(s=i.init),!s)return;let n=yi(s);if(!n)return;let a=r.get(n);if(!a)return;let p=di(s,a.selectorArgPos??0,a.selectorProp);if(!p)return;let l=gi(p);if(!l)return;let d=Gn(l.properties,void 0);if(!d)return;if(i.id.type===H.AST_NODE_TYPES.ObjectPattern){let f=Gn(i.id.properties,a.returnProp);if(!f)return;for(let[c,g]of d)f.has(c)||e.report({node:g,messageId:"unusedSelectedValue",data:{name:c}});return}if(i.id.type!==H.AST_NODE_TYPES.Identifier||a.returnProp)return;let m=Si(i,e.sourceCode);if(m.length===0)return;let u=new Set;for(let f of m){if(f.identifier.parent.type!==H.AST_NODE_TYPES.MemberExpression)return;let c=f.identifier.parent.property;if(c.type!==H.AST_NODE_TYPES.Identifier)return;u.add(c.name)}for(let[f,c]of d)u.has(f)||e.report({node:c,messageId:"unusedSelectedValue",data:{name:f}})}}}})};function di(e,t,o){let r=e.arguments[t];if(!r)return null;if(r.type===H.AST_NODE_TYPES.ArrowFunctionExpression||r.type===H.AST_NODE_TYPES.FunctionExpression)return r;if(o&&r.type===H.AST_NODE_TYPES.ObjectExpression){let i=r.properties.find(n=>n.type===H.AST_NODE_TYPES.Property&&n.key.type===H.AST_NODE_TYPES.Identifier&&n.key.name===o);if(i?.type!==H.AST_NODE_TYPES.Property)return null;let s=i.value;if(s.type===H.AST_NODE_TYPES.ArrowFunctionExpression||s.type===H.AST_NODE_TYPES.FunctionExpression)return s}return null}function yi(e){return e.callee.type===H.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===H.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===H.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function gi(e){if(e.body.type===H.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===H.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(o=>o.type===H.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==H.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function Gn(e,t){let o=e;if(t){let i=e.find(s=>s.type===H.AST_NODE_TYPES.Property&&s.key.type===H.AST_NODE_TYPES.Identifier&&s.key.name===t);if(i?.type!==H.AST_NODE_TYPES.Property||i.value.type!==H.AST_NODE_TYPES.ObjectPattern)return null;o=i.value.properties}let r=new Map;for(let i of o){if(i.type!==H.AST_NODE_TYPES.Property||i.key.type!==H.AST_NODE_TYPES.Identifier)return null;r.set(i.key.name,i)}return r.size>0?r:null}function Si(e,t){let o=t.getDeclaredVariables(e);if(o.length!==1)return[];let r=o[0];return r?r.references.filter(i=>i.identifier!==e.id):[]}var K=require("@typescript-eslint/utils");var Vt=v({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(s=>s.type===K.AST_NODE_TYPES.ImportDeclaration&&s.source.value==="t-state-form"))return{};let r=null,i=!1;return{CallExpression(s){if(i)return;if(!r){let a=Ti(s);a&&(r=a);return}let n=Ei(s,e.sourceCode);if(n){i=!0;for(let a of n)r.delete(a);if(r.size!==0)for(let[a,p]of r)e.report({node:p,messageId:"unusedField",data:{name:a}})}}}}});function Ti(e){if(!(e.callee.type===K.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let o=e.arguments[0];if(!o||o.type!==K.AST_NODE_TYPES.ObjectExpression)return null;let r=Ft(o.properties,s=>s.type!==K.AST_NODE_TYPES.Property||s.key.type!==K.AST_NODE_TYPES.Identifier||s.key.name!=="initialConfig"?null:s.value.type===K.AST_NODE_TYPES.ObjectExpression?s.value:s.value.type===K.AST_NODE_TYPES.ArrowFunctionExpression||s.value.type===K.AST_NODE_TYPES.FunctionExpression?xi(s.value):null);if(!r)return null;let i=new Map;for(let s of r.properties)s.type===K.AST_NODE_TYPES.Property&&s.key.type===K.AST_NODE_TYPES.Identifier&&i.set(s.key.name,s);return i}function Ei(e,t){if(!(e.callee.type===K.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==K.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==K.AST_NODE_TYPES.ObjectPattern||!Ft(e.parent.id.properties,n=>n.type===K.AST_NODE_TYPES.Property&&n.key.type===K.AST_NODE_TYPES.Identifier&&n.key.name==="formFields"&&n))return null;let i=Wn(e.parent,"formFields",t),s=new Set;for(let{identifier:n}of i){if(n.type!==K.AST_NODE_TYPES.Identifier||n.parent.type===K.AST_NODE_TYPES.Property&&n.parent.parent.type===K.AST_NODE_TYPES.ObjectExpression&&n.parent.parent.parent.type===K.AST_NODE_TYPES.ReturnStatement||n.parent.type===K.AST_NODE_TYPES.ReturnStatement)return null;if(n.parent.type===K.AST_NODE_TYPES.MemberExpression){if(n.parent.object.type!==K.AST_NODE_TYPES.Identifier||n.parent.property.type!==K.AST_NODE_TYPES.Identifier)return null;s.add(n.parent.property.name)}}return s}function xi(e){if(e.body.type===K.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===K.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(o=>o.type===K.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==K.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var W=require("@typescript-eslint/utils"),et=require("zod/v4");var hi=W.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Hn(e){let t=[];for(let o of e.members)o.type===W.AST_NODE_TYPES.TSPropertySignature&&o.key.type===W.AST_NODE_TYPES.Identifier&&t.push([o.key.name,o]);return t}function Kn(e,...t){for(let o of t)e.set(...o);return e}var bi=et.z.object({forceCheckOnFCPropTypesWithName:et.z.array(et.z.string()).optional(),alwaysCheckFunctionOptionTypes:et.z.boolean().optional()}),Qn="no-unused-type-props-in-args",Xt=null,Ci=hi({name:Qn,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[k(bi)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:o,alwaysCheckFunctionOptionTypes:r=!0}=t;o&&!Xt&&(Xt=o.map(p=>new RegExp(p)));function i(p,l,d,m,u=!0,f=!1){let c=d.name,g=e.sourceCode.getScope(l).references.find(S=>S.identifier.name===c)?.resolved,T=p&&Xt?.some(S=>S.test(c)),y=f&&r;if(!g||!T&&g.references.filter(S=>S.isTypeReference).length>1||!g.defs[0])return;let C=g.defs[0].node,A=C.parent?.type===W.AST_NODE_TYPES.ExportNamedDeclaration;if(!(u&&A&&!y)){if(C.type===W.AST_NODE_TYPES.TSTypeAliasDeclaration){s(p,l,m,C.typeAnnotation,!0,f);return}if(C.type===W.AST_NODE_TYPES.TSInterfaceDeclaration){s(p,l,m,C.body,!0,f);return}}}function s(p,l,d,m,u,f=!1){if(m.type===W.AST_NODE_TYPES.TSInterfaceBody){for(let c of m.body)c.type===W.AST_NODE_TYPES.TSPropertySignature&&c.key.type===W.AST_NODE_TYPES.Identifier&&d.set(c.key.name,c);return}if(m.type===W.AST_NODE_TYPES.TSTypeLiteral){Kn(d,...Hn(m));return}if(m.type===W.AST_NODE_TYPES.TSIntersectionType){for(let c of m.types)s(p,l,d,c,!0,f);return}u||m.type===W.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===W.AST_NODE_TYPES.Identifier&&i(p,l,m.typeName,d,!0,f)}function n(p,l,d,m=!1){for(let u of d)if(u.type===W.AST_NODE_TYPES.ObjectPattern&&u.typeAnnotation){let f=new Map;if(s(p,l,f,u.typeAnnotation.typeAnnotation,!1,m),f.size===0)continue;a(u,f)}else u.type===W.AST_NODE_TYPES.AssignmentPattern&&u.left.type===W.AST_NODE_TYPES.ObjectPattern&&n(p,l,[u.left],m)}function a(p,l){let d=[];if(p.properties.at(-1)?.type===W.AST_NODE_TYPES.RestElement)return;for(let c of p.properties)c.type===W.AST_NODE_TYPES.Property&&c.key.type===W.AST_NODE_TYPES.Identifier&&d.push(c.key.name);let u=[],f=[];for(let[c,g]of l)d.includes(c)||(f.push(c),u.push({node:g,messageId:"unusedObjectTypeProperty",data:{propertyName:c}}));for(let[c,g]of u.entries())e.report({...g,fix:c===u.length-1?T=>{let y=p.properties.at(-1),C=f.join(", ");return y?y.type===W.AST_NODE_TYPES.RestElement?null:T.insertTextAfter(y,`, ${C}`):T.insertTextBeforeRange([p.range[0]+1,p.range[1]],C)}:void 0})}return{VariableDeclaration(p){let l=p.declarations[0],d=new Map,m=l.id.type===W.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===W.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===W.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===W.AST_NODE_TYPES.Identifier)i(!0,p,m.typeName,d,!1);else if(m.type===W.AST_NODE_TYPES.TSTypeLiteral)Kn(d,...Hn(m));else if(m.type===W.AST_NODE_TYPES.TSIntersectionType)for(let u of m.types)u.type===W.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===W.AST_NODE_TYPES.Identifier?i(!0,p,u.typeName,d,!1):s(!0,p,d,u,!0);if(d.size!==0&&l.init?.type===W.AST_NODE_TYPES.ArrowFunctionExpression){let u=l.init.params[0];if(!u){e.report({node:l.init,messageId:"missingComponentParam"});return}u.type===W.AST_NODE_TYPES.ObjectPattern&&a(u,d)}}},FunctionDeclaration(p){n(!1,p,p.params,r)},ArrowFunctionExpression(p){n(!1,p,p.params,r)}}}}),Wt={name:Qn,rule:Ci};var Ee=require("@typescript-eslint/utils");var Bt=v({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let t=new Set;function o(r){return r.callee.type===Ee.AST_NODE_TYPES.Identifier?t.has(r.callee.name):r.callee.type===Ee.AST_NODE_TYPES.MemberExpression&&r.callee.object.type===Ee.AST_NODE_TYPES.Identifier&&r.callee.property.type===Ee.AST_NODE_TYPES.Identifier?r.callee.property.name==="useRef":!1}return{ImportDeclaration(r){if(r.source.value==="react")for(let i of r.specifiers)i.type===Ee.AST_NODE_TYPES.ImportSpecifier&&i.imported.type===Ee.AST_NODE_TYPES.Identifier&&i.imported.name==="useRef"&&t.add(i.local.name)},VariableDeclarator(r){if(r.init&&r.init.type===Ee.AST_NODE_TYPES.CallExpression&&o(r.init)&&r.id.type===Ee.AST_NODE_TYPES.Identifier){let s=e.sourceCode.getScope(r).set.get(r.id.name);if(s){let n=!1;for(let a of s.references){let l=a.identifier.parent;if(l!==r&&!(l.type===Ee.AST_NODE_TYPES.JSXExpressionContainer&&l.parent.type===Ee.AST_NODE_TYPES.JSXAttribute&&l.parent.name.type===Ee.AST_NODE_TYPES.JSXIdentifier&&l.parent.name.name==="ref")){n=!0;break}}n||e.report({node:r.id,messageId:"refNotRead",data:{name:r.id.name}})}}}}}});var Xe=require("@typescript-eslint/utils"),Ai=Xe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),tr="prefer-named-functions",er=new Map,Ii=Ai({name:tr,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let o=null;if(t.ignoreRegex){let r=er.get(t.ignoreRegex);r?o=r:(o=new RegExp(t.ignoreRegex),er.set(t.ignoreRegex,o))}return{VariableDeclarator(r){if(r.init&&r.init.type===Xe.AST_NODE_TYPES.ArrowFunctionExpression&&r.id.type===Xe.AST_NODE_TYPES.Identifier){let i=r.id.name;if(r.id.typeAnnotation||o&&o.test(i)||!t.disallowArrowFnWithImplicitReturns&&r.init.body.type!==Xe.AST_NODE_TYPES.BlockStatement)return;let s=r.parent,n=r.init.params,a=r.init.body,p=r.init;e.report({node:r.id,messageId:o?"withIgnoreRegex":"default",data:{functionName:i,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:l=>l.replaceText(s,`${p.async?"async ":""}function ${i}(${n.map(d=>e.sourceCode.getText(d)).join(", ")||""}) ${e.sourceCode.getText(a)}`)}]})}}}}}),Yt={name:tr,rule:Ii};var _=require("@typescript-eslint/utils"),Ae=require("zod/v4");var Pi=Ae.z.object({disallowedFunctions:Ae.z.array(Ae.z.object({name:Ae.z.string(),allowUsingWithArgs:Ae.z.boolean().optional(),hookAlternative:Ae.z.string().optional(),message:Ae.z.string().optional(),allowUseInside:Ae.z.array(Ae.z.string()).optional()}))}),Ni=/^use[A-Z]/,Ri=/^[A-Z]/;function lt(e){return Ni.test(e)}function nr(e){return Ri.test(e)}function wi(e){return e.type===_.AST_NODE_TYPES.Identifier?lt(e.name):e.type===_.AST_NODE_TYPES.MemberExpression&&e.property.type===_.AST_NODE_TYPES.Identifier?lt(e.property.name):!1}function rr(e,t){return e.type===_.AST_NODE_TYPES.Identifier?e.name===t:e.type===_.AST_NODE_TYPES.MemberExpression&&e.object.type===_.AST_NODE_TYPES.Identifier&&e.property.type===_.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function or(e){return!!(e.parent&&e.parent.type===_.AST_NODE_TYPES.CallExpression&&rr(e.parent.callee,"forwardRef"))}function ir(e){return!!(e.parent&&e.parent.type===_.AST_NODE_TYPES.CallExpression&&rr(e.parent.callee,"memo"))}function qt(e){if(e.type===_.AST_NODE_TYPES.FunctionDeclaration||e.type===_.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===_.AST_NODE_TYPES.FunctionExpression||e.type===_.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===_.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===_.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===_.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===_.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Fi(e){let t=e.parent,o=!1;for(;t;){if(t.type===_.AST_NODE_TYPES.FunctionDeclaration||t.type===_.AST_NODE_TYPES.FunctionExpression||t.type===_.AST_NODE_TYPES.ArrowFunctionExpression){let r=qt(t);if(r&&r.type===_.AST_NODE_TYPES.Identifier){if(nr(r.name)||lt(r.name))return!o;o=!0}else{if(or(t)||ir(t))return!o;if(t.parent.type===_.AST_NODE_TYPES.CallExpression){let i=t.parent;wi(i.callee)||(o=!0)}else t.parent.type===_.AST_NODE_TYPES.JSXExpressionContainer||(o=!0)}}t=t.parent}return!1}function sr(e){return e.callee.type===_.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===_.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===_.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Oi(e,t){if(!t.length)return!1;let o=e.parent;for(;o;){if(o.type===_.AST_NODE_TYPES.FunctionDeclaration||o.type===_.AST_NODE_TYPES.FunctionExpression||o.type===_.AST_NODE_TYPES.ArrowFunctionExpression){let r=qt(o);if(r&&r.type===_.AST_NODE_TYPES.Identifier&&t.includes(r.name))return!0}else if(o.type===_.AST_NODE_TYPES.CallExpression){let r=sr(o);if(r&&t.includes(r))return!0}o=o.parent}return!1}function Di(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===_.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function vi(e,t){let o=!1,r=e.parent;for(;r;){if(r.type===_.AST_NODE_TYPES.FunctionDeclaration||r.type===_.AST_NODE_TYPES.FunctionExpression||r.type===_.AST_NODE_TYPES.ArrowFunctionExpression){let i=qt(r);if(i&&i.type===_.AST_NODE_TYPES.Identifier){if(nr(i.name)||lt(i.name)){o=!0;break}}else if(or(r)||ir(r)){o=!0;break}}r=r.parent}return o?t.length===0?Fi(e):!Oi(e,t):!1}var Zt=v({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[k(Pi)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:o}=t,r=new Map(o.map(i=>[i.name,i]));return{CallExpression(i){let s=sr(i);if(!s)return;let n=r.get(s);if(!n||n.allowUsingWithArgs&&Di(i))return;let a=n.allowUseInside||[];vi(i,a)&&e.report({node:i,messageId:"preferHookAlternative",data:{message:n.message?` ${n.message}`:` use ${n.hookAlternative} instead`},suggest:n.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${n.hookAlternative}`,hookAlternative:n.hookAlternative},fix:p=>{let l=n.hookAlternative;return l?i.callee.type===_.AST_NODE_TYPES.Identifier?p.replaceText(i.callee,l):i.callee.type===_.AST_NODE_TYPES.MemberExpression&&i.callee.property.type===_.AST_NODE_TYPES.Identifier?p.replaceText(i.callee.property,l):null:null}}]:[]})}}}});var ee=require("@typescript-eslint/utils"),ct=Oe(require("zod/v4"));var ki=ee.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="prefer-single-line-if",ji=ct.default.object({maxLineLength:ct.default.number().optional(),maxNonSimpleConditionLength:ct.default.number().optional()}),Mi=ki({name:pr,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[k(ji)]},defaultOptions:[{}],create(e,[t]){let o=e.sourceCode;return{IfStatement(r){if(r.consequent.type!==ee.AST_NODE_TYPES.BlockStatement||r.loc.start.line===r.loc.end.line||o.getCommentsInside(r.consequent).length>0||r.alternate||r.consequent.body.length!==1)return;let s=r.consequent.body[0];if(!s)return;if(s.type===ee.AST_NODE_TYPES.ReturnStatement){if(!cr(s))return}else if(!(s.type===ee.AST_NODE_TYPES.ContinueStatement||s.type===ee.AST_NODE_TYPES.BreakStatement))return;if(r.test.type===ee.AST_NODE_TYPES.LogicalExpression||r.test.type===ee.AST_NODE_TYPES.ConditionalExpression)return;let n;if(t.maxNonSimpleConditionLength){let m=ar(r.test);if(!m&&r.test.type===ee.AST_NODE_TYPES.UnaryExpression&&r.test.operator==="!"){let u=r.test.argument;ar(u)&&(m=!0)}if(m&&(n=o.getText(r.test),n.length>t.maxNonSimpleConditionLength))return}n||(n=o.getText(r.test));let a=o.getText(s);if(n.includes(`
|
|
7
|
-
`)
|
|
8
|
-
"
|
|
9
|
-
`)}return null}}]})}}}},FunctionDeclaration(n){if(n.id&&tt(n)&&!dr(n.id.name)){e.report({node:n,messageId:"useMemoDirectiveNaming"});return}if(Ht(n,e.sourceCode)){if(We(n))return;e.report({node:n,messageId:"functionCallingHooksMustBeComponent"});return}if(Qt(n,void 0,void 0,e.sourceCode)){let a=fr(n,e.sourceCode),p=tt(n);if(!a&&!p){if(We(n))return;e.report({node:n,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(l){let d=n.body.range[0]+1;return l.insertTextAfterRange([d,d],`
|
|
10
|
-
"use memo"
|
|
11
|
-
`)}}]})}}},FunctionExpression(n){if(tt(n)){e.report({node:n,messageId:"useMemoDirectiveNaming"});return}if(Ht(n,e.sourceCode)){if(We(n))return;e.report({node:n,messageId:"functionCallingHooksMustBeComponent"})}},ReturnStatement(n){if(n.argument?.type!==N.AST_NODE_TYPES.ObjectExpression)return;let a=ur(n);if(!a)return;let p;a.type===N.AST_NODE_TYPES.FunctionDeclaration&&a.id?p=a.id.name:(a.type===N.AST_NODE_TYPES.ArrowFunctionExpression||a.type===N.AST_NODE_TYPES.FunctionExpression)&&a.parent.type===N.AST_NODE_TYPES.VariableDeclarator&&a.parent.id.type===N.AST_NODE_TYPES.Identifier&&(p=a.parent.id.name),p&&ut(p)&&(s(n)||(r(n.argument),i(n.argument)))}}}}),en={name:yr,rule:Bi};var te=require("@typescript-eslint/utils"),xe=require("zod/v4");var Yi=te.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tr="react-compiler-migration",qi=xe.z.object({disallowHooks:xe.z.array(xe.z.object({name:xe.z.string(),replacement:xe.z.string()})).optional(),disallowMethods:xe.z.array(xe.z.object({name:xe.z.string(),replacement:xe.z.string().optional(),requireTrueProp:xe.z.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:xe.z.boolean().optional()}),Zi=/eslint +react-compiler\/react-compiler: +\["error/;function Gi(e){let t=null;if((e.type===te.AST_NODE_TYPES.FunctionDeclaration||e.type===te.AST_NODE_TYPES.FunctionExpression||e.type===te.AST_NODE_TYPES.ArrowFunctionExpression&&e.body.type===te.AST_NODE_TYPES.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let o=t.body[0];return o?o.type===te.AST_NODE_TYPES.ExpressionStatement&&o.expression.type===te.AST_NODE_TYPES.Literal&&o.expression.value==="use no memo":!1}function Hi(e){let t=e.parent;for(;t;){if(t.type===te.AST_NODE_TYPES.FunctionDeclaration||t.type===te.AST_NODE_TYPES.FunctionExpression||t.type===te.AST_NODE_TYPES.ArrowFunctionExpression)return t;t=t.parent}return null}function Ki(e){return e.type===te.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===te.AST_NODE_TYPES.MemberExpression&&e.property.type===te.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var Qi=Yi({name:Tr,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[k(qi)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let o=!0;if(t.runOnlyWithEnableCompilerDirective){o=!1;for(let i of e.sourceCode.getAllComments())if(Zi.test(i.value)){o=!0;break}}if(!o)return{};function r(i){let s=Hi(i);return s!==null&&Gi(s)}return{CallExpression(i){if(t.disallowHooks?.length){let s=null,n=null;if(i.callee.type===te.AST_NODE_TYPES.Identifier?(s=i.callee.name,n=i.callee):i.callee.type===te.AST_NODE_TYPES.MemberExpression&&i.callee.property.type===te.AST_NODE_TYPES.Identifier&&(s=i.callee.property.name,n=i.callee.property),s){let a=t.disallowHooks.find(p=>p.name===s);if(a&&n){if(r(i))return;e.report({node:i,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:a.name,replacement:a.replacement},suggest:[{messageId:"replace",data:{replacement:a.replacement},fix:p=>p.replaceText(n,a.replacement)}]})}}}if(t.disallowMethods?.length&&Ki(i.callee)){for(let s of i.arguments)if(s.type===te.AST_NODE_TYPES.ObjectExpression){for(let n of s.properties)if(n.type===te.AST_NODE_TYPES.Property&&n.key.type===te.AST_NODE_TYPES.Identifier){let a=n.key.name,p=t.disallowMethods.find(l=>l.name===a);if(p){if(r(i))return;if(p.requireTrueProp){let l=p.requireTrueProp,d=!1;for(let m of s.properties)if(m.type===te.AST_NODE_TYPES.Property&&m.key.type===te.AST_NODE_TYPES.Identifier&&m.key.name===l&&m.value.type===te.AST_NODE_TYPES.Literal&&m.value.value===!0){d=!0;break}if(!d){e.report({node:n,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:p.name,requireTrueProp:l}});continue}}p.replacement&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:p.name,replacement:p.replacement},suggest:[{messageId:"replace",data:{replacement:p.replacement},fix:l=>p.replacement?l.replaceText(n.key,p.replacement):null}]})}}}}}}}}),tn={name:Tr,rule:Qi};var B=require("@typescript-eslint/utils"),nn=require("zod/v4");var es=/\.(tsx|jsx)$/,ts=/^[A-Z][A-Za-z0-9]*$/,ns=/^[A-Z][A-Z0-9_]*$/,Er=80,rs=nn.z.object({ignoreConstCaseVarRegex:nn.z.string().optional()}),on=v({name:"react-no-module-level-single-use-values",meta:{type:"problem",docs:{description:"Disallow module-level allocated data values and long strings that are only used in one React component, excluding functions, inferable aliases, regex values, and class instantiations except Set/Map"},schema:[k(rs)],messages:{moveValueInsideComponent:"Module-level `{{valueName}}` is only used in React component `{{componentName}}`. Move it inside the component to improve memory usage."}},defaultOptions:[{}],create(e,[t]){if(!es.test(e.filename))return{};let o=e.sourceCode,r=ys(t.ignoreConstCaseVarRegex),i=os(o.ast.body);return i.length===0?{}:{VariableDeclarator(s){if(s.id.type!==B.AST_NODE_TYPES.Identifier||!is(s)||!ps(s.init))return;let n=s.id.name;if(r&&ds(n)&&r.test(n))return;let p=o.getDeclaredVariables(s).find(f=>f.name===n);if(!p)return;let l=new Set,d=!1,m=!1;for(let f of p.references){if(f.init)continue;m=!0;let c=ss(f.identifier,i);if(!c){d=!0;break}if(l.add(c),l.size>1)break}if(!m||d||l.size!==1)return;let[u]=Array.from(l);u&&e.report({node:s.id,messageId:"moveValueInsideComponent",data:{valueName:n,componentName:u}})}}}});function os(e){let t=[],o=new Set;function r(s,n){ts.test(s)&&(o.has(s)||(o.add(s),t.push({name:s,range:n.range})))}function i(s){for(let n of s.declarations){if(n.id.type!==B.AST_NODE_TYPES.Identifier)continue;let a=xr(n.init);a&&r(n.id.name,a)}}for(let s of e){if(s.type===B.AST_NODE_TYPES.VariableDeclaration){i(s);continue}if(s.type===B.AST_NODE_TYPES.FunctionDeclaration){r(s.id.name,s);continue}s.type===B.AST_NODE_TYPES.ExportNamedDeclaration&&s.declaration&&(s.declaration.type===B.AST_NODE_TYPES.VariableDeclaration?i(s.declaration):s.declaration.type===B.AST_NODE_TYPES.FunctionDeclaration&&s.declaration.id&&r(s.declaration.id.name,s.declaration))}return t}function is(e){return e.parent.parent.type===B.AST_NODE_TYPES.Program}function ss(e,t){let o=null;for(let r of t){if(!(e.range[0]>=r.range[0]&&e.range[1]<=r.range[1]))continue;if(!o){o=r;continue}let s=o.range[1]-o.range[0];r.range[1]-r.range[0]<s&&(o=r)}return o?.name??null}function xr(e){if(!e)return null;let t=rn(e);if(t.type===B.AST_NODE_TYPES.ArrowFunctionExpression||t.type===B.AST_NODE_TYPES.FunctionExpression)return t;if(t.type!==B.AST_NODE_TYPES.CallExpression||!as(t.callee))return null;let o=t.arguments[0];if(!o||o.type===B.AST_NODE_TYPES.SpreadElement)return null;if(o.type===B.AST_NODE_TYPES.CallExpression)return xr(o);let r=rn(o);return r.type===B.AST_NODE_TYPES.ArrowFunctionExpression||r.type===B.AST_NODE_TYPES.FunctionExpression?r:null}function as(e){return e.type===B.AST_NODE_TYPES.Identifier?e.name==="memo"||e.name==="forwardRef":e.type===B.AST_NODE_TYPES.MemberExpression?e.property.type===B.AST_NODE_TYPES.Identifier&&(e.property.name==="memo"||e.property.name==="forwardRef"):!1}function rn(e){let t=e;for(;;){if(t.type===B.AST_NODE_TYPES.TSAsExpression){t=t.expression;continue}if(t.type===B.AST_NODE_TYPES.TSSatisfiesExpression){t=t.expression;continue}if(t.type===B.AST_NODE_TYPES.TSNonNullExpression){t=t.expression;continue}return t}}function ps(e){if(!e)return!1;let t=rn(e);return ls(t)?!1:cs(t)?!0:us(t)}function ls(e){return e.type===B.AST_NODE_TYPES.Identifier||e.type===B.AST_NODE_TYPES.MemberExpression}function cs(e){if(e.type===B.AST_NODE_TYPES.Literal)return typeof e.value=="string"&&e.value.length>=Er;if(e.type===B.AST_NODE_TYPES.TemplateLiteral){if(e.expressions.length>0)return!1;let t=e.quasis[0];return t?t.value.cooked.length>=Er:!1}return!1}function us(e){return e.type===B.AST_NODE_TYPES.ArrayExpression||e.type===B.AST_NODE_TYPES.ObjectExpression||e.type===B.AST_NODE_TYPES.ClassExpression?!0:e.type===B.AST_NODE_TYPES.NewExpression?fs(e):!1}function fs(e){let t=ms(e.callee);return t==="Set"||t==="Map"}function ms(e){return e.type===B.AST_NODE_TYPES.Identifier?e.name:e.type===B.AST_NODE_TYPES.MemberExpression?e.computed||e.property.type!==B.AST_NODE_TYPES.Identifier?null:e.property.name:null}function ds(e){return ns.test(e)}function ys(e){if(!e)return null;try{return new RegExp(e)}catch{return null}}var O=require("@typescript-eslint/utils"),an=require("zod");var gs=an.z.object({runOnlyWithEnableCompilerDirective:an.z.boolean().optional()}),Ss=/eslint +react-compiler\/react-compiler: +\["error/,Ts=/^\d+$/,Es=/[\s_-]+/,xs=/[a-z][A-Z]/,hs=/^(.+?)([A-Z][a-z]+s?)$/,bs=/^[a-z][a-zA-Z]*$/;function hr(e,t){let o=[];if(e.type===O.AST_NODE_TYPES.JSXElement){for(let r of e.openingElement.attributes)if(r.type===O.AST_NODE_TYPES.JSXAttribute&&r.name.type===O.AST_NODE_TYPES.JSXIdentifier&&r.value?.type===O.AST_NODE_TYPES.JSXExpressionContainer&&r.value.expression.type!==O.AST_NODE_TYPES.JSXEmptyExpression){let i=r.name.name,s=r.value.expression,n=!1;Re(s,a=>{switch(a.type){case O.AST_NODE_TYPES.ObjectExpression:case O.AST_NODE_TYPES.ArrowFunctionExpression:case O.AST_NODE_TYPES.FunctionExpression:case O.AST_NODE_TYPES.ArrayExpression:return n=!0,!0}return!1},t),n&&o.push(i)}}return{hasUnstable:o.length>0,problematicProps:o}}function Cs(e){if(e.body.type===O.AST_NODE_TYPES.JSXElement||e.body.type===O.AST_NODE_TYPES.JSXFragment)return!0;if(e.body.type===O.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===O.AST_NODE_TYPES.ReturnStatement&&t.argument&&(t.argument.type===O.AST_NODE_TYPES.JSXElement||t.argument.type===O.AST_NODE_TYPES.JSXFragment))return!0}return!1}function As(e,t){let o=e.callee;if(o.type===O.AST_NODE_TYPES.MemberExpression){let r=o.object;if(r.type===O.AST_NODE_TYPES.Identifier){let i=r.name,s=Is(i);if(s!==i)return pn(s)}}if(t.length>0){let r=t[0];if(r&&r.type===O.AST_NODE_TYPES.Identifier)return pn(r.name)}return"ListItem"}function Is(e){let o={people:"person",children:"child",feet:"foot",teeth:"tooth",mice:"mouse",men:"man",women:"woman"}[e.toLowerCase()];if(o)return o;if(e.match(xs)){let r=e.match(hs);if(r){let i=r[1],s=r[2];if(!i||!s)return sn(e);let n=sn(s);if(n!==s)return i+n}}return sn(e)}function sn(e){return e.endsWith("ies")?`${e.slice(0,-3)}y`:e.endsWith("es")&&e.length>3?e.slice(0,-2):e.endsWith("s")&&e.length>1?e.slice(0,-1):e}function pn(e){return e.match(bs)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Es).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function br(e,t,o){let r=[],i=new Set,s=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Re(e,n=>{if(n.type===O.AST_NODE_TYPES.Identifier&&!t.includes(n.name)&&!s.has(n.name)&&!Ts.test(n.name)){let a=n.parent;if(a.type===O.AST_NODE_TYPES.Property&&a.key===n||a.type===O.AST_NODE_TYPES.MemberExpression&&a.property===n&&!a.computed||a.type===O.AST_NODE_TYPES.JSXOpeningElement||a.type===O.AST_NODE_TYPES.JSXClosingElement||a.type===O.AST_NODE_TYPES.JSXAttribute&&a.name.type===O.AST_NODE_TYPES.JSXIdentifier&&a.name.name===n.name)return!1;i.add(n.name)}return!1},o);for(let n of i)t.includes(n)||r.push({name:n,type:"unknown"});return r}function Cr(e,t,o,r,i){let n=[...o.map(m=>m.type===O.AST_NODE_TYPES.Identifier?m.name:"item").map((m,u)=>({name:m,type:u===0?`${e}Type`:u===1?"number":"unknown"})),...r],a=n.map(m=>{let u=m.type;return m.name.includes("on")&&u==="any"&&(u="unknown"),` ${m.name}: ${u};`}).join(`
|
|
12
|
-
`),p=n.map(m=>m.name).join(", "),l=i.getText(t),d=`${e}Props`;return`type ${d} = {
|
|
13
|
-
${a}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const ${e}: FC<${d}> = ({ ${p} }) => {
|
|
17
|
-
return (
|
|
18
|
-
${l}
|
|
19
|
-
);
|
|
20
|
-
};`}function Ps(e,t,o,r){let i=t.map(n=>n.type===O.AST_NODE_TYPES.Identifier?n.name:"item"),s=[r?`key={${r}}`:`key={${i[0]}.id}`,...i.map(n=>`${n}={${n}}`),...o.map(n=>`${n.name}={${n.name}}`)].filter(Boolean);return`<${e} ${s.join(" ")} />`}function Ns(e){if(e.type===O.AST_NODE_TYPES.JSXElement&&e.openingElement.name.type===O.AST_NODE_TYPES.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return pn(t)}return"ListItem"}function Rs(e,t,o){let r=[o?`key={${o}}`:"",...t.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e}${r.length>0?` ${r.join(" ")}`:""} />`}function Ar(e,t){for(let o of e.openingElement.attributes)if(o.type===O.AST_NODE_TYPES.JSXAttribute&&o.name.type===O.AST_NODE_TYPES.JSXIdentifier&&o.name.name==="key"&&o.value&&o.value.type===O.AST_NODE_TYPES.JSXExpressionContainer&&o.value.expression.type!==O.AST_NODE_TYPES.JSXEmptyExpression)return t.getText(o.value.expression);return null}var ln=v({name:"react-optimized-collections",meta:{type:"suggestion",docs:{description:"Detect unstable values in map renders that prevent React Compiler optimization"},messages:{unstableValueInMap:"Unstable values in {{problematicProps}} prevent React Compiler from optimizing individual list items. Extract the problematic props to outside the loop or extract the item to a separate component.",extractComponent:"Extract to {{componentName}} component"},schema:[k(gs)],hasSuggestions:!0},defaultOptions:[{runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let{sourceCode:o}=e;if(t.runOnlyWithEnableCompilerDirective){let r=!1;for(let i of o.getAllComments())if(Ss.test(i.value)){r=!0;break}if(!r)return{}}return{CallExpression(r){r.callee.type===O.AST_NODE_TYPES.MemberExpression&&r.callee.property.type===O.AST_NODE_TYPES.Identifier&&(r.callee.property.name==="map"||r.callee.property.name==="push")&&(r.callee.property.name==="map"?ws(r,o,e):Fs(r,o,e))}}}});function ws(e,t,o){let r=e.arguments[0];if(!r||r.type!==O.AST_NODE_TYPES.ArrowFunctionExpression&&r.type!==O.AST_NODE_TYPES.FunctionExpression||!Cs(r))return;let i=null;if(r.body.type===O.AST_NODE_TYPES.JSXElement||r.body.type===O.AST_NODE_TYPES.JSXFragment?i=r.body:r.body.type===O.AST_NODE_TYPES.BlockStatement&&r.body.body[0]?.type===O.AST_NODE_TYPES.ReturnStatement&&r.body.body[0].argument&&(r.body.body[0].argument.type===O.AST_NODE_TYPES.JSXElement||r.body.body[0].argument.type===O.AST_NODE_TYPES.JSXFragment)&&(i=r.body.body[0].argument),!i)return;let s=hr(i,t);if(!s.hasUnstable)return;let n=As(e,r.params),a=r.params.map(m=>m.type===O.AST_NODE_TYPES.Identifier?m.name:"item"),p=br(i,a,t),l=i.type===O.AST_NODE_TYPES.JSXElement?Ar(i,t):null,d=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;o.report({node:i,messageId:"unstableValueInMap",data:{problematicProps:d},suggest:[{messageId:"extractComponent",data:{componentName:n},fix:m=>{let u=Cr(n,i,r.params,p,t),f=Ps(n,r.params,p,l),c=e;for(;c.parent.type!==O.AST_NODE_TYPES.Program&&!(c.type===O.AST_NODE_TYPES.FunctionDeclaration||c.type===O.AST_NODE_TYPES.VariableDeclarator&&c.init&&(c.init.type===O.AST_NODE_TYPES.ArrowFunctionExpression||c.init.type===O.AST_NODE_TYPES.FunctionExpression));)c=c.parent;let g=[];return g.push(m.insertTextAfter(c,`
|
|
21
|
-
|
|
22
|
-
${u}`)),g.push(m.replaceText(i,f)),g}}]})}function Fs(e,t,o){let r=e.arguments[0];if(!r||r.type!==O.AST_NODE_TYPES.JSXElement&&r.type!==O.AST_NODE_TYPES.JSXFragment)return;let i=r,s=hr(i,t);if(!s.hasUnstable)return;let n=Ns(i),a=br(i,[],t),p=i.type===O.AST_NODE_TYPES.JSXElement?Ar(i,t):null,l=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;o.report({node:i,messageId:"unstableValueInMap",data:{problematicProps:l},suggest:[{messageId:"extractComponent",data:{componentName:n},fix:d=>{let m=Cr(n,i,[],a,t),u=Rs(n,a,p),f=e;for(;f.parent.type!==O.AST_NODE_TYPES.Program&&!(f.type===O.AST_NODE_TYPES.FunctionDeclaration||f.type===O.AST_NODE_TYPES.VariableDeclarator&&f.init&&(f.init.type===O.AST_NODE_TYPES.ArrowFunctionExpression||f.init.type===O.AST_NODE_TYPES.FunctionExpression));)f=f.parent;let c=[];return c.push(d.insertTextAfter(f,`
|
|
23
|
-
|
|
24
|
-
${m}`)),c.push(d.replaceText(i,u)),c}}]})}var ft=require("@typescript-eslint/utils"),Os=ft.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ir="require-description",Ds=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|oxlint-(?:enable|disable(?:(?:-next)?-line)?)|exported|globals?)(?:\s|$)/u,vs=/^(?:eslint|oxlint)-disable-(next-)?line$/u,ks=Os({name:Ir,meta:{type:"problem",docs:{description:"Require descriptions for eslint and oxlint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","oxlint-disable","oxlint-disable-line","oxlint-disable-next-line","oxlint-enable","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let o=e.sourceCode,r=new Set(t.ignore||[]);return{Program(){for(let i of o.getAllComments()){let s=js(i);s!=null&&(r.has(s.kind)||s.description||e.report({loc:_s(i.loc),messageId:"missingDescription"}))}}}}}),Pr={name:Ir,rule:ks};function js(e){let{text:t,description:o}=Ls(e.value);if(!t)return null;let r=Ds.exec(t);if(!r)return null;let i=r[1];if(!i)return null;let s=vs.test(i);if(e.type===ft.TSESTree.AST_TOKEN_TYPES.Line&&!s||s&&e.loc.start.line!==e.loc.end.line)return null;let n=t.slice(r.index+i.length);return{kind:i,value:n.trim(),description:o}}var Ms=/\s-{2,}\s/u;function Ls(e){let t=e.split(Ms);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function _s(e){return{start:{line:e.start.line,column:0},end:e.end}}var z=require("@typescript-eslint/utils"),Pe=require("zod/v4");var $s=Pe.z.object({varsToCheck:Pe.z.array(Pe.z.object({selector:Pe.z.string().optional(),fromFnCall:Pe.z.string().optional(),prop:Pe.z.string().or(Pe.z.array(Pe.z.string())),errorMsg:Pe.z.string().optional()}))}),cn=v({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[k($s)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let o=new Map;function r(n,a,p,l){let d=new Set;for(let u of n.properties)u.type===z.AST_NODE_TYPES.Property&&u.key.type===z.AST_NODE_TYPES.Identifier&&d.add(u.key.name);let m=a.filter(u=>!d.has(u));if(m.length>0)if(m.length===1)e.report({node:n,messageId:"propNotRead",data:{prop:m[0],fnName:l,customMsg:p||""}});else{let u=m.map(f=>`"${f}"`).join(", ");e.report({node:n,messageId:"propsNotRead",data:{props:u,fnName:l,customMsg:p||""}})}}function i(n){if(n.init?.type===z.AST_NODE_TYPES.CallExpression){if(n.init.callee.type===z.AST_NODE_TYPES.Identifier)return n.init.callee.name;if(n.init.callee.type===z.AST_NODE_TYPES.MemberExpression&&n.init.callee.property.type===z.AST_NODE_TYPES.Identifier)return n.init.callee.object.type===z.AST_NODE_TYPES.Identifier?`${n.init.callee.object.name}.${n.init.callee.property.name}`:n.init.callee.property.name}return"unknown function"}let s={};for(let n of t.varsToCheck)n.selector&&(s[n.selector]=a=>{if(a.type===z.AST_NODE_TYPES.VariableDeclarator&&a.id.type===z.AST_NODE_TYPES.Identifier&&o.set(a.id.name,{props:Array.isArray(n.prop)?n.prop:[n.prop],errorMsg:n.errorMsg,node:a.id,fnName:i(a)}),a.type===z.AST_NODE_TYPES.VariableDeclarator&&a.id.type===z.AST_NODE_TYPES.ObjectPattern){let p=Array.isArray(n.prop)?n.prop:[n.prop];r(a.id,p,n.errorMsg,i(a))}});for(let n of t.varsToCheck)if(n.fromFnCall){let a=n.fromFnCall;if(a.startsWith("*.")){let l=`VariableDeclarator > CallExpression > MemberExpression[property.name="${a.slice(2)}"]`;s[l]=d=>{if(d.type!==z.AST_NODE_TYPES.MemberExpression||d.parent.type!==z.AST_NODE_TYPES.CallExpression)return;let m=d.parent;if(m.parent.type!==z.AST_NODE_TYPES.VariableDeclarator)return;let u=m.parent;if(u.id.type===z.AST_NODE_TYPES.Identifier)o.set(u.id.name,{props:Array.isArray(n.prop)?n.prop:[n.prop],errorMsg:n.errorMsg,node:u.id,fnName:n.fromFnCall||"unknown function"});else if(u.id.type===z.AST_NODE_TYPES.ObjectPattern){let f=Array.isArray(n.prop)?n.prop:[n.prop];r(u.id,f,n.errorMsg,n.fromFnCall||"unknown function")}}}else if(a.includes(".")){let[p,l]=a.split("."),d=`VariableDeclarator > CallExpression > MemberExpression[object.name="${p}"][property.name="${l}"]`;s[d]=m=>{if(m.type!==z.AST_NODE_TYPES.MemberExpression||m.parent.type!==z.AST_NODE_TYPES.CallExpression)return;let u=m.parent;if(u.parent.type!==z.AST_NODE_TYPES.VariableDeclarator)return;let f=u.parent;if(f.id.type===z.AST_NODE_TYPES.Identifier)o.set(f.id.name,{props:Array.isArray(n.prop)?n.prop:[n.prop],errorMsg:n.errorMsg,node:f.id,fnName:n.fromFnCall||"unknown function"});else if(f.id.type===z.AST_NODE_TYPES.ObjectPattern){let c=Array.isArray(n.prop)?n.prop:[n.prop];r(f.id,c,n.errorMsg,n.fromFnCall||"unknown function")}}}else{let p=`VariableDeclarator > CallExpression > Identifier[name="${a}"]`;s[p]=l=>{if(l.type!==z.AST_NODE_TYPES.Identifier||l.parent.type!==z.AST_NODE_TYPES.CallExpression)return;let d=l.parent;if(d.parent.type!==z.AST_NODE_TYPES.VariableDeclarator)return;let m=d.parent;if(m.id.type===z.AST_NODE_TYPES.Identifier)o.set(m.id.name,{props:Array.isArray(n.prop)?n.prop:[n.prop],errorMsg:n.errorMsg,node:m.id,fnName:n.fromFnCall||"unknown function"});else if(m.id.type===z.AST_NODE_TYPES.ObjectPattern){let u=Array.isArray(n.prop)?n.prop:[n.prop];r(m.id,u,n.errorMsg,n.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[n,{props:a,errorMsg:p,node:l,fnName:d}]of o){let u=e.sourceCode.getScope(l).set.get(n);if(u){let f=new Set(a);for(let c of u.references){let g=c.identifier,T=g.parent;if(!(T.type===z.AST_NODE_TYPES.VariableDeclarator&&T.id===g)){if(T.type===z.AST_NODE_TYPES.MemberExpression&&T.object===g&&T.property.type===z.AST_NODE_TYPES.Identifier&&f.has(T.property.name)){if(f.delete(T.property.name),f.size===0)break;continue}if(T.type===z.AST_NODE_TYPES.VariableDeclarator&&T.init===g&&T.id.type===z.AST_NODE_TYPES.ObjectPattern){for(let y of T.id.properties)y.type===z.AST_NODE_TYPES.Property&&y.key.type===z.AST_NODE_TYPES.Identifier&&f.has(y.key.name)&&f.delete(y.key.name);if(f.size===0)break;continue}if(!(T.type===z.AST_NODE_TYPES.MemberExpression&&T.object===g&&T.property.type===z.AST_NODE_TYPES.Identifier&&!a.includes(T.property.name))){f.clear();break}}}if(f.size>0){let c=Array.from(f);if(c.length===1)e.report({node:l,messageId:"propNotRead",data:{prop:c[0],fnName:d,customMsg:p||""}});else{let g=c.map(T=>`"${T}"`).join(", ");e.report({node:l,messageId:"propsNotRead",data:{props:g,fnName:d,customMsg:p||""}})}}}}}}}});var se=require("@typescript-eslint/utils"),ue=Oe(require("zod/v4"));var zs=/^\s+$/,un=/\r?\n/,Us=/^(\s*)/,Js=/^(\s*)\S/,Vs=/\r?\n/,Xs=ue.object({indent:ue.union([ue.string().regex(zs),ue.number().int().min(1)]).optional(),tags:ue.array(ue.string()).optional(),functions:ue.array(ue.string()).optional(),comments:ue.array(ue.string()).optional()}),fn=v({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[k(Xs)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:o=["HTML","indent"],functions:r=["dedent","stripIndent"],tags:i=["outdent","dedent","gql","sql","html","styled"],indent:s}=e.options[0],n=o.map(y=>y.toLowerCase());function a(y){let C=y.split(un),A=C.filter(b=>b.trim()!=="");if(A.length===0)return y;let S=Number.POSITIVE_INFINITY;for(let b of A){let E=b.match(Us);E&&(S=Math.min(S,E[1]?.length??0))}return!isFinite(S)||S===0?y:C.map(b=>b.slice(S)).join(`
|
|
25
|
-
`)}function p(y,C,A){return y.split(un).map(b=>b.trim()===""?b:A.repeat(C)+b).join(`
|
|
26
|
-
`)}function l(y){if(y.type===se.AST_NODE_TYPES.Identifier)return y.name;if(y.type===se.AST_NODE_TYPES.MemberExpression){let C=y.object.type===se.AST_NODE_TYPES.Identifier?y.object.name:null,A=y.property.type===se.AST_NODE_TYPES.Identifier?y.property.name:null;return C&&A?`${C}.${A}`:A}return null}function d(y,C){if(!y)return!1;for(let A of C)if(A.includes(".")){let S=A.split(".");if(y.type===se.AST_NODE_TYPES.MemberExpression&&y.object.type===se.AST_NODE_TYPES.Identifier&&y.property.type===se.AST_NODE_TYPES.Identifier&&y.object.name===S[0]&&y.property.name===S[1])return!0}else if(y.type===se.AST_NODE_TYPES.Identifier&&y.name===A)return!0;return!1}function m(y,C){let A=y.parent;if(A.type!==se.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let S=l(A.tag);return S?C.includes(S):!1}function u(y,C){if(!y||y.type!==se.AST_NODE_TYPES.CallExpression)return!1;let{method:A,argumentsLength:S,optionalCall:b=!0,optionalMember:E=!0}=C;return S!==void 0&&y.arguments.length!==S||!b&&y.optional||y.callee.type!==se.AST_NODE_TYPES.MemberExpression||!E&&y.callee.optional||y.callee.property.type!==se.AST_NODE_TYPES.Identifier?!1:y.callee.property.name===A}function f(y,C){if(!y||y.type!==se.AST_NODE_TYPES.CallExpression)return!1;let{name:A,argumentsLength:S,optionalCall:b=!0}=C;return S!==void 0&&y.arguments.length!==S||!b&&y.optional||y.callee.type!==se.AST_NODE_TYPES.Identifier?!1:y.callee.name===A}function c(y){return u(y.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&y.parent.type===se.AST_NODE_TYPES.CallExpression&&y.parent.arguments[0]===y&&f(y.parent.callee.type===se.AST_NODE_TYPES.MemberExpression?y.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function g(y){if(n.length>0){let C=t.getTokenBefore(y,{includeComments:!0});if(C?.type===se.AST_TOKEN_TYPES.Block&&n.includes(C.value.trim().toLowerCase()))return!0}return!!(c(y)||i.length>0&&m(y,i)||r.length>0&&y.parent.type===se.AST_NODE_TYPES.CallExpression&&y.parent.arguments.includes(y)&&d(y.parent.callee,r))}function T(y){let C=`__PLACEHOLDER__${Math.random()}`,A=y.quasis.map(Y=>t.getText(Y).slice(1,Y.tail?-1:-2)).join(C),S=A.match(Vs);if(!S)return;let b=S[0],E=t.lines[t.getLocFromIndex(y.range[0]).line-1];if(!E)return;let D=E.match(Js)?.[1]??"",M;typeof s=="string"?M=s:typeof s=="number"?M=" ".repeat(s):M=D.startsWith(" ")?" ":" ";let Z=a(A).replace(new RegExp(`^${b}|${b}[ ]*$`,"g"),""),h=b+p(Z,1,D+M)+b+D,x=A.includes(`\r
|
|
1
|
+
"use strict";var be=Object.create;var $=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Oe=Object.getPrototypeOf,we=Object.prototype.hasOwnProperty;var Pe=(e,t)=>{for(var r in t)$(e,r,{get:t[r],enumerable:!0})},ce=(e,t,r,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of Ce(t))!we.call(e,p)&&p!==r&&$(e,p,{get:()=>t[p],enumerable:!(c=Le(t,p))||c.enumerable});return e};var X=(e,t,r)=>(r=e!=null?be(Oe(e)):{},ce(t||!e||!e.__esModule?$(r,"default",{value:e,enumerable:!0}):r,e)),Ie=e=>ce($({},"__esModule",{value:!0}),e);var ot={};Pe(ot,{default:()=>st,extendedLintPlugin:()=>Se});module.exports=Ie(ot);var S=require("@typescript-eslint/types"),N=require("zod/v4");var ue=X(require("zod/v4")),ve="https://github.com/lucasols/extended-lint#";function B(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=Object.entries(e);return new Map(t)}function me(e,t){let r={};for(let c of new Set([...e.keys(),...t.keys()])){let p=e.get(c),f=t.get(c);if(e.has(c)&&t.has(c)){let s=B(p),l=B(f);r[c]=s&&l?me(s,l):f}else r[c]=e.has(c)?p:f}return r}function Ae(e,t){let r=structuredClone(e);if(!t)return r;let c=r.map((p,f)=>{let s=t[f];if(s===void 0)return p;let l=B(p),i=B(s);return l&&i?me(l,i):s});return Object.assign(r,c)}function J({name:e,meta:t,create:r,defaultOptions:c}){return{meta:{...t,docs:{...t.docs,url:`${ve}${e}`}},defaultOptions:c,create(p){return r(p,Ae(c,p.options))}}}function O(e){return{name:e.name,rule:J(e)}}function P(e){return ue.toJSONSchema(e)}var de="collapse-simple-objs-in-one-line",Me=N.z.object({maxLineLength:N.z.number().optional(),maxProperties:N.z.number().optional(),nestedObjMaxLineLength:N.z.number().optional(),nestedObjMaxProperties:N.z.number().optional(),ignoreTypesWithSuffix:N.z.array(N.z.string()).optional()}),Ne=J({name:de,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[P(Me)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,c=t.ignoreTypesWithSuffix??[],p=t.maxProperties??2,f=t.nestedObjMaxLineLength??t.maxLineLength,s=t.nestedObjMaxProperties??3;function l(n){if(n.type===S.AST_NODE_TYPES.ObjectExpression){let y=n.parent.type===S.AST_NODE_TYPES.Property,g=y?s:p,a=n.properties.length;if(a>g)return!1;if(a===1){let m=n.properties[0];return!m||m.type===S.AST_NODE_TYPES.Property&&m.value.type===S.AST_NODE_TYPES.ObjectExpression||m.type===S.AST_NODE_TYPES.Property&&m.value.type===S.AST_NODE_TYPES.ArrayExpression&&!m.value.elements.every(C=>C&&H(C))?!1:{text:r.getText(m),isNested:y,propsSize:a}}let u=[];for(let m of n.properties){if(m.type===S.AST_NODE_TYPES.Property&&!H(m.value))return!1;u.push(r.getText(m))}return{text:u.join(", "),isNested:y,propsSize:a}}else{let y=n.parent.parent?.type===S.AST_NODE_TYPES.TSPropertySignature,g=y?s:p,a=n.members.length;if(a>g)return!1;if(c.length>0&&n.parent.type===S.AST_NODE_TYPES.TSTypeAliasDeclaration){let m=n.parent.id.name;if(c.some(d=>m.endsWith(d)))return!1}if(a===1){let m=n.members[0];return!m||m.type===S.AST_NODE_TYPES.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===S.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(m),isNested:y,propsSize:1}}if(n.parent.type===S.AST_NODE_TYPES.TSIntersectionType||n.parent.type===S.AST_NODE_TYPES.TSUnionType&&n.parent.types[0]!==n)return!1;let u=[];for(let m of n.members){if(m.type!==S.AST_NODE_TYPES.TSPropertySignature)return!1;let d=m.typeAnnotation?.typeAnnotation;if(!d||d.type===S.AST_NODE_TYPES.TSTypeLiteral||!fe(d))return!1;if(d.type===S.AST_NODE_TYPES.TSTypeReference&&d.typeArguments){if(d.typeArguments.params.length>1)return!1;let o=d.typeArguments.params[0];if(!o||!fe(o))return!1}let C=r.getText(m).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),u.push(C)}return{text:u.join("; "),isNested:y,propsSize:a}}}function i(n){if(n.loc.start.line===n.loc.end.line)return;if(n.parent.type!==S.AST_NODE_TYPES.JSXExpressionContainer){let d=0,C=!1,o=r.getTokenAfter(n,{filter:T=>T.type!==S.AST_TOKEN_TYPES.Punctuator||C?!0:T.value===","?(d++,!1):T.value===";"?(d++,C=!0,!1):T.value===")"||T.value==="}"?(d++,!1):!0});if(d>4)return;let x=o?.type===S.AST_TOKEN_TYPES.Template&&o.value.startsWith(`}
|
|
2
|
+
`);if(o?.loc.start.line===n.loc.end.line&&!x)return}let y=l(n);if(!y)return;let g=y.text;if(g.includes(`
|
|
3
|
+
`)||r.getCommentsInside(n).length>0)return;g.endsWith(";")&&(g=g.slice(0,-1));let a=`{ ${g} }`,u=je(r,n),m=y.isNested&&y.propsSize>2?f:t.maxLineLength;m&&a.length+u.length+Re(n,r)>m||e.report({node:n,messageId:"singleLineProp",fix:d=>d.replaceText(n,a)})}return{TSTypeLiteral:i,ObjectExpression:i}}});function fe(e){return e.type===S.AST_NODE_TYPES.TSLiteralType||e.type===S.AST_NODE_TYPES.TSTypeReference||e.type===S.AST_NODE_TYPES.TSNumberKeyword||e.type===S.AST_NODE_TYPES.TSStringKeyword||e.type===S.AST_NODE_TYPES.TSBooleanKeyword||e.type===S.AST_NODE_TYPES.TSNullKeyword||e.type===S.AST_NODE_TYPES.TSUndefinedKeyword}function H(e,t){return!!(e.type===S.AST_NODE_TYPES.Literal||e.type===S.AST_NODE_TYPES.Identifier||e.type===S.AST_NODE_TYPES.TemplateLiteral||e.type===S.AST_NODE_TYPES.TaggedTemplateExpression||!t&&e.type===S.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&H(r,!0)))}function Re(e,t){let r=t.getLastToken(e);if(!r)return 0;let c=t.text.indexOf(`
|
|
4
|
+
`,r.range[1]);return(c!==-1?c:t.text.length)-r.range[1]}function je(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Z={name:de,rule:Ne};var Y=require("@typescript-eslint/types"),z=require("zod/v4");var ke=z.z.object({allow:z.z.record(z.z.string(),z.z.array(z.z.string())).optional()}),K=O({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[P(ke)],messages:{noDataAttributesOnComponents:"Avoid using data-* attributes on custom components. Use regular props instead or apply data attributes to the underlying DOM element."}},defaultOptions:[{}],create(e,[t]){let r=t.allow??{};function c(s){let l=s.charAt(0);return l===l.toUpperCase()&&l!==l.toLowerCase()}function p(s){return s.type===Y.AST_NODE_TYPES.JSXIdentifier?{name:s.name,isCustom:c(s.name)}:s.type===Y.AST_NODE_TYPES.JSXMemberExpression?{name:"",isCustom:!0}:{name:`${s.namespace.name}:${s.name.name}`,isCustom:!1}}function f(s,l){let i=r[s];return i?i.includes(l):!1}return{JSXAttribute(s){if(s.name.type!==Y.AST_NODE_TYPES.JSXIdentifier)return;let l=s.name.name;if(!l.startsWith("data-"))return;let i=p(s.parent.name);!i||!i.isCustom||i.name&&f(i.name,l)||e.report({node:s,messageId:"noDataAttributesOnComponents"})}}}});var R=require("zod/v4");var De="no-restricted-comments",Fe=R.z.object({regex:R.z.string().optional(),includes:R.z.string().optional(),message:R.z.string().optional(),autoFix:R.z.boolean().optional()}),ze=R.z.object({patterns:R.z.array(Fe)}),G=O({name:De,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[P(ze)],messages:{restrictedComment:"Comment matches restricted pattern '{{pattern}}'",restrictedCommentWithMessage:"{{message}}",removeComment:"Remove this comment"}},defaultOptions:[{patterns:[]}],create(e,[t]){let r=e.sourceCode,c=new Map;function p(s){let l=c.get(s);return l||(l=new RegExp(s),c.set(s,l)),l}function f(s,l){return l.regex?p(l.regex).test(s):l.includes?s.includes(l.includes):!1}return{Program(){let s=r.getAllComments();for(let i of s)for(let n of t.patterns)if(f(i.value,n)){let g=function(a){return a.remove(i)};var l=g;let y=n.regex??n.includes??"";n.message?e.report({loc:i.loc,messageId:"restrictedCommentWithMessage",data:{message:n.message},fix:n.autoFix?g:void 0,suggest:n.autoFix?void 0:[{messageId:"removeComment",fix:g}]}):e.report({loc:i.loc,messageId:"restrictedComment",data:{pattern:y},fix:n.autoFix?g:void 0,suggest:n.autoFix?void 0:[{messageId:"removeComment",fix:g}]});break}}}}});var F=require("@typescript-eslint/types");var _e="no-unnecessary-async-on-jsx-props";function Je(e){if(e.body.type!==F.AST_NODE_TYPES.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==F.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===F.AST_NODE_TYPES.AwaitExpression}var Q=O({name:_e,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(r){Je(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(c){let p=e.sourceCode,f=[],s=p.getFirstToken(r,i=>i.value==="async");if(s){let i=p.getTokenAfter(s);i?f.push(c.replaceTextRange([s.range[0],i.range[0]],"")):f.push(c.remove(s))}function l(i){if(i.type===F.AST_NODE_TYPES.AwaitExpression){let n=p.getFirstToken(i);if(n&&n.value==="await"){let y=p.getTokenAfter(n);y?f.push(c.replaceTextRange([n.range[0],y.range[0]],"")):f.push(c.remove(n))}}if(i.type===F.AST_NODE_TYPES.BlockStatement)for(let n of i.body)l(n);else i.type===F.AST_NODE_TYPES.ExpressionStatement&&l(i.expression)}return l(r.body),f}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var v=require("@typescript-eslint/types"),V=X(require("zod/v4"));var We=V.object({ignoreWithDescription:V.string().optional()}),ee=O({name:"no-unnecessary-describe",meta:{type:"suggestion",docs:{description:"Disallow unnecessary describe blocks that wrap all tests in a file"},messages:{unnecessaryDescribe:"Describe blocks that solely wrap all tests in the file are unnecessary, they just add unnecessary nesting to the code. The file itself should be enough to group tests. Remove it.",removeDescribe:"Remove the describe block"},hasSuggestions:!0,schema:[P(We)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),c=r.ast;function p(i){let n=i.arguments[0];return n&&n.type===v.AST_NODE_TYPES.Literal&&typeof n.value=="string"?n.value:null}function f(i){return!i||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(i)}function s(i){return i.length!==1?!1:c.body.filter(y=>{if(y.type===v.AST_NODE_TYPES.ExpressionStatement){let g=y.expression;if(g.type===v.AST_NODE_TYPES.CallExpression&&g.callee.type===v.AST_NODE_TYPES.Identifier){let a=g.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(a)}}return!1}).length===0}function l(i){let n=i.arguments[1];if(n&&(n.type===v.AST_NODE_TYPES.FunctionExpression||n.type===v.AST_NODE_TYPES.ArrowFunctionExpression)&&n.body.type===v.AST_NODE_TYPES.BlockStatement){let y=n.body.body;return y.length===0?"":y.map(a=>r.text.slice(a.range[0],a.range[1])).join(`
|
|
5
|
+
|
|
6
|
+
`)}return""}return{Program(){let i=[];for(let a of c.body)a.type===v.AST_NODE_TYPES.ExpressionStatement&&a.expression.type===v.AST_NODE_TYPES.CallExpression&&a.expression.callee.type===v.AST_NODE_TYPES.Identifier&&a.expression.callee.name==="describe"&&a.expression.arguments.length===2&&i.push(a.expression);if(!s(i))return;let[n]=i;if(!n)return;let y=p(n);if(f(y))return;let g=c.body.find(a=>a.type===v.AST_NODE_TYPES.ExpressionStatement&&a.expression===n);!g||g.type!==v.AST_NODE_TYPES.ExpressionStatement||e.report({node:n,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(a){let u=l(n);return u?a.replaceText(g,u):null}}]})}}}});var I=require("@typescript-eslint/types");var te=O({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===I.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==I.AST_NODE_TYPES.ObjectExpression||t.id.type===I.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===I.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let s of t.init.properties)s.type===I.AST_NODE_TYPES.Property&&s.key.type===I.AST_NODE_TYPES.Identifier&&r.set(s.key.name,s);if(r.size===0||t.id.type!==I.AST_NODE_TYPES.Identifier)return;let c=Ue(t,e.sourceCode);if(c.length===0)return;let p=t.init.properties.some(s=>s.type!==I.AST_NODE_TYPES.Property?!1:s.value.type===I.AST_NODE_TYPES.FunctionExpression),f=new Set;for(let s of c){if(s.identifier.parent.type!==I.AST_NODE_TYPES.MemberExpression)return;let l=s.identifier.parent;if(l.object!==s.identifier)return;if(l.computed)if(l.property.type===I.AST_NODE_TYPES.Literal&&typeof l.property.value=="string")f.add(l.property.value);else return;else{if(l.property.type!==I.AST_NODE_TYPES.Identifier)return;f.add(l.property.name)}if(l.parent.type===I.AST_NODE_TYPES.CallExpression&&p)return}for(let[s,l]of r)f.has(s)||e.report({node:l,messageId:"unusedObjectProperty",data:{name:s}})}}}});function Ue(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let c=r[0];return c?c.references.filter(p=>p.identifier!==e.id):[]}var h=require("@typescript-eslint/types"),A=require("zod/v4");var ge="react-compiler-migration",qe=A.z.object({disallowHooks:A.z.array(A.z.object({name:A.z.string(),replacement:A.z.string()})).optional(),disallowMethods:A.z.array(A.z.object({name:A.z.string(),replacement:A.z.string().optional(),requireTrueProp:A.z.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:A.z.boolean().optional()}),$e=/eslint +react-compiler\/react-compiler: +\["error/;function Be(e){let t=null;if((e.type===h.AST_NODE_TYPES.FunctionDeclaration||e.type===h.AST_NODE_TYPES.FunctionExpression||e.type===h.AST_NODE_TYPES.ArrowFunctionExpression&&e.body.type===h.AST_NODE_TYPES.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===h.AST_NODE_TYPES.ExpressionStatement&&r.expression.type===h.AST_NODE_TYPES.Literal&&r.expression.value==="use no memo":!1}function Ye(e){let t=e.parent;for(;t;){if(t.type===h.AST_NODE_TYPES.FunctionDeclaration||t.type===h.AST_NODE_TYPES.FunctionExpression||t.type===h.AST_NODE_TYPES.ArrowFunctionExpression)return t;t=t.parent}return null}function Ve(e){return e.type===h.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===h.AST_NODE_TYPES.MemberExpression&&e.property.type===h.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var Xe=J({name:ge,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[P(qe)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let r=!0;if(t.runOnlyWithEnableCompilerDirective){r=!1;for(let p of e.sourceCode.getAllComments())if($e.test(p.value)){r=!0;break}}if(!r)return{};function c(p){let f=Ye(p);return f!==null&&Be(f)}return{CallExpression(p){if(t.disallowHooks?.length){let f=null,s=null;if(p.callee.type===h.AST_NODE_TYPES.Identifier?(f=p.callee.name,s=p.callee):p.callee.type===h.AST_NODE_TYPES.MemberExpression&&p.callee.property.type===h.AST_NODE_TYPES.Identifier&&(f=p.callee.property.name,s=p.callee.property),f){let l=t.disallowHooks.find(i=>i.name===f);if(l&&s){if(c(p))return;e.report({node:p,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:l.name,replacement:l.replacement},suggest:[{messageId:"replace",data:{replacement:l.replacement},fix:i=>i.replaceText(s,l.replacement)}]})}}}if(t.disallowMethods?.length&&Ve(p.callee)){for(let f of p.arguments)if(f.type===h.AST_NODE_TYPES.ObjectExpression){for(let s of f.properties)if(s.type===h.AST_NODE_TYPES.Property&&s.key.type===h.AST_NODE_TYPES.Identifier){let l=s.key.name,i=t.disallowMethods.find(n=>n.name===l);if(i){if(c(p))return;if(i.requireTrueProp){let n=i.requireTrueProp,y=!1;for(let g of f.properties)if(g.type===h.AST_NODE_TYPES.Property&&g.key.type===h.AST_NODE_TYPES.Identifier&&g.key.name===n&&g.value.type===h.AST_NODE_TYPES.Literal&&g.value.value===!0){y=!0;break}if(!y){e.report({node:s,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:i.name,requireTrueProp:n}});continue}}i.replacement&&e.report({node:s,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:n=>i.replacement?n.replaceText(s.key,i.replacement):null}]})}}}}}}}}),re={name:ge,rule:Xe};var j=require("@typescript-eslint/types"),k=require("zod/v4");var He=k.z.object({fn:k.z.string().optional(),selector:k.z.string().optional(),commentPrefix:k.z.string(),message:k.z.string().optional()}),Ze=k.z.object({matches:k.z.array(He)}),ne=O({name:"require-usage-explanation",meta:{type:"problem",docs:{description:"Require explanatory comments with a specific prefix above matched code patterns"},schema:[P(Ze)],messages:{default:"{{message}}"}},defaultOptions:[{matches:[]}],create(e,[t]){let r=e.sourceCode,c={},p=[];function f(a){let u=a;for(;u.parent;){let m=u.parent.type;if(m===j.AST_NODE_TYPES.Program||m===j.AST_NODE_TYPES.BlockStatement||m===j.AST_NODE_TYPES.SwitchCase)return u;u=u.parent}}function s(a,u){for(let m of a){let d=m.value.trim();if(d.startsWith(u)&&d.slice(u.length).trim().length>0)return!0}return!1}function l(a){let{callee:u}=a;if(u.type===j.AST_NODE_TYPES.Identifier)return u.name;if(u.type===j.AST_NODE_TYPES.MemberExpression&&u.property.type===j.AST_NODE_TYPES.Identifier)return u.property.name}function i(a,u,m){let d=`Add a comment with prefix "${a}" to explain why "${u}" is being used.`;return m?`${d} ${m}`:d}function n(a,u){let m=f(a);if(!m)return!1;let d=a;for(;d!==m&&d.parent;){let o=r.getCommentsBefore(d);if(s(o,u))return!0;d=d.parent}let C=r.getCommentsBefore(m);return!!s(C,u)}function y(a,u){n(a,u.commentPrefix)||e.report({node:a,messageId:"default",data:{message:i(u.commentPrefix,u.label,u.message)}})}function g(a,u){let m=c[a];m?c[a]=d=>{m(d),u(d)}:c[a]=u}for(let a of t.matches){if(a.fn){let u=a.fn,m={commentPrefix:a.commentPrefix,label:u,message:a.message};p.push(d=>{l(d)===u&&y(d,m)})}if(a.selector){let u={commentPrefix:a.commentPrefix,label:a.selector,message:a.message};g(a.selector,m=>{y(m,u)})}}return p.length>0&&g("CallExpression",a=>{if(a.type===j.AST_NODE_TYPES.CallExpression)for(let u of p)u(a)}),c}});var b=require("@typescript-eslint/types"),w=X(require("zod/v4"));var Ke=/^\s+$/,se=/\r?\n/,Ge=/^(\s*)/,Qe=/^(\s*)\S/,et=/\r?\n/,tt=w.object({indent:w.union([w.string().regex(Ke),w.number().int().min(1)]).optional(),tags:w.array(w.string()).optional(),functions:w.array(w.string()).optional(),comments:w.array(w.string()).optional()}),oe=O({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[P(tt)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:c=["dedent","stripIndent"],tags:p=["outdent","dedent","gql","sql","html","styled"],indent:f}=e.options[0],s=r.map(o=>o.toLowerCase());function l(o){let x=o.split(se),T=x.filter(L=>L.trim()!=="");if(T.length===0)return o;let E=Number.POSITIVE_INFINITY;for(let L of T){let D=L.match(Ge);D&&(E=Math.min(E,D[1]?.length??0))}return!isFinite(E)||E===0?o:x.map(L=>L.slice(E)).join(`
|
|
7
|
+
`)}function i(o,x,T){return o.split(se).map(L=>L.trim()===""?L:T.repeat(x)+L).join(`
|
|
8
|
+
`)}function n(o){if(o.type===b.AST_NODE_TYPES.Identifier)return o.name;if(o.type===b.AST_NODE_TYPES.MemberExpression){let x=o.object.type===b.AST_NODE_TYPES.Identifier?o.object.name:null,T=o.property.type===b.AST_NODE_TYPES.Identifier?o.property.name:null;return x&&T?`${x}.${T}`:T}return null}function y(o,x){if(!o)return!1;for(let T of x)if(T.includes(".")){let E=T.split(".");if(o.type===b.AST_NODE_TYPES.MemberExpression&&o.object.type===b.AST_NODE_TYPES.Identifier&&o.property.type===b.AST_NODE_TYPES.Identifier&&o.object.name===E[0]&&o.property.name===E[1])return!0}else if(o.type===b.AST_NODE_TYPES.Identifier&&o.name===T)return!0;return!1}function g(o,x){let T=o.parent;if(T.type!==b.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let E=n(T.tag);return E?x.includes(E):!1}function a(o,x){if(!o||o.type!==b.AST_NODE_TYPES.CallExpression)return!1;let{method:T,argumentsLength:E,optionalCall:L=!0,optionalMember:D=!0}=x;return E!==void 0&&o.arguments.length!==E||!L&&o.optional||o.callee.type!==b.AST_NODE_TYPES.MemberExpression||!D&&o.callee.optional||o.callee.property.type!==b.AST_NODE_TYPES.Identifier?!1:o.callee.property.name===T}function u(o,x){if(!o||o.type!==b.AST_NODE_TYPES.CallExpression)return!1;let{name:T,argumentsLength:E,optionalCall:L=!0}=x;return E!==void 0&&o.arguments.length!==E||!L&&o.optional||o.callee.type!==b.AST_NODE_TYPES.Identifier?!1:o.callee.name===T}function m(o){return a(o.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&o.parent.type===b.AST_NODE_TYPES.CallExpression&&o.parent.arguments[0]===o&&u(o.parent.callee.type===b.AST_NODE_TYPES.MemberExpression?o.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function d(o){if(s.length>0){let x=t.getTokenBefore(o,{includeComments:!0});if(x?.type===b.AST_TOKEN_TYPES.Block&&s.includes(x.value.trim().toLowerCase()))return!0}return!!(m(o)||p.length>0&&g(o,p)||c.length>0&&o.parent.type===b.AST_NODE_TYPES.CallExpression&&o.parent.arguments.includes(o)&&y(o.parent.callee,c))}function C(o){let x=`__PLACEHOLDER__${Math.random()}`,T=o.quasis.map(M=>t.getText(M).slice(1,M.tail?-1:-2)).join(x),E=T.match(et);if(!E)return;let L=E[0],D=t.lines[t.getLocFromIndex(o.range[0]).line-1];if(!D)return;let W=D.match(Qe)?.[1]??"",_;typeof f=="string"?_=f:typeof f=="number"?_=" ".repeat(f):_=W.startsWith(" ")?" ":" ";let Te=l(T).replace(new RegExp(`^${L}|${L}[ ]*$`,"g"),""),pe=L+i(Te,1,W+_)+L+W,xe=T.includes(`\r
|
|
27
9
|
`)?`\r
|
|
28
10
|
`:`
|
|
29
|
-
`,
|
|
30
|
-
`)}
|
|
31
|
-
${D}`),b.push(U)}yield g.insertTextBeforeRange([S,S],`${b.join(`
|
|
32
|
-
|
|
33
|
-
`)}
|
|
34
|
-
|
|
35
|
-
`)}}}return{Program(c){i.push(...c.body)},TSTypeAliasDeclaration(c){if(i.some(T=>T.type===pe.AST_NODE_TYPES.ExportNamedDeclaration&&T.declaration===c?!0:T===c)){let T=s(c);T&&r.set(c.id.name,{node:c,name:c.id.name,statement:T})}},TSInterfaceDeclaration(c){if(i.some(T=>T.type===pe.AST_NODE_TYPES.ExportNamedDeclaration&&T.declaration===c?!0:T===c)){let T=s(c);T&&r.set(c.id.name,{node:c,name:c.id.name,statement:T})}},TSTypeReference(c){if(c.typeName.type===pe.AST_NODE_TYPES.Identifier){if(d(c))return;let g=n(c),T=a(c),y=p(c);m.push({typeName:c.typeName.name,node:c,inFunctionArgs:g,inFCProps:T,inGenericArgAtFunctionCall:y,usagePosition:c.range[0]})}},"Program:exit"(){let c=new Map;function g(y){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let C of t.checkOnly)if(C==="function-args"&&y.inFunctionArgs||C==="FC"&&y.inFCProps||C==="generic-args-at-fn-calls"&&y.inGenericArgAtFunctionCall)return!0;return!1}for(let y of m){let{typeName:C,node:A}=y;if(!r.has(C)||!g(y))continue;let S=s(A),b=r.get(C);if(!S||!b||S===b.statement)continue;c.has(C)||c.set(C,[]);let E=c.get(C);if(!E)return;E.includes(S)||E.push(S)}let T=[];for(let[y,C]of c)if(C.length>0){if(C.length===0)continue;let A=C[0];if(!A)continue;let S=Number.MAX_SAFE_INTEGER,b=!1;for(let I of C)I.range[0]<A.range[0]&&(A=I);for(let I of m)g(I)&&I.typeName===y&&s(I.node)===A&&I.usagePosition<S&&(S=I.usagePosition,b=I.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let I=Number.MAX_SAFE_INTEGER;for(let M of m){if(M.typeName!==y)continue;let U=s(M.node);if(!U)continue;let Z=i.indexOf(U);Z!==-1&&Z<I&&(I=Z)}let D=i.indexOf(A);if(I!==Number.MAX_SAFE_INTEGER&&D!==-1&&I<D)continue}else{let I=Number.MAX_SAFE_INTEGER;for(let M of m){if(M.typeName!==y||l(M.node))continue;let U=s(M.node);if(!U)continue;let Z=i.indexOf(U);Z!==-1&&Z<I&&(I=Z)}let D=i.indexOf(A);if(I!==Number.MAX_SAFE_INTEGER&&D!==-1&&I<D)continue}T.push({typeName:y,firstUsage:A,firstUsagePosition:S,firstUsageInFunctionArgs:b})}T.length>0&&u(T)}}}});var X=require("@typescript-eslint/utils"),Ye=Oe(require("zod/v4"));var qs=["tsx"],Zs=/^[A-Z][A-Za-z0-9]*$/,Gs=Ye.object({extensions:Ye.array(Ye.string()).optional()}),gn=v({name:"react-single-export",meta:{type:"problem",docs:{description:"Enforces only one export per React component file to support fast refresh"},messages:{multipleExports:"React component files should have only one export to support fast refresh, if you want to export multiple components, use a separate file for each component. Type-only exports are allowed."},schema:[k(Gs)]},defaultOptions:[{}],create(e,[t]){let o=e.getFilename(),r=t.extensions??qs,i=!1;for(let S of r)if(o.endsWith(S)){i=!0;break}if(!i)return{};let s=e.sourceCode,n=new Set,a=new Map;function p(S){return Zs.test(S)}function l(S){if(S.type!==X.AST_NODE_TYPES.CallExpression)return!1;let b=S.callee;return b.type===X.AST_NODE_TYPES.Identifier?b.name==="memo"||b.name==="forwardRef":b.type===X.AST_NODE_TYPES.MemberExpression&&b.property.type===X.AST_NODE_TYPES.Identifier?b.property.name==="memo"||b.property.name==="forwardRef":!1}function d(S){if(S.type===X.AST_NODE_TYPES.JSXElement||S.type===X.AST_NODE_TYPES.JSXFragment)return!0;if(S.type===X.AST_NODE_TYPES.ArrayExpression){for(let b of S.elements)if(b&&(b.type===X.AST_NODE_TYPES.JSXElement||b.type===X.AST_NODE_TYPES.JSXFragment))return!0}return!1}function m(S){if(S.type!==X.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let b=S.body;if(b.type===X.AST_NODE_TYPES.ArrowFunctionExpression){let E=b.body;if(d(E))return!0}return!1}function u(S){if(S.id.type!==X.AST_NODE_TYPES.Identifier)return;let b=S.id.name,E=S.init;if(E){if(p(b)&&(E.type===X.AST_NODE_TYPES.ArrowFunctionExpression||E.type===X.AST_NODE_TYPES.FunctionExpression||l(E))){n.add(b);return}E.type===X.AST_NODE_TYPES.Identifier&&a.set(b,E.name),p(b)||m(E)&&n.add(b)}}function f(S){if(S.type===X.AST_NODE_TYPES.VariableDeclaration){for(let b of S.declarations)u(b);return}if(S.type===X.AST_NODE_TYPES.FunctionDeclaration&&S.id){p(S.id.name)&&n.add(S.id.name);return}if(S.type===X.AST_NODE_TYPES.ExportNamedDeclaration&&S.declaration){let b=S.declaration;if(b.type===X.AST_NODE_TYPES.VariableDeclaration){for(let E of b.declarations)u(E);return}if(b.type===X.AST_NODE_TYPES.FunctionDeclaration&&b.id){p(b.id.name)&&n.add(b.id.name);return}}}for(let S of s.ast.body)f(S);function c(S,b=new Set){if(n.has(S))return!0;if(b.has(S))return!1;b.add(S);let E=a.get(S);return E?c(E,b):!1}let g=[];function T(S,b,E){g.push({node:S,isType:b,isComponent:E})}for(let S of s.ast.body){if(S.type===X.AST_NODE_TYPES.ExportNamedDeclaration){let b=S.exportKind==="type";if(S.declaration){let E=S.declaration;if(E.type===X.AST_NODE_TYPES.TSTypeAliasDeclaration||E.type===X.AST_NODE_TYPES.TSInterfaceDeclaration){T(E,!0,!1);continue}if(E.type===X.AST_NODE_TYPES.VariableDeclaration){for(let I of E.declarations){if(I.id.type!==X.AST_NODE_TYPES.Identifier)continue;let D=I.id.name,M=c(D);T(I,b,M)}continue}if(E.type===X.AST_NODE_TYPES.FunctionDeclaration){let I=E.id?.name,D=I?c(I)||p(I):!1;T(E,b,D);continue}T(E,b,!1);continue}if(S.specifiers.length>0)for(let E of S.specifiers){if(E.local.type!==X.AST_NODE_TYPES.Identifier)continue;let I=E.local.name,D=c(I);T(E,b,D)}continue}if(S.type===X.AST_NODE_TYPES.ExportDefaultDeclaration){let b=S.declaration;if(b.type===X.AST_NODE_TYPES.Identifier){let E=c(b.name)||p(b.name);T(S,!1,E);continue}if(b.type===X.AST_NODE_TYPES.FunctionDeclaration||b.type===X.AST_NODE_TYPES.ArrowFunctionExpression||b.type===X.AST_NODE_TYPES.FunctionExpression||b.type===X.AST_NODE_TYPES.CallExpression){T(S,!1,!0);continue}T(S,!1,!1);continue}}let y=!1;for(let S of g)if(!S.isType&&S.isComponent){y=!0;break}if(!y)return{};let C=[];for(let S of g)S.isType||C.push(S);let A=-1;for(let[S,b]of C.entries())if(b.isComponent){A=S;break}if(A===-1)return{};for(let[S,b]of C.entries())if(S!==A){e.report({node:b.node,messageId:"multipleExports"});break}return{}}});var Fe=require("@typescript-eslint/utils"),mt=require("zod/v4");function dt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Hs(e){return e.callee.type===Fe.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===Fe.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===Fe.AST_NODE_TYPES.Identifier&&e.callee.property.type===Fe.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var Ks=mt.z.object({ignorePrefixes:mt.z.array(mt.z.string()).optional()});function Nr(e,t){for(let o of t)if(e.startsWith(o))return e.slice(o.length);return e}function Qs(e){return`set${dt(e)}`}var Sn=v({name:"use-state-setter-naming",meta:{type:"problem",docs:{description:"Enforce consistent naming convention for useState destructuring where setter should be set{Value}"},messages:{incorrectSetterName:'useState setter should follow the pattern "set{{expectedName}}" with a "set" prefix but got "{{actualName}}"',useSuggestedName:'Use "{{expectedSetterName}}" instead'},hasSuggestions:!0,schema:[k(Ks)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(o){if(!o.init||o.init.type!==Fe.AST_NODE_TYPES.CallExpression||!Hs(o.init)||o.id.type!==Fe.AST_NODE_TYPES.ArrayPattern||o.id.elements.length!==2)return;let[r,i]=o.id.elements;if(!r||!i||r.type!==Fe.AST_NODE_TYPES.Identifier||i.type!==Fe.AST_NODE_TYPES.Identifier)return;let s=r.name,n=i.name,a=t.ignorePrefixes||[],p=Nr(s,a),l=Nr(n,a);if(p===""){if(!l.startsWith("set")){let m=`set${dt(s)}`;e.report({node:i,messageId:"incorrectSetterName",data:{expectedName:dt(s),actualName:n},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:m},fix:u=>u.replaceText(i,m)}]})}return}let d=Qs(p);l!==d&&e.report({node:i,messageId:"incorrectSetterName",data:{expectedName:dt(p),actualName:n},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:d},fix:m=>m.replaceText(i,d)}]})}}}});var ie=require("@typescript-eslint/utils"),Je=require("zod/v4");var ea=Je.z.object({name:Je.z.string(),defaults:Je.z.array(Je.z.unknown())}),ta=Je.z.object({functions:Je.z.array(ea)});function yt(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((i,s)=>yt(i,t[s]));let o=Object.keys(e),r=Object.keys(t);if(o.length!==r.length)return!1;for(let i of o){if(!r.includes(i))return!1;let s=Object.getOwnPropertyDescriptor(e,i),n=Object.getOwnPropertyDescriptor(t,i);if(!s||!n)return!1;let a=s.value,p=n.value;if(!yt(a,p))return!1}return!0}function na(e,t){let o=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return o;for(let r in e){if(!(r in t))continue;let i=Object.getOwnPropertyDescriptor(e,r),s=Object.getOwnPropertyDescriptor(t,r);i&&s&&yt(i.value,s.value)&&o.add(r)}return o}function Rr(e){if(e.type===ie.AST_NODE_TYPES.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case ie.AST_NODE_TYPES.Literal:return e.value;case ie.AST_NODE_TYPES.ObjectExpression:{let t={};for(let o of e.properties)o.type===ie.AST_NODE_TYPES.Property&&o.key.type===ie.AST_NODE_TYPES.Identifier&&!o.computed&&(o.value.type===ie.AST_NODE_TYPES.Literal?t[o.key.name]=o.value.value:o.value.type===ie.AST_NODE_TYPES.ObjectExpression?t[o.key.name]=Rr(o.value):t[o.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case ie.AST_NODE_TYPES.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===ie.AST_NODE_TYPES.SpreadElement))return t.type===ie.AST_NODE_TYPES.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function ra(e){return e.type===ie.AST_NODE_TYPES.Identifier?e.name:e.type===ie.AST_NODE_TYPES.MemberExpression&&e.property.type===ie.AST_NODE_TYPES.Identifier&&!e.computed?e.property.name:null}var Tn=v({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParams:"Function call has redundant parameters matching its default values and can be removed: {{details}}"},fixable:"code",schema:[k(ta)]},defaultOptions:[{functions:[]}],create(e,[t]){let o=new Map;for(let r of t.functions)o.set(r.name,r.defaults);return{CallExpression(r){let i=ra(r.callee);if(!i)return;let s=o.get(i);if(!s)return;let n=r.arguments;if(n.length===0)return;let a=-1,p=!1,l=new Map,d=new Set,m=new Map,u=[];for(let c=0;c<n.length;c++){if(c>=s.length){a=c;continue}let g=s[c],T=n[c];if(!T||T.type===ie.AST_NODE_TYPES.SpreadElement){a=c;continue}let y=Rr(T);if(g===void 0){a=c;continue}if(yt(y,g)){T.type===ie.AST_NODE_TYPES.ObjectExpression?(d.add(c),u.push({type:"object",position:c+1})):(m.set(c,y),u.push({type:"simple",position:c+1,value:y}));continue}if(T.type===ie.AST_NODE_TYPES.ObjectExpression&&T.properties.length===0&&typeof g=="object"&&g!==null&&Object.keys(g).length>0){d.add(c),u.push({type:"object",position:c+1});continue}let C=na(y,g);if(C.size>0){let A=typeof g=="object"&&g!==null?Object.keys(g).length:0;if(T.type===ie.AST_NODE_TYPES.ObjectExpression&&T.properties.length===C.size&&T.properties.length===A){d.add(c),u.push({type:"object",position:c+1});continue}else p=!0,l.set(c,C),u.push({type:"partialObject",position:c+1,redundantProperties:Array.from(C)}),a=c}else a=c}if(a<n.length-1||p||d.size>0){let c=function(){let T=[];for(let y of u)if(y.type==="simple")T.push(`Param ${y.position} with value ${JSON.stringify(y.value)}`);else if(y.type==="object")T.push(`Param ${y.position} (object)`);else{let C=y.redundantProperties||[],A=s?s[y.position-1]:void 0;if(typeof A=="object"&&A!==null){let S=A;for(let b of C)if(b in S){let E=Object.getOwnPropertyDescriptor(S,b);E&&T.push(`Param ${y.position} property "${b}" with value ${JSON.stringify(E.value)}`)}}}return{messageId:"redundantParams",data:{details:T.join(", ")}}};var f=c;let g=c();e.report({node:r,messageId:g.messageId,data:g.data,fix(T){let y=[];if(p)for(let[A,S]of l){let b=n[A];if(b&&b.type===ie.AST_NODE_TYPES.ObjectExpression){let E=[];for(let D of b.properties)D.type===ie.AST_NODE_TYPES.Property&&D.key.type===ie.AST_NODE_TYPES.Identifier&&!D.computed&&S.has(D.key.name)||E.push(D);let I=E.map(D=>e.sourceCode.getText(D));y.push(T.replaceText(b,`{ ${I.join(", ")} }`))}}let C=-1;for(let A=n.length-1;A>=0;A--)if(!d.has(A)&&A<=a){C=A;break}if(C<n.length-1)if(C===-1){let A=e.sourceCode.getTokenAfter(r.callee),S=e.sourceCode.getLastToken(r);A&&S&&y.push(T.replaceTextRange([A.range[1],S.range[0]],""))}else{let A=n[C],S=e.sourceCode.getLastToken(r);S&&A&&y.push(T.replaceTextRange([A.range[1],S.range[0]],""))}return y.length>0?y:null}})}}}}});var ge=require("@typescript-eslint/utils");function oa(e){let t=e.parent;for(;t;){if(t.type===ge.AST_NODE_TYPES.AwaitExpression||t.type===ge.AST_NODE_TYPES.MemberExpression&&t.object===e&&t.property.type===ge.AST_NODE_TYPES.Identifier&&t.property.name==="then"||t.type===ge.AST_NODE_TYPES.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===ge.AST_NODE_TYPES.ArrayExpression&&t.parent.type===ge.AST_NODE_TYPES.CallExpression){let o=t.parent;if(o.callee.type===ge.AST_NODE_TYPES.MemberExpression&&o.callee.object.type===ge.AST_NODE_TYPES.Identifier&&o.callee.object.name==="Promise"&&o.callee.property.type===ge.AST_NODE_TYPES.Identifier&&["all","allSettled","race"].includes(o.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function ia(e){let{callee:t}=e;return t.type===ge.AST_NODE_TYPES.Identifier&&t.name==="require"||t.type===ge.AST_NODE_TYPES.MemberExpression&&t.object.type===ge.AST_NODE_TYPES.Identifier&&t.object.name==="require"}var En=v({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(t){oa(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){ia(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});var R=require("@typescript-eslint/utils"),gt=require("zod/v4");var sa=gt.z.object({mainComponentRegex:gt.z.string().optional(),mainComponentSelector:gt.z.string().optional()}),aa=/^[A-Z][A-Za-z0-9]*$/,xn=v({name:"sort-react-components-and-styles",meta:{type:"suggestion",docs:{description:"Sort React components and styles with styles placed above their first usage"},fixable:"code",schema:[k(sa)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let o=e.sourceCode,r=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,i=t.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let n=new Set,a=new Map,p=[],l=[],d=new Set;function m(h){let x=h.node;if(x.type===R.AST_NODE_TYPES.VariableDeclaration){for(let P of x.declarations)if(P.id.type===R.AST_NODE_TYPES.Identifier&&P.id.name===h.name&&P.init)return P.init}if(x.type===R.AST_NODE_TYPES.ExportNamedDeclaration){let P=x.declaration;if(P&&P.type===R.AST_NODE_TYPES.VariableDeclaration){for(let j of P.declarations)if(j.id.type===R.AST_NODE_TYPES.Identifier&&j.id.name===h.name&&j.init)return j.init}}return null}function u(h){let x=new Set;return Re(h,P=>(P.type===R.AST_NODE_TYPES.Identifier&&P.name!=="styled"&&P.name!=="css"&&x.add(P.name),!1),o),x}function f(h){return aa.test(h)}function c(h){if(h.type!==R.AST_NODE_TYPES.CallExpression)return!1;let x=h.callee;return x.type===R.AST_NODE_TYPES.Identifier?x.name==="memo"||x.name==="forwardRef":x.type===R.AST_NODE_TYPES.MemberExpression&&x.property.type===R.AST_NODE_TYPES.Identifier?x.property.name==="memo"||x.property.name==="forwardRef":!1}function g(h){if(h.type===R.AST_NODE_TYPES.JSXElement||h.type===R.AST_NODE_TYPES.JSXFragment)return!0;if(h.type===R.AST_NODE_TYPES.BlockStatement){for(let x of h.body)if(x.type===R.AST_NODE_TYPES.ReturnStatement&&x.argument)return g(x.argument)}if(h.type===R.AST_NODE_TYPES.ArrayExpression){for(let x of h.elements)if(x&&(x.type===R.AST_NODE_TYPES.JSXElement||x.type===R.AST_NODE_TYPES.JSXFragment))return!0}return!1}function T(h){if(h.type!==R.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let x=h.body;if(x.type===R.AST_NODE_TYPES.ArrowFunctionExpression){let P=x.body;if(g(P))return!0}return!1}function y(h){if(h.type===R.AST_NODE_TYPES.TaggedTemplateExpression){let x=h.tag;if(x.type===R.AST_NODE_TYPES.MemberExpression&&x.object.type===R.AST_NODE_TYPES.Identifier&&x.object.name==="styled")return!0;if(x.type===R.AST_NODE_TYPES.CallExpression){let P=x.callee;if(P.type===R.AST_NODE_TYPES.Identifier&&P.name==="styled")return!0}}return!1}function C(h){if(h.type===R.AST_NODE_TYPES.TaggedTemplateExpression){let x=h.tag;if(x.type===R.AST_NODE_TYPES.Identifier&&x.name==="css")return!0}return!1}function A(h,x){if(h.id.type!==R.AST_NODE_TYPES.Identifier)return;let P=h.id.name,j=h.init;if(j){if(y(j)||C(j)){l.push({node:x,name:P});return}if((f(P)||j.type===R.AST_NODE_TYPES.ArrowFunctionExpression)&&(j.type===R.AST_NODE_TYPES.ArrowFunctionExpression||j.type===R.AST_NODE_TYPES.FunctionExpression||c(j))){if(j.type===R.AST_NODE_TYPES.ArrowFunctionExpression||j.type===R.AST_NODE_TYPES.FunctionExpression){if(g(j.body)){n.add(P);return}}else if(c(j)){n.add(P);return}}j.type===R.AST_NODE_TYPES.Identifier&&a.set(P,j.name),f(P)||T(j)&&n.add(P)}}function S(h){return h.type===R.AST_NODE_TYPES.ExportDefaultDeclaration||h.type===R.AST_NODE_TYPES.ExportNamedDeclaration}function b(h){if(h.type===R.AST_NODE_TYPES.FunctionDeclaration)return h.id?h.id.name:null;if(h.type===R.AST_NODE_TYPES.VariableDeclaration){let x=h.declarations[0];if(x&&x.id.type===R.AST_NODE_TYPES.Identifier)return x.id.name}if(h.type===R.AST_NODE_TYPES.ExportDefaultDeclaration){let x=h.declaration;if(x.type===R.AST_NODE_TYPES.FunctionDeclaration)return x.id?x.id.name:"default";if(x.type===R.AST_NODE_TYPES.Identifier)return x.name}if(h.type===R.AST_NODE_TYPES.ExportNamedDeclaration){let x=h.declaration;if(x&&x.type===R.AST_NODE_TYPES.FunctionDeclaration)return x.id?x.id.name:null;if(x&&x.type===R.AST_NODE_TYPES.VariableDeclaration){let P=x.declarations[0];if(P&&P.id.type===R.AST_NODE_TYPES.Identifier)return P.id.name}}return null}function E(h,x){return i?d.has(h):r?r.test(x):S(h)}function I(h){let x=new Set;Re(h.node,P=>{if(P.type===R.AST_NODE_TYPES.Identifier)for(let j of l)j.name===P.name&&(x.add(j.name),(j.firstUsagePosition===void 0||P.range[0]<j.firstUsagePosition)&&(j.firstUsagePosition=P.range[0]));if(P.type===R.AST_NODE_TYPES.JSXElement){let j=P.openingElement;if(j.name.type===R.AST_NODE_TYPES.JSXIdentifier)for(let Y of l)Y.name===j.name.name&&(x.add(Y.name),(Y.firstUsagePosition===void 0||j.name.range[0]<Y.firstUsagePosition)&&(Y.firstUsagePosition=j.name.range[0]))}return!1},o),h.usedStyles=x}function D(h){if(h.type===R.AST_NODE_TYPES.VariableDeclaration){for(let x of h.declarations)A(x,h);return}if(h.type===R.AST_NODE_TYPES.FunctionDeclaration){f(h.id.name)&&g(h.body)&&n.add(h.id.name);return}if(h.type===R.AST_NODE_TYPES.ExportNamedDeclaration&&h.declaration){let x=h.declaration;if(x.type===R.AST_NODE_TYPES.VariableDeclaration){for(let P of x.declarations)A(P,h);return}if(x.type===R.AST_NODE_TYPES.FunctionDeclaration&&x.id){f(x.id.name)&&g(x.body)&&n.add(x.id.name);return}}if(h.type===R.AST_NODE_TYPES.ExportDefaultDeclaration){let x=h.declaration;x.type===R.AST_NODE_TYPES.Identifier&&n.add(x.name),(x.type===R.AST_NODE_TYPES.FunctionDeclaration||x.type===R.AST_NODE_TYPES.ArrowFunctionExpression||x.type===R.AST_NODE_TYPES.FunctionExpression)&&(x.type===R.AST_NODE_TYPES.FunctionDeclaration?x.id?n.add(x.id.name):n.add("default"):g(x.body)&&n.add("default"))}}function M(h,x=new Set){if(n.has(h))return!0;if(x.has(h))return!1;x.add(h);let P=a.get(h);return P?M(P,x):!1}let U={};return i&&(U[i]=h=>{let x=h;for(;x.parent&&x.parent.type!==R.AST_NODE_TYPES.Program;)x=x.parent;x.parent&&(x.type===R.AST_NODE_TYPES.VariableDeclaration||x.type===R.AST_NODE_TYPES.FunctionDeclaration||x.type===R.AST_NODE_TYPES.ExportNamedDeclaration||x.type===R.AST_NODE_TYPES.ExportDefaultDeclaration)&&d.add(x)}),U["Program:exit"]=h=>{let x=0;for(let F of h.body){if(F.type===R.AST_NODE_TYPES.ImportDeclaration){x+=1;continue}break}for(let F of h.body)D(F);for(let F of h.body){let J=b(F);if(J&&M(J)){let L=E(F,J);p.push({node:F,name:J,isMainComponent:L,usedStyles:new Set,isExported:S(F)})}}if(!i&&r&&!p.some(F=>F.isMainComponent))for(let F of p)F.isExported&&(F.isMainComponent=!0);for(let F of p)I(F);let P=new Set;for(let F of l)P.add(F.name);let j=new Map;for(let F=0;F<h.body.length;F+=1){let J=h.body[F];for(let L of l)L.node===J&&j.set(L.name,F)}let Y=new Map;for(let F of l){let J=m(F),L=new Set;if(J){let ae=u(J);for(let ce of ae)P.has(ce)&&ce!==F.name&&L.add(ce)}Y.set(F.name,L)}let q=new Map;for(let F of l){let J=Y.get(F.name);if(!J)continue;let L=j.get(F.name);if(L!==void 0)for(let ae of J){let ce=q.get(ae);(ce===void 0||L<ce)&&q.set(ae,L)}}let ne=[];for(let F of l){if(F.firstUsagePosition===void 0)continue;let J=h.body.indexOf(F.node),L=-1;for(let de of p){if(!de.usedStyles.has(F.name))continue;let be=h.body.indexOf(de.node);(L===-1||be<L)&&(L=be)}let ae=q.get(F.name);if(ae!==void 0&&(L===-1||ae<L)&&(L=ae),L===-1)continue;let ce=-1;for(let de of p){let be=h.body.indexOf(de.node);be<L&&be>ce&&(ce=be)}let he=J<L,Tt=J>ce,Ne=-1,Pn=Y.get(F.name);if(Pn)for(let de of Pn){let be=j.get(de);be!==void 0&&be>Ne&&(Ne=be)}let vr=J>Ne;if(!(he&&Tt&&vr)){let de=ce+1;if(Ne+1>de&&(de=Ne+1),de<x&&(de=x),de>L)continue;ne.push({style:F,targetPosition:de})}}let Q=null;if(p.length>1){let F=p.map(L=>({c:L,idx:h.body.indexOf(L.node)})).sort((L,ae)=>L.idx-ae.idx)[0]?.c,J=p.find(L=>L.isMainComponent)||null;F&&J&&F.node!==J.node&&(Q={component:J,targetBefore:F.node})}if(ne.length>0||Q){let F=ne[0]?.style.node||Q?.component.node||h,J=ne.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:F,messageId:J,fix:Z(ne,Q,h.body)})}},U;function Z(h,x,P){return function*(j){h.sort((q,ne)=>q.targetPosition-ne.targetPosition);for(let{style:q}of h){let ne=o.getCommentsBefore(q.node),Q=q.node.range[0],F=q.node.range[1];ne.length>0&&ne[0]&&(Q=ne[0].range[0]),Q===q.node.range[0]&&o.text.slice(0,Q).trim().length===0&&(Q=0),yield j.removeRange([Q,F])}let Y=new Map;for(let q of h){let ne=Y.get(q.targetPosition)||[];ne.push(q),Y.set(q.targetPosition,ne)}for(let[q,ne]of Y){let Q=P[q];if(!Q)continue;let F=o.getCommentsBefore(Q),J=F.length>0&&F[0]?F[0].range[0]:Q.range[0],L=[];for(let{style:ae}of ne){let ce=o.getCommentsBefore(ae.node),he=o.getText(ae.node);ce.length>0&&(he=`${ce.map(Ne=>o.getText(Ne)).join(`
|
|
36
|
-
`)}
|
|
37
|
-
${he}`),L.push(he)}yield j.insertTextBeforeRange([J,J],`${L.join(`
|
|
38
|
-
|
|
39
|
-
`)}
|
|
40
|
-
|
|
41
|
-
`)}if(x){let{component:q,targetBefore:ne}=x,Q=o.getCommentsBefore(q.node),F=q.node.range[0],J=q.node.range[1];Q.length>0&&Q[0]&&(F=Q[0].range[0]),F===q.node.range[0]&&o.text.slice(0,F).trim().length===0&&(F=0);let L=o.getCommentsBefore(ne),ae=L.length>0&&L[0]?L[0].range[0]:ne.range[0],ce=(()=>{let he=o.getText(q.node);return Q.length>0&&(he=`${Q.map(Ne=>o.getText(Ne)).join(`
|
|
42
|
-
`)}
|
|
43
|
-
${he}`),he})();yield j.removeRange([F,J]),yield j.insertTextBeforeRange([ae,ae],`${ce}
|
|
44
|
-
`)}}}}});var fe=require("@typescript-eslint/utils"),qe=require("zod/v4");var pa=qe.z.object({functions:qe.z.array(qe.z.string()).optional(),selectors:qe.z.array(qe.z.string()).optional()});function wr(e){let t=e.parent;for(;t;){if(t.type===fe.AST_NODE_TYPES.FunctionDeclaration||t.type===fe.AST_NODE_TYPES.FunctionExpression||t.type===fe.AST_NODE_TYPES.ArrowFunctionExpression)return!0;t=t.parent}return!1}function Fr(e){if(e.type===fe.AST_NODE_TYPES.TaggedTemplateExpression){let{tag:o}=e;return o.type===fe.AST_NODE_TYPES.Identifier?o.name:o.type===fe.AST_NODE_TYPES.MemberExpression&&o.property.type===fe.AST_NODE_TYPES.Identifier?o.property.name:null}let{callee:t}=e;return t.type===fe.AST_NODE_TYPES.Identifier?t.name:t.type===fe.AST_NODE_TYPES.MemberExpression&&t.property.type===fe.AST_NODE_TYPES.Identifier?t.property.name:null}var hn=v({name:"require-lazy-execution",meta:{type:"problem",docs:{description:"Require certain function calls to be executed lazily (inside functions, not at module level)"},messages:{moduleLevel:'Function "{{ functionName }}" must only be called inside functions or getters, not at module level'},schema:[k(pa)]},defaultOptions:[{functions:[],selectors:[]}],create(e){let[t]=e.options,o=new Set(t.functions??[]),r=t.selectors??[];function i(n){if(wr(n))return;let a=Fr(n);a&&o.has(a)&&e.report({node:n,messageId:"moduleLevel",data:{functionName:a}})}let s={CallExpression(n){n.type===fe.AST_NODE_TYPES.CallExpression&&i(n)},TaggedTemplateExpression(n){n.type===fe.AST_NODE_TYPES.TaggedTemplateExpression&&i(n)}};for(let n of r)s[n]=a=>{if(a.type!==fe.AST_NODE_TYPES.CallExpression&&a.type!==fe.AST_NODE_TYPES.TaggedTemplateExpression||wr(a))return;let p=Fr(a);p&&e.report({node:a,messageId:"moduleLevel",data:{functionName:p}})};return s}});var Se=require("@typescript-eslint/utils");function la(e,t){let{body:o}=e;if(o.type!==Se.AST_NODE_TYPES.BlockStatement)return t.getText(o);let r=o.body[0];return!r||r.type!==Se.AST_NODE_TYPES.ReturnStatement?"":r.argument?t.getText(r.argument):"undefined"}function ca(e){let t=e.parent;if(t.type!==Se.AST_NODE_TYPES.ReturnStatement)return null;let o=t.parent;if(o.type!==Se.AST_NODE_TYPES.BlockStatement||o.body.length!==1)return null;let r=o.parent;return r.type!==Se.AST_NODE_TYPES.FunctionDeclaration&&r.type!==Se.AST_NODE_TYPES.ArrowFunctionExpression&&r.type!==Se.AST_NODE_TYPES.FunctionExpression?null:{parentFunction:r,returnStatement:t}}var bn=v({name:"no-unnecessary-iife",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary immediately invoked function expressions"},messages:{unnecessaryIife:"Unnecessary IIFE. Can be simplified to the returned expression."},schema:[]},defaultOptions:[],create(e){let t=e.sourceCode;return{CallExpression(o){let{callee:r,arguments:i}=o;if(i.length>0||r.type!==Se.AST_NODE_TYPES.FunctionExpression&&r.type!==Se.AST_NODE_TYPES.ArrowFunctionExpression||r.async||r.params.length>0)return;let{body:s}=r;if(s.type===Se.AST_NODE_TYPES.BlockStatement){if(s.body.length!==1){let l=ca(o);if(l){if(t.getCommentsInside(r).length>0)return;let m=t.getText(s);e.report({node:o,messageId:"unnecessaryIife",fix:u=>{let{parentFunction:f}=l;return f.body.type!==Se.AST_NODE_TYPES.BlockStatement?null:u.replaceText(f.body,m)}})}return}let p=s.body[0];if(!p||p.type!==Se.AST_NODE_TYPES.ReturnStatement)return}if(t.getCommentsInside(r).length>0)return;let a=la(r,t);e.report({node:o,messageId:"unnecessaryIife",fix:p=>p.replaceText(o,a)})}}}});var Me=require("zod/v4");var ua="no-restricted-comments",fa=Me.z.object({regex:Me.z.string().optional(),includes:Me.z.string().optional(),message:Me.z.string().optional(),autoFix:Me.z.boolean().optional()}),ma=Me.z.object({patterns:Me.z.array(fa)}),Cn=v({name:ua,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[k(ma)],messages:{restrictedComment:"Comment matches restricted pattern '{{pattern}}'",restrictedCommentWithMessage:"{{message}}",removeComment:"Remove this comment"}},defaultOptions:[{patterns:[]}],create(e,[t]){let o=e.sourceCode,r=new Map;function i(n){let a=r.get(n);return a||(a=new RegExp(n),r.set(n,a)),a}function s(n,a){return a.regex?i(a.regex).test(n):a.includes?n.includes(a.includes):!1}return{Program(){let n=o.getAllComments();for(let p of n)for(let l of t.patterns)if(s(p.value,l)){let m=function(u){return u.remove(p)};var a=m;let d=l.regex??l.includes??"";l.message?e.report({loc:p.loc,messageId:"restrictedCommentWithMessage",data:{message:l.message},fix:l.autoFix?m:void 0,suggest:l.autoFix?void 0:[{messageId:"removeComment",fix:m}]}):e.report({loc:p.loc,messageId:"restrictedComment",data:{pattern:d},fix:l.autoFix?m:void 0,suggest:l.autoFix?void 0:[{messageId:"removeComment",fix:m}]});break}}}}});var St=require("@typescript-eslint/utils"),Ze=require("zod/v4");var da=Ze.z.object({allow:Ze.z.record(Ze.z.string(),Ze.z.array(Ze.z.string())).optional()}),An=v({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[k(da)],messages:{noDataAttributesOnComponents:"Avoid using data-* attributes on custom components. Use regular props instead or apply data attributes to the underlying DOM element."}},defaultOptions:[{}],create(e,[t]){let o=t.allow??{};function r(n){let a=n.charAt(0);return a===a.toUpperCase()&&a!==a.toLowerCase()}function i(n){return n.type===St.AST_NODE_TYPES.JSXIdentifier?{name:n.name,isCustom:r(n.name)}:n.type===St.AST_NODE_TYPES.JSXMemberExpression?{name:"",isCustom:!0}:{name:`${n.namespace.name}:${n.name.name}`,isCustom:!1}}function s(n,a){let p=o[n];return p?p.includes(a):!1}return{JSXAttribute(n){if(n.name.type!==St.AST_NODE_TYPES.JSXIdentifier)return;let a=n.name.name;if(!a.startsWith("data-"))return;let p=i(n.parent.name);!p||!p.isCustom||p.name&&s(p.name,a)||e.report({node:n,messageId:"noDataAttributesOnComponents"})}}}});var Le=require("@typescript-eslint/utils"),_e=require("zod/v4");var ya=_e.z.object({fn:_e.z.string().optional(),selector:_e.z.string().optional(),commentPrefix:_e.z.string(),message:_e.z.string().optional()}),ga=_e.z.object({matches:_e.z.array(ya)}),In=v({name:"require-usage-explanation",meta:{type:"problem",docs:{description:"Require explanatory comments with a specific prefix above matched code patterns"},schema:[k(ga)],messages:{default:"{{message}}"}},defaultOptions:[{matches:[]}],create(e,[t]){let o=e.sourceCode,r={},i=[];function s(u){let f=u;for(;f.parent;){let c=f.parent.type;if(c===Le.AST_NODE_TYPES.Program||c===Le.AST_NODE_TYPES.BlockStatement||c===Le.AST_NODE_TYPES.SwitchCase)return f;f=f.parent}}function n(u,f){for(let c of u){let g=c.value.trim();if(g.startsWith(f)&&g.slice(f.length).trim().length>0)return!0}return!1}function a(u){let{callee:f}=u;if(f.type===Le.AST_NODE_TYPES.Identifier)return f.name;if(f.type===Le.AST_NODE_TYPES.MemberExpression&&f.property.type===Le.AST_NODE_TYPES.Identifier)return f.property.name}function p(u,f,c){let g=`Add a comment with prefix "${u}" to explain why "${f}" is being used.`;return c?`${g} ${c}`:g}function l(u,f){let c=s(u);if(!c)return!1;let g=u;for(;g!==c&&g.parent;){let y=o.getCommentsBefore(g);if(n(y,f))return!0;g=g.parent}let T=o.getCommentsBefore(c);return!!n(T,f)}function d(u,f){l(u,f.commentPrefix)||e.report({node:u,messageId:"default",data:{message:p(f.commentPrefix,f.label,f.message)}})}function m(u,f){let c=r[u];c?r[u]=g=>{c(g),f(g)}:r[u]=f}for(let u of t.matches){if(u.fn){let f=u.fn,c={commentPrefix:u.commentPrefix,label:f,message:u.message};i.push(g=>{a(g)===f&&d(g,c)})}if(u.selector){let f={commentPrefix:u.commentPrefix,label:u.selector,message:u.message};m(u.selector,c=>{d(c,f)})}}return i.length>0&&m("CallExpression",u=>{if(u.type===Le.AST_NODE_TYPES.CallExpression)for(let f of i)f(u)}),r}});var Or={[Wt.name]:Wt.rule,[At.name]:At.rule,[Ct.name]:Ct.rule,"require-description":Pr.rule,[It.name]:It.rule,[Nt.name]:Nt.rule,[Yt.name]:Yt.rule,[Et.name]:Et.rule,[bt.name]:bt.rule,[Dt.name]:Dt.rule,[He.name]:He.rule,[Gt.name]:Gt.rule,[Ot.name]:Ot.rule,[Pt.name]:Pt.rule,[kt.name]:kt.rule,[ht.name]:ht.rule,[tn.name]:tn.rule,[en.name]:en.rule,[on.name]:on.rule,[ln.name]:ln.rule,[Lt.name]:Lt.rule,[_t.name]:_t.rule,[Jt.name]:Jt.rule,[Vt.name]:Vt.rule,[$t.name]:$t.rule,[Ut.name]:Ut.rule,[Zt.name]:Zt.rule,[Mt.name]:Mt.rule,[jt.name]:jt.rule,[dn.name]:dn.rule,[Bt.name]:Bt.rule,[cn.name]:cn.rule,[fn.name]:fn.rule,[yn.name]:yn.rule,[gn.name]:gn.rule,[Sn.name]:Sn.rule,[Tn.name]:Tn.rule,[En.name]:En.rule,[xn.name]:xn.rule,[hn.name]:hn.rule,[He.name]:He.rule,[bn.name]:bn.rule,[Cn.name]:Cn.rule,[An.name]:An.rule,[In.name]:In.rule};var Dr={rules:Or},Sa=Dr;0&&(module.exports={extendedLintPlugin});
|
|
11
|
+
`,le=T.split(se),he=le.map((M,U)=>U!==le.length-1&&M===_+W?"":M).join(xe);if(pe!==he)return{node:o,messageId:"improperlyIndented",fix:M=>pe.split(x).map((U,Ee)=>{let q=o.quasis[Ee];return q?M.replaceTextRange([q.range[0]+1,q.range[1]-(q.tail?1:2)],U):[]}).flat()}}return{TemplateLiteral(o){if(!d(o))return;let x=C(o);if(x)return e.report(x)}}}});var ie=require("@typescript-eslint/types");function rt(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function nt(e){let t=e.parent;return t?.type===ie.AST_NODE_TYPES.NewExpression&&t.callee.type===ie.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var ae=O({name:"use-top-level-regex",meta:{type:"suggestion",docs:{description:"Require regex literals to be declared at the top level to avoid performance issues"},messages:{regexShouldBeTopLevel:"Move this regex literal to the top level to avoid creating new RegExp objects on each function call."},schema:[],hasSuggestions:!1},defaultOptions:[],create(e){function t(r){rt(r)||nt(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var ye={[Z.name]:Z.rule,[K.name]:K.rule,[G.name]:G.rule,[Q.name]:Q.rule,[ee.name]:ee.rule,[te.name]:te.rule,[re.name]:re.rule,[ne.name]:ne.rule,[oe.name]:oe.rule,[ae.name]:ae.rule};var Se={rules:ye},st=Se;0&&(module.exports={extendedLintPlugin});
|
package/dist/extended-lint.mjs
CHANGED
|
@@ -1,44 +1,11 @@
|
|
|
1
|
-
import{AST_NODE_TYPES as
|
|
2
|
-
`);if(
|
|
3
|
-
`)||o.getCommentsInside(
|
|
4
|
-
`,o.range[1]);return(r!==-1?r:t.text.length)-o.range[1]}function kr(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var ut={name:hn,rule:Dr};import{AST_NODE_TYPES as He}from"@typescript-eslint/utils";import{z as _e}from"zod/v4";var jr=_e.object({functions:_e.array(_e.string().or(_e.object({name:_e.string(),message:_e.string()})))});function Mr(e){if(e.type===He.Identifier)return e.name;if(e.type===He.MemberExpression&&e.property.type===He.Identifier&&e.object.type===He.Identifier)return`${e.object.name}.${e.property.name}`}var ft=D({name:"no-call-with-explicit-generics",meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)",noExplicitGenericsCustom:"{{ message }}"},schema:[k(jr)]},defaultOptions:[{functions:[]}],create(e,[t]){let o=new Map,r=new Map;for(let s of t.functions){let n=typeof s=="string"?s:s.name,a=typeof s=="string"?void 0:s.message;n.startsWith("*.")?r.set(n.slice(2),a):o.set(n,a)}function i(s){if(o.has(s))return{message:o.get(s)};let n=s.indexOf(".");if(n!==-1){let a=s.slice(n+1);if(r.has(a))return{message:r.get(a)}}}return{CallExpression(s){let n=Mr(s.callee);if(!n||!s.typeArguments)return;let a=i(n);a&&(a.message?e.report({node:s,messageId:"noExplicitGenericsCustom",data:{message:a.message}}):e.report({node:s,messageId:"noExplicitGenerics",data:{functionName:n}}))}}}});import{AST_NODE_TYPES as Ie,ESLintUtils as Lr}from"@typescript-eslint/utils";var _r=Lr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),bn="no-call-with-inferred-generics",$r=_r({name:bn,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics",typeOfUsedInGenerics:"Function '{{ functionName }}' should not be called with 'typeof' in generics",unknownUsedInGenerics:"Function '{{ functionName }}' should not be called with 'unknown' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}},disallowTypeOf:{type:"boolean"},disallowUnknown:{type:"boolean"}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let o=new Map(t.functions.map(s=>[s.name,s])),r=t.functions.some(s=>s.disallowTypeOf),i=new Set;return{...r&&{TSTypeAliasDeclaration(s){s.typeAnnotation.type===Ie.TSTypeQuery&&i.add(s.id.name)}},CallExpression(s){let{callee:n}=s;if(n.type!==Ie.Identifier)return;let a=o.get(n.name);if(!a)return;let{minGenerics:p=1,allowAny:l,disallowTypes:d=t.disallowTypes,disallowTypeOf:m,disallowUnknown:u}=a;(s.typeArguments?.params.length||0)<(p||0)&&e.report({node:s,messageId:"missingGenericDeclaration",data:{functionName:n.name,minGenerics:p||0}}),!(l&&!d)&&(s.typeArguments?.params.some(c=>!l&&c.type===Ie.TSAnyKeyword||d&&c.type===Ie.TSTypeReference&&c.typeName.type===Ie.Identifier&&d.includes(c.typeName.name))&&e.report({node:s,messageId:"anyUsedInGenerics",data:{functionName:n.name}}),u&&s.typeArguments?.params.some(c=>c.type===Ie.TSUnknownKeyword)&&e.report({node:s,messageId:"unknownUsedInGenerics",data:{functionName:n.name}}),m&&s.typeArguments?.params.some(c=>c.type===Ie.TSTypeQuery||c.type===Ie.TSTypeReference&&c.typeName.type===Ie.Identifier&&i.has(c.typeName.name))&&e.report({node:s,messageId:"typeOfUsedInGenerics",data:{functionName:n.name}}))}}}}),mt={name:bn,rule:$r};import{ESLintUtils as zr}from"@typescript-eslint/utils";var Ur=zr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),In="no-commented-out-code",Jr=["function ","class ","interface ","enum ","namespace ","import ","export ","const ","let ","var ","return ","throw ","try {","catch (","finally {","async ","await ","case ","switch (","while (","for (","default:"],Vr=/^\s*return\s+/,Xr=/^\s*type\s+[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*\s*(?:=|<)/u,Wr=/^\s*(?:break|continue)(?:;|\s+[A-Za-z_$][\w$]*;?)?\s*$/,Br=/\w=("|'|`)/,Yr=/\w+:\s*('|"|`)/,qr=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,Zr=/\w+-\w+:/,Gr=/\w+_\w+:/,Hr=/\?\s+\w/,Kr=/:\s+\w/,Qr=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,eo=/^\s*\d+[,}]/,to=/^\s*\[[^\]]*\][,}]/,no=/^\s*\{[^}]*\}[,}]/,ro=/\.\w+\(/,oo=/\[\w+\]/,io=/^\s*(['"`]).+?\1\s*:/,so=/^<[A-Z]\w*(\s|>|\/)/,ao=/^<[a-z]+(\s|>|\/)/,po=/<[A-Z]\w*(\s.*)?>/,lo=/<\/[A-Z]\w*>/,co=/<[a-z]+(\s.*)?>/,uo=/<\/[a-z]+>/,fo=/^\s*[*\s]*$/,mo=/^[a-zA-Z]/,yo=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,go=/^[a-z][A-Za-z0-9_/-]*:\s+[A-Za-z][\w'-]*(?:\s+[A-Za-z][\w'-]*){2,}/,So=/\s\([A-Za-z][\w\s,.'/-]*\)/g,To=/```[\s\S]*?```/g,Eo=/`[^`]*`/g,Cn=/[a-zA-Z0-9]/,xo=/\.[A-Za-z_][A-Za-z0-9_]*\(/,ho=/[{}[\]()`=<>]/,bo=/:\s*(['"`[{(]|\w+\s*=>)/,Co=/\bif\s*\(|\belse\b|=>/,te={returnStatement:Vr,typeAliasDeclaration:Xr,stringAssignment:Br,objectPropertyWithQuotes:Yr,computedPropertyAssignment:qr,kebabCaseProperty:Zr,snakeCaseProperty:Gr,ternaryOperator:Hr,colonWithWord:Kr,quotedString:Qr,numberWithComma:eo,arrayWithComma:to,objectWithComma:no,methodCall:ro,arrayAccess:oo,quotedPropertyKey:io,jsxSelfClosing:so,jsxElement:ao,jsxOpeningTag:po,jsxClosingTag:lo,htmlOpeningTag:co,htmlClosingTag:uo,jsdocComment:fo};function Ao(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&mo.test(r)&&r.includes(" "))return!0}let t=e.trim();if(t.length===0||xo.test(t))return!1;let o=t.includes("(")?t.replace(So,""):t;return ho.test(o)||bo.test(t)||Co.test(t)?!1:!!(t.includes(":")&&(yo.test(t)||go.test(t)))}var Io=[") {","return;",te.returnStatement,te.typeAliasDeclaration,Wr,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",te.stringAssignment,");",te.objectPropertyWithQuotes,te.computedPropertyAssignment,te.kebabCaseProperty,te.snakeCaseProperty,"&&","||","()",te.ternaryOperator,te.colonWithWord,te.quotedString,te.numberWithComma,te.arrayWithComma,te.objectWithComma,te.methodCall,te.arrayAccess,"?.(","??","=>",te.quotedPropertyKey],Po=["/>","</",te.jsxSelfClosing,te.jsxElement,te.jsxOpeningTag,te.jsxClosingTag,te.htmlOpeningTag,te.htmlClosingTag],An=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint","cspell:","spell-checker:"],No=Ur({name:In,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(r,i){if(r.startsWith("/"))return!1;let s=r.trimStart();if(r.startsWith("*")||s.startsWith("eslint-disable")||r.includes("@deprecated")||r.includes("@example")||r.includes("@param")||r.includes("@returns")||r.includes("@throws")||r.includes("typescript-eslint")||r.includes("@ts-")||r.includes("prettier-ignore")||te.jsdocComment.test(r))return!1;for(let n of An)if(s.startsWith(n))return!1;if(r.includes("https://")||Ao(s))return!1;if(i==="Block"){for(let n of Po)if(typeof n=="string"){if(r.includes(n))return{wrongPattern:n}}else if(n.test(r))return{wrongPattern:`regex(${n.toString()})`};return!1}for(let n of Jr)if(s.startsWith(n))return{wrongPattern:n};for(let n of Io)if(typeof n=="string"){if(r.includes(n))return{wrongPattern:n}}else if(n.test(r))return{wrongPattern:`regex(${n.toString()})`};return!1}function o(r,i){let s=r,n=s.trim();if(n.startsWith("`")&&(n.endsWith("`,")||n.endsWith("`;")||n.endsWith("`")))return s;if(i==="Block"&&s.includes("```")){let l=s.split(To);l.some(m=>Cn.test(m))&&(s=l.join(""))}if(!s.includes("`"))return s;let a=s.split(Eo);return a.some(l=>Cn.test(l))?a.join(""):s}return{Program(){let i=e.sourceCode.getAllComments();for(let s of i){let n=o(s.value,s.type),a=t(n,s.type);a&&e.report({node:s,messageId:"commentedOutCode",data:{wrongPattern:a.wrongPattern,allowedPrefixes:An.join(", ")}})}}}}}),dt={name:In,rule:No};import{ESLintUtils as Ro,TSESTree as wo}from"@typescript-eslint/utils";var Fo=Ro.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pn="no-default-export",Oo=Fo({name:Pn,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let o of t.specifiers)o.exported.type===wo.AST_NODE_TYPES.Identifier&&o.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),yt={name:Pn,rule:Oo};import{ESLintUtils as Do}from"@typescript-eslint/utils";var vo=Do.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nn="no-leaked-text-in-jsx",ko=[",",";","[","]","(",")"],jo=vo({name:Nn,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let o=t.value.trim();if(!o)return;let r="";ko.includes(o)?r=o:o.includes("&&")?r="&&":o.includes("||")?r="||":o.endsWith("? (")&&(r="? ("),r&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:r}})}}}}),gt={name:Nn,rule:jo};import{AST_NODE_TYPES as Xe,ESLintUtils as Mo}from"@typescript-eslint/utils";var Lo=Mo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wn="no-non-camel-case-functions",_o=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Rn(e){if(e.typeName.type!==Xe.TSQualifiedName)return!1;let{left:t,right:o}=e.typeName;return t.type===Xe.Identifier&&t.name==="JSX"&&o.name==="Element"}var $o=Lo({name:wn,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!_o.test(t.id.name)){let o=t.returnType?.typeAnnotation;if(o&&(o.type===Xe.TSTypeReference?Rn(o):o.type===Xe.TSUnionType&&o.types.some(i=>i.type===Xe.TSTypeReference&&Rn(i))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),St={name:wn,rule:$o};import{ESLintUtils as Uo,TSESTree as H}from"@typescript-eslint/utils";import{AST_NODE_TYPES as Fn}from"@typescript-eslint/utils";function $e(e,t,o=1/0){if(o!==0&&e.parent)return e.type===t?e:$e(e.parent,t,o===1/0?o:o-1)}function*Tt(e){yield e,e.parent&&(yield*Tt(e.parent))}function Et(e,t){for(let o of e){let r=t(o);if(r!=null&&r!==!1)return r}}function Dn(e,t,o){let i=o.getDeclaredVariables(e).find(s=>s.name===t||s.identifiers[0]?.parent.type===Fn.Property&&s.identifiers[0].parent.key.type===Fn.Identifier&&s.identifiers[0].parent.key.name===t);return i?i.references.filter(s=>!s.init):[]}function On(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function zo(e,t){return e[t]}function Pe(e,t,o){let r=o.visitorKeys,i=new Set;function s(n){if(i.has(n))return!1;if(i.add(n),t(n)===!0)return!0;let p=r[n.type];if(p)for(let l of p){let d=zo(n,l);if(d){if(Array.isArray(d)){for(let m of d)if(On(m)&&s(m))return!0}else if(On(d)&&s(d))return!0}}return!1}s(e)}var Jo=Uo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vn="no-optional-root-props",Vo=Jo({name:vn,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(r){let s=e.sourceCode.getDeclaredVariables(r)[0];if(!s||s.references.length!==1)return!1;let n=s.references[0];if(!n)return!1;for(let a of Tt(n.identifier)){if("returnType"in a||a.type===H.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let p=a.parent;if(!p)return!1;if(p.type===H.AST_NODE_TYPES.TSTypeParameterInstantiation&&p.parent.type===H.AST_NODE_TYPES.TSTypeReference&&p.parent.typeName.type===H.AST_NODE_TYPES.Identifier&&p.parent.typeName.name==="FC"){let d=$e(p.parent.parent,H.AST_NODE_TYPES.VariableDeclaration,4);if(!d)return!1;let m=Ke(d,e.sourceCode);return m?!(m.parent.type===H.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===H.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(a.type===H.AST_NODE_TYPES.AssignmentPattern)return!1;if(p.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let l=$e(p,H.AST_NODE_TYPES.VariableDeclaration);return l?!!Ke(l,e.sourceCode):!1}if(p.type===H.AST_NODE_TYPES.FunctionDeclaration)return!!Ke(p,e.sourceCode)}return!1}function o(r){r.key.type!==H.AST_NODE_TYPES.Identifier||!r.optional||e.report({node:r.key,messageId:"optionalNotAllowed",data:{propertyName:r.key.name},suggest:[{messageId:"suggestion",fix:i=>{let s=$e(r,H.AST_NODE_TYPES.TSPropertySignature);if(!s)return null;let n=e.sourceCode.getText(s);return i.replaceText(s,n.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(r){if(r.typeAnnotation.type===H.AST_NODE_TYPES.TSTypeLiteral&&!(Qe(r)||!t(r)))for(let i of r.typeAnnotation.members)i.type===H.AST_NODE_TYPES.TSPropertySignature&&o(i)},TSInterfaceDeclaration(r){if(!(Qe(r)||!t(r)))for(let i of r.body.body)i.type===H.AST_NODE_TYPES.TSPropertySignature&&o(i)},TSTypeReference(r){if(r.typeName.type!==H.AST_NODE_TYPES.Identifier||r.typeName.name!=="FC"||!r.typeArguments?.params[0])return;let i=r.typeArguments.params[0];if(i.type!==H.AST_NODE_TYPES.TSTypeLiteral)return;let s=$e(r.parent,H.AST_NODE_TYPES.VariableDeclaration,4);if(!s)return;let n=Ke(s,e.sourceCode);if(!(!n||n.parent.type===H.AST_NODE_TYPES.CallExpression&&n.parent.callee.type===H.AST_NODE_TYPES.Identifier&&n.parent.callee.name==="memo"))for(let p of i.members)p.type===H.AST_NODE_TYPES.TSPropertySignature&&o(p)}}}});function Qe(e){return e?e.parent?.type===H.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===H.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Ke(e,t){if(Qe(e))return;let o;if(e.type===H.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===H.AST_NODE_TYPES.Identifier&&(o=e.declarations[0].id)}else{if(!e.id)return;o=e.id}if(!o)return;let r=t.getScope(e);e.type===H.AST_NODE_TYPES.FunctionDeclaration&&r.upper&&(r=r.upper);let i=r.variables.find(n=>n.identifiers.includes(o));if(!i)return;let s=i.references.filter(n=>n.identifier!==o);if(!(s.length!==1||!s[0])&&!Qe(s[0].identifier.parent.parent))return s[0].identifier}var xt={name:vn,rule:Vo};import{AST_NODE_TYPES as De}from"@typescript-eslint/utils";var We=D({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let t=new Set;function o(i){return i?i.type===De.Identifier?t.has(i.name):i.type===De.MemberExpression?o(i.object):!1:!1}function r(i){return i.type!==De.TSTypeReference||i.typeArguments?!1:i.typeName.type===De.Identifier&&t.has(i.typeName.name)}return{ImportDeclaration(i){for(let s of i.specifiers)t.add(s.local.name)},ExportNamedDeclaration(i){if(i.source){e.report({node:i,messageId:"noReexport"});return}if(i.declaration?.type===De.VariableDeclaration)for(let s of i.declaration.declarations)o(s.init)&&e.report({node:i,messageId:"noReexport"});i.declaration?.type===De.TSTypeAliasDeclaration&&r(i.declaration.typeAnnotation)&&e.report({node:i,messageId:"noReexport"}),i.specifiers.length>0&&e.report({node:i,messageId:"noReexport"})},ExportDefaultDeclaration(i){i.declaration.type===De.Identifier&&t.has(i.declaration.name)&&e.report({node:i,messageId:"noReexport"})},ExportAllDeclaration(i){e.report({node:i,messageId:"noReexport"})}}}});import{ESLintUtils as Xo}from"@typescript-eslint/utils";import ht from"path";import{z as we}from"zod/v4";var Wo=Xo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),kn="no-relative-imports",Bo=we.object({find:we.string(),replacement:we.string()}),Yo=we.object({aliases:we.array(Bo),rootDir:we.string().optional(),allowNotFoundAliases:we.boolean().optional(),_dev_simulateFileName:we.string().optional()}),qo=Wo({name:kn,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[k(Yo)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let o=t._dev_simulateFileName??e.filename;function r(n){return n.startsWith(".")||n.startsWith("..")}function i(n,a){let p=ht.dirname(a);return ht.resolve(p,n)}function s(n){let a=t.rootDir??process.cwd(),p=ht.relative(a,n);if(p.startsWith("."))return null;p.startsWith("/")||(p=`/${p}`);for(let{find:l,replacement:d}of t.aliases)if(p.startsWith(d)){let m=p.replace(d,l);return{alias:l,newPath:m}}return null}return{ImportDeclaration(n){let a=n.source.value;if(!r(a))return;let p=i(a,o),l=s(p);!l&&t.allowNotFoundAliases||e.report({node:n,messageId:l?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:l?.alias},fix:l?d=>d.replaceText(n.source,`'${l.newPath}'`):void 0})}}}}),bt={name:kn,rule:qo};import{AST_NODE_TYPES as ne}from"@typescript-eslint/utils";import{z as jn}from"zod/v4";var Zo=jn.object({customMessage:jn.string().optional()}),Ct=D({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[k(Zo)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function o(r){switch(r.type){case ne.Literal:return!0;case ne.ObjectExpression:return r.properties.every(i=>i.type===ne.Property?i.computed||i.value.type===ne.Identifier&&i.key.type===ne.Identifier&&i.key.name===i.value.name?!1:o(i.value):!1);case ne.ArrayExpression:return r.elements.every(i=>i?i.type===ne.SpreadElement?!1:o(i):!0);case ne.TemplateLiteral:return r.expressions.length===0;case ne.ConditionalExpression:case ne.LogicalExpression:case ne.BinaryExpression:case ne.UnaryExpression:case ne.CallExpression:case ne.MemberExpression:case ne.Identifier:case ne.ArrowFunctionExpression:case ne.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(r){if(r.name.type===ne.JSXIdentifier&&r.name.name==="style"&&r.value){let i=null;r.value.type===ne.JSXExpressionContainer?r.value.expression.type!==ne.JSXEmptyExpression&&(i=r.value.expression):r.value.type===ne.Literal&&(i=r.value),i&&o(i)&&e.report({node:r,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});import{AST_NODE_TYPES as et}from"@typescript-eslint/utils";import*as ve from"zod/v4";var Go=ve.object({alternativeMsgs:ve.object({inArrayFind:ve.string().optional(),inArrayFilter:ve.string().optional()}).optional(),__dev_simulateFileName:ve.string().optional()});function Ho(e){return e.typeAnnotation.type!==et.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Ko=/(typeGuards|type-guards)\.(ts|tsx)$/;function Qo(e){return Ko.test(e)}function ei(e){let t=e.parent;for(;t;){if(t.type===et.CallExpression&&t.callee.type===et.MemberExpression&&t.callee.property.type===et.Identifier){let o=t.callee.property.name;if(o==="filter"||o==="find")return{method:o}}t=t.parent}return null}var At=D({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[k(Go)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let o=t.__dev_simulateFileName??e.filename;if(Qo(o))return{};function r(i){if(!Ho(i))return;let s=ei(i);if(t.alternativeMsgs&&s){let n=s.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(n){let a=s.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:i,messageId:a,data:{message:n}});return}}e.report({node:i,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":r,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":r,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":r}}});import{AST_NODE_TYPES as ze}from"@typescript-eslint/utils";var ti="no-unnecessary-async-on-jsx-props";function ni(e){if(e.body.type!==ze.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let o=t[0];return!o||o.type!==ze.ExpressionStatement?!1:o.expression.type===ze.AwaitExpression}var It=D({name:ti,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(o){ni(o)&&e.report({node:o,messageId:"unnecessaryAsyncInJsxProp",fix(r){let i=e.sourceCode,s=[],n=i.getFirstToken(o,p=>p.value==="async");if(n){let p=i.getTokenAfter(n);p?s.push(r.replaceTextRange([n.range[0],p.range[0]],"")):s.push(r.remove(n))}function a(p){if(p.type===ze.AwaitExpression){let l=i.getFirstToken(p);if(l&&l.value==="await"){let d=i.getTokenAfter(l);d?s.push(r.replaceTextRange([l.range[0],d.range[0]],"")):s.push(r.remove(l))}}if(p.type===ze.BlockStatement)for(let l of p.body)a(l);else p.type===ze.ExpressionStatement&&a(p.expression)}return a(o.body),s}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});import{AST_NODE_TYPES as ye}from"@typescript-eslint/utils";import*as tt from"zod/v4";var ri=tt.object({ignoreWithDescription:tt.string().optional()}),Pt=D({name:"no-unnecessary-describe",meta:{type:"suggestion",docs:{description:"Disallow unnecessary describe blocks that wrap all tests in a file"},messages:{unnecessaryDescribe:"Describe blocks that solely wrap all tests in the file are unnecessary, they just add unnecessary nesting to the code. The file itself should be enough to group tests. Remove it.",removeDescribe:"Remove the describe block"},hasSuggestions:!0,schema:[k(ri)]},defaultOptions:[{}],create(e,[t]){let o=e.getSourceCode(),r=o.ast;function i(p){let l=p.arguments[0];return l&&l.type===ye.Literal&&typeof l.value=="string"?l.value:null}function s(p){return!p||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(p)}function n(p){return p.length!==1?!1:r.body.filter(d=>{if(d.type===ye.ExpressionStatement){let m=d.expression;if(m.type===ye.CallExpression&&m.callee.type===ye.Identifier){let u=m.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(u)}}return!1}).length===0}function a(p){let l=p.arguments[1];if(l&&(l.type===ye.FunctionExpression||l.type===ye.ArrowFunctionExpression)&&l.body.type===ye.BlockStatement){let d=l.body.body;return d.length===0?"":d.map(u=>o.text.slice(u.range[0],u.range[1])).join(`
|
|
5
|
-
|
|
6
|
-
`)}return""}return{Program(){let p=[];for(let u of r.body)u.type===ye.ExpressionStatement&&u.expression.type===ye.CallExpression&&u.expression.callee.type===ye.Identifier&&u.expression.callee.name==="describe"&&u.expression.arguments.length===2&&p.push(u.expression);if(!n(p))return;let[l]=p;if(!l)return;let d=i(l);if(s(d))return;let m=r.body.find(u=>u.type===ye.ExpressionStatement&&u.expression===l);!m||m.type!==ye.ExpressionStatement||e.report({node:l,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(u){let f=a(l);return f?u.replaceText(m,f):null}}]})}}}});import{AST_NODE_TYPES as nt}from"@typescript-eslint/utils";import*as be from"zod/v4";var oi=be.object({methods:be.union([be.array(be.string()),be.literal("array")])}),Nt=D({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[k(oi)]},defaultOptions:[{methods:"array"}],create(e,[t]){let o=t.methods,r=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function i(a){return Array.isArray(o)?o.includes(a):r.has(a)}function s(a){let{callee:p}=a;if(p.type===nt.MemberExpression){let l=p.property;if(l.type===nt.Identifier)return l.name}return null}function n(a,p){if(a.type!==nt.Identifier||!a.typeAnnotation)return;let l=p.parent;if(l.type===nt.CallExpression){let d=s(l);d&&i(d)&&l.arguments.indexOf(p)===0&&e.report({node:a.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(u){return a.typeAnnotation?u.remove(a.typeAnnotation):null}})}}return{ArrowFunctionExpression(a){for(let p of a.params)n(p,a)},FunctionExpression(a){for(let p of a.params)n(p,a)}}}});import{AST_NODE_TYPES as de}from"@typescript-eslint/utils";var Rt=D({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===de.ObjectPattern||!t.init||t.init.type!==de.ObjectExpression||t.id.type===de.Identifier&&t.id.typeAnnotation||t.parent.parent.type===de.ExportNamedDeclaration)return;let o=new Map;for(let n of t.init.properties)n.type===de.Property&&n.key.type===de.Identifier&&o.set(n.key.name,n);if(o.size===0||t.id.type!==de.Identifier)return;let r=ii(t,e.sourceCode);if(r.length===0)return;let i=t.init.properties.some(n=>n.type!==de.Property?!1:n.value.type===de.FunctionExpression),s=new Set;for(let n of r){if(n.identifier.parent.type!==de.MemberExpression)return;let a=n.identifier.parent;if(a.object!==n.identifier)return;if(a.computed)if(a.property.type===de.Literal&&typeof a.property.value=="string")s.add(a.property.value);else return;else{if(a.property.type!==de.Identifier)return;s.add(a.property.name)}if(a.parent.type===de.CallExpression&&i)return}for(let[n,a]of o)s.has(n)||e.report({node:a,messageId:"unusedObjectProperty",data:{name:n}})}}}});function ii(e,t){let o=t.getDeclaredVariables(e);if(o.length!==1)return[];let r=o[0];return r?r.references.filter(i=>i.identifier!==e.id):[]}import{AST_NODE_TYPES as U}from"@typescript-eslint/utils";import{z as Mn}from"zod/v4";var si=Mn.object({ignoreArgsMatching:Mn.string().optional()}),wt=D({name:"no-unused-optional-args",meta:{type:"problem",docs:{description:"Detect unused optional function arguments in non-exported functions"},messages:{unusedOptionalArg:"Optional parameter '{{name}}' is never used",unusedOptionalProp:"Optional prop '{{name}}' is never provided"},schema:[k(si)]},defaultOptions:[{}],create(e,[t]){let o=[];function r(n){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(n):!1}function i(n){return n.type===U.ExportNamedDeclaration||n.type===U.ExportDefaultDeclaration||n.parent?.type===U.ExportNamedDeclaration||n.parent?.type===U.ExportDefaultDeclaration}function s(n){let a=[];for(let p=0;p<n.length;p++){let l=n[p];if(!l||l.type!==U.Identifier)continue;let d=l.name;if(!r(d)){if(l.optional&&l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===U.TSTypeLiteral){let m=l.typeAnnotation.typeAnnotation,u=[];for(let f of m.members)f.type===U.TSPropertySignature&&f.key.type===U.Identifier&&u.push({name:f.key.name,optional:f.optional===!0});u.some(f=>f.optional)?a.push({param:l,index:p,name:d,isObjectParam:!0,objectProps:u}):a.push({param:l,index:p,name:d,isObjectParam:!1})}else if(l.optional)a.push({param:l,index:p,name:d,isObjectParam:!1});else if(l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===U.TSTypeLiteral){let m=l.typeAnnotation.typeAnnotation,u=[];for(let f of m.members)f.type===U.TSPropertySignature&&f.key.type===U.Identifier&&u.push({name:f.key.name,optional:f.optional===!0});u.some(f=>f.optional)&&a.push({param:l,index:p,name:d,isObjectParam:!0,objectProps:u})}}}return a}return{FunctionDeclaration(n){if(i(n))return;let a=s(n.params);a.length!==0&&o.push({node:n,declarationNode:n,optionalParams:a})},VariableDeclarator(n){if(n.id.type!==U.Identifier||!n.init||n.init.type!==U.ArrowFunctionExpression&&n.init.type!==U.FunctionExpression||i(n.parent.parent))return;let p=[...s(n.init.params)];if(n.id.typeAnnotation&&n.id.typeAnnotation.typeAnnotation.type===U.TSTypeReference){let l=n.id.typeAnnotation.typeAnnotation;if(l.typeName.type===U.Identifier&&l.typeName.name==="FC"){let d=l.typeArguments;if(d&&d.params.length===1){let m=d.params[0];if(m&&m.type===U.TSTypeLiteral){let u=[];for(let f of m.members)f.type===U.TSPropertySignature&&f.key.type===U.Identifier&&u.push({name:f.key.name,optional:f.optional===!0});u.some(f=>f.optional)&&p.push({param:n.id,index:0,name:"props",isObjectParam:!0,objectProps:u})}}}}p.length!==0&&o.push({node:n.init,declarationNode:n,optionalParams:p})},"Program:exit"(){for(let n of o){let p=e.sourceCode.getDeclaredVariables(n.declarationNode)[0];if(!p)continue;let l=p.references.filter(u=>u.identifier!==p.identifiers[0]);if(l.length===0)continue;let d=!1;for(let u of l){let f=u.identifier.parent;if(f.type===U.CallExpression&&u.identifier.type===U.Identifier&&f.arguments.includes(u.identifier)){d=!0;break}if(f.type===U.ReturnStatement){d=!0;break}if(f.type===U.Property&&f.parent.type===U.ObjectExpression&&f.parent.parent.type===U.ReturnStatement){d=!0;break}if(f.type===U.JSXExpressionContainer){d=!0;break}}if(d)continue;let m=[];for(let u of l){let f=u.identifier.parent;if(f.type===U.CallExpression&&f.callee===u.identifier){let c=f.arguments.length,g=f.arguments.some(y=>y.type===U.SpreadElement);if(g){d=!0;break}let T={argCount:c,hasSpread:g};for(let y of n.optionalParams)if(y.isObjectParam&&y.index<c){let C=f.arguments[y.index];if(C?.type===U.ObjectExpression){let A={};for(let S of C.properties)S.type===U.Property&&S.key.type===U.Identifier&&(A[S.key.name]=!0);T.objectArgs||(T.objectArgs=[]),T.objectArgs[y.index]=A}else if(C){d=!0;break}}m.push(T)}else if(f.type===U.JSXOpeningElement&&f.name===u.identifier){let c=f.attributes.some(T=>T.type===U.JSXSpreadAttribute);if(c){d=!0;break}let g={argCount:1,hasSpread:c};for(let T of n.optionalParams)if(T.isObjectParam&&T.index===0){let y={};for(let C of f.attributes)C.type===U.JSXAttribute&&C.name.type===U.JSXIdentifier&&(y[C.name.name]=!0);g.objectArgs||(g.objectArgs=[]),g.objectArgs[0]=y}m.push(g)}}if(!(d||m.length===0))for(let u of n.optionalParams)if(u.isObjectParam&&u.objectProps)for(let f of u.objectProps){if(!f.optional)continue;let c=!1;for(let g of m)if(g.objectArgs&&g.objectArgs[u.index]){let T=g.objectArgs[u.index];if(T&&T[f.name]){c=!0;break}}c||e.report({node:u.param,messageId:"unusedOptionalProp",data:{name:f.name}})}else{let f=!1;for(let c of m)if(c.argCount>u.index){f=!0;break}f||e.report({node:u.param,messageId:"unusedOptionalArg",data:{name:u.name}})}}}}}});import{AST_NODE_TYPES as Q,ESLintUtils as ai}from"@typescript-eslint/utils";import{z as ke}from"zod/v4";var pi=ke.object({selectors:ke.array(ke.object({name:ke.string(),selectorProp:ke.string().optional(),selectorArgPos:ke.number().optional(),returnProp:ke.string().optional()}))}),li=ai.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ln="no-unused-selected-values",Ft={name:Ln,rule:li({name:Ln,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[k(pi)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:o=[]}=t,r=new Map(o.map(i=>[i.name,i]));return{VariableDeclarator(i){let s=null;if(i.init?.type===Q.CallExpression&&(s=i.init),!s)return;let n=ui(s);if(!n)return;let a=r.get(n);if(!a)return;let p=ci(s,a.selectorArgPos??0,a.selectorProp);if(!p)return;let l=fi(p);if(!l)return;let d=_n(l.properties,void 0);if(!d)return;if(i.id.type===Q.ObjectPattern){let f=_n(i.id.properties,a.returnProp);if(!f)return;for(let[c,g]of d)f.has(c)||e.report({node:g,messageId:"unusedSelectedValue",data:{name:c}});return}if(i.id.type!==Q.Identifier||a.returnProp)return;let m=mi(i,e.sourceCode);if(m.length===0)return;let u=new Set;for(let f of m){if(f.identifier.parent.type!==Q.MemberExpression)return;let c=f.identifier.parent.property;if(c.type!==Q.Identifier)return;u.add(c.name)}for(let[f,c]of d)u.has(f)||e.report({node:c,messageId:"unusedSelectedValue",data:{name:f}})}}}})};function ci(e,t,o){let r=e.arguments[t];if(!r)return null;if(r.type===Q.ArrowFunctionExpression||r.type===Q.FunctionExpression)return r;if(o&&r.type===Q.ObjectExpression){let i=r.properties.find(n=>n.type===Q.Property&&n.key.type===Q.Identifier&&n.key.name===o);if(i?.type!==Q.Property)return null;let s=i.value;if(s.type===Q.ArrowFunctionExpression||s.type===Q.FunctionExpression)return s}return null}function ui(e){return e.callee.type===Q.Identifier?e.callee.name:e.callee.type===Q.MemberExpression&&e.callee.property.type===Q.Identifier?e.callee.property.name:null}function fi(e){if(e.body.type===Q.ObjectExpression)return e.body;if(e.body.type===Q.BlockStatement){let t=e.body.body.filter(o=>o.type===Q.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==Q.ObjectExpression?null:t[0].argument}return null}function _n(e,t){let o=e;if(t){let i=e.find(s=>s.type===Q.Property&&s.key.type===Q.Identifier&&s.key.name===t);if(i?.type!==Q.Property||i.value.type!==Q.ObjectPattern)return null;o=i.value.properties}let r=new Map;for(let i of o){if(i.type!==Q.Property||i.key.type!==Q.Identifier)return null;r.set(i.key.name,i)}return r.size>0?r:null}function mi(e,t){let o=t.getDeclaredVariables(e);if(o.length!==1)return[];let r=o[0];return r?r.references.filter(i=>i.identifier!==e.id):[]}import{AST_NODE_TYPES as K}from"@typescript-eslint/utils";var Ot=D({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(s=>s.type===K.ImportDeclaration&&s.source.value==="t-state-form"))return{};let r=null,i=!1;return{CallExpression(s){if(i)return;if(!r){let a=di(s);a&&(r=a);return}let n=yi(s,e.sourceCode);if(n){i=!0;for(let a of n)r.delete(a);if(r.size!==0)for(let[a,p]of r)e.report({node:p,messageId:"unusedField",data:{name:a}})}}}}});function di(e){if(!(e.callee.type===K.Identifier&&e.callee.name==="useForm"))return null;let o=e.arguments[0];if(!o||o.type!==K.ObjectExpression)return null;let r=Et(o.properties,s=>s.type!==K.Property||s.key.type!==K.Identifier||s.key.name!=="initialConfig"?null:s.value.type===K.ObjectExpression?s.value:s.value.type===K.ArrowFunctionExpression||s.value.type===K.FunctionExpression?gi(s.value):null);if(!r)return null;let i=new Map;for(let s of r.properties)s.type===K.Property&&s.key.type===K.Identifier&&i.set(s.key.name,s);return i}function yi(e,t){if(!(e.callee.type===K.Identifier&&e.callee.name==="useFormState")||e.parent.type!==K.VariableDeclarator||e.parent.id.type!==K.ObjectPattern||!Et(e.parent.id.properties,n=>n.type===K.Property&&n.key.type===K.Identifier&&n.key.name==="formFields"&&n))return null;let i=Dn(e.parent,"formFields",t),s=new Set;for(let{identifier:n}of i){if(n.type!==K.Identifier||n.parent.type===K.Property&&n.parent.parent.type===K.ObjectExpression&&n.parent.parent.parent.type===K.ReturnStatement||n.parent.type===K.ReturnStatement)return null;if(n.parent.type===K.MemberExpression){if(n.parent.object.type!==K.Identifier||n.parent.property.type!==K.Identifier)return null;s.add(n.parent.property.name)}}return s}function gi(e){if(e.body.type===K.ObjectExpression)return e.body;if(e.body.type===K.BlockStatement){let t=e.body.body.filter(o=>o.type===K.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==K.ObjectExpression?null:t[0].argument}return null}import{AST_NODE_TYPES as q,ESLintUtils as Si}from"@typescript-eslint/utils";import{z as rt}from"zod/v4";var Ti=Si.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function $n(e){let t=[];for(let o of e.members)o.type===q.TSPropertySignature&&o.key.type===q.Identifier&&t.push([o.key.name,o]);return t}function zn(e,...t){for(let o of t)e.set(...o);return e}var Ei=rt.object({forceCheckOnFCPropTypesWithName:rt.array(rt.string()).optional(),alwaysCheckFunctionOptionTypes:rt.boolean().optional()}),Un="no-unused-type-props-in-args",Dt=null,xi=Ti({name:Un,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[k(Ei)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:o,alwaysCheckFunctionOptionTypes:r=!0}=t;o&&!Dt&&(Dt=o.map(p=>new RegExp(p)));function i(p,l,d,m,u=!0,f=!1){let c=d.name,g=e.sourceCode.getScope(l).references.find(S=>S.identifier.name===c)?.resolved,T=p&&Dt?.some(S=>S.test(c)),y=f&&r;if(!g||!T&&g.references.filter(S=>S.isTypeReference).length>1||!g.defs[0])return;let C=g.defs[0].node,A=C.parent?.type===q.ExportNamedDeclaration;if(!(u&&A&&!y)){if(C.type===q.TSTypeAliasDeclaration){s(p,l,m,C.typeAnnotation,!0,f);return}if(C.type===q.TSInterfaceDeclaration){s(p,l,m,C.body,!0,f);return}}}function s(p,l,d,m,u,f=!1){if(m.type===q.TSInterfaceBody){for(let c of m.body)c.type===q.TSPropertySignature&&c.key.type===q.Identifier&&d.set(c.key.name,c);return}if(m.type===q.TSTypeLiteral){zn(d,...$n(m));return}if(m.type===q.TSIntersectionType){for(let c of m.types)s(p,l,d,c,!0,f);return}u||m.type===q.TSTypeReference&&m.typeName.type===q.Identifier&&i(p,l,m.typeName,d,!0,f)}function n(p,l,d,m=!1){for(let u of d)if(u.type===q.ObjectPattern&&u.typeAnnotation){let f=new Map;if(s(p,l,f,u.typeAnnotation.typeAnnotation,!1,m),f.size===0)continue;a(u,f)}else u.type===q.AssignmentPattern&&u.left.type===q.ObjectPattern&&n(p,l,[u.left],m)}function a(p,l){let d=[];if(p.properties.at(-1)?.type===q.RestElement)return;for(let c of p.properties)c.type===q.Property&&c.key.type===q.Identifier&&d.push(c.key.name);let u=[],f=[];for(let[c,g]of l)d.includes(c)||(f.push(c),u.push({node:g,messageId:"unusedObjectTypeProperty",data:{propertyName:c}}));for(let[c,g]of u.entries())e.report({...g,fix:c===u.length-1?T=>{let y=p.properties.at(-1),C=f.join(", ");return y?y.type===q.RestElement?null:T.insertTextAfter(y,`, ${C}`):T.insertTextBeforeRange([p.range[0]+1,p.range[1]],C)}:void 0})}return{VariableDeclaration(p){let l=p.declarations[0],d=new Map,m=l.id.type===q.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===q.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===q.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===q.TSTypeReference&&m.typeName.type===q.Identifier)i(!0,p,m.typeName,d,!1);else if(m.type===q.TSTypeLiteral)zn(d,...$n(m));else if(m.type===q.TSIntersectionType)for(let u of m.types)u.type===q.TSTypeReference&&u.typeName.type===q.Identifier?i(!0,p,u.typeName,d,!1):s(!0,p,d,u,!0);if(d.size!==0&&l.init?.type===q.ArrowFunctionExpression){let u=l.init.params[0];if(!u){e.report({node:l.init,messageId:"missingComponentParam"});return}u.type===q.ObjectPattern&&a(u,d)}}},FunctionDeclaration(p){n(!1,p,p.params,r)},ArrowFunctionExpression(p){n(!1,p,p.params,r)}}}}),vt={name:Un,rule:xi};import{AST_NODE_TYPES as Te}from"@typescript-eslint/utils";var kt=D({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let t=new Set;function o(r){return r.callee.type===Te.Identifier?t.has(r.callee.name):r.callee.type===Te.MemberExpression&&r.callee.object.type===Te.Identifier&&r.callee.property.type===Te.Identifier?r.callee.property.name==="useRef":!1}return{ImportDeclaration(r){if(r.source.value==="react")for(let i of r.specifiers)i.type===Te.ImportSpecifier&&i.imported.type===Te.Identifier&&i.imported.name==="useRef"&&t.add(i.local.name)},VariableDeclarator(r){if(r.init&&r.init.type===Te.CallExpression&&o(r.init)&&r.id.type===Te.Identifier){let s=e.sourceCode.getScope(r).set.get(r.id.name);if(s){let n=!1;for(let a of s.references){let l=a.identifier.parent;if(l!==r&&!(l.type===Te.JSXExpressionContainer&&l.parent.type===Te.JSXAttribute&&l.parent.name.type===Te.JSXIdentifier&&l.parent.name.name==="ref")){n=!0;break}}n||e.report({node:r.id,messageId:"refNotRead",data:{name:r.id.name}})}}}}}});import{AST_NODE_TYPES as jt,ESLintUtils as hi}from"@typescript-eslint/utils";var bi=hi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Vn="prefer-named-functions",Jn=new Map,Ci=bi({name:Vn,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let o=null;if(t.ignoreRegex){let r=Jn.get(t.ignoreRegex);r?o=r:(o=new RegExp(t.ignoreRegex),Jn.set(t.ignoreRegex,o))}return{VariableDeclarator(r){if(r.init&&r.init.type===jt.ArrowFunctionExpression&&r.id.type===jt.Identifier){let i=r.id.name;if(r.id.typeAnnotation||o&&o.test(i)||!t.disallowArrowFnWithImplicitReturns&&r.init.body.type!==jt.BlockStatement)return;let s=r.parent,n=r.init.params,a=r.init.body,p=r.init;e.report({node:r.id,messageId:o?"withIgnoreRegex":"default",data:{functionName:i,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:l=>l.replaceText(s,`${p.async?"async ":""}function ${i}(${n.map(d=>e.sourceCode.getText(d)).join(", ")||""}) ${e.sourceCode.getText(a)}`)}]})}}}}}),Mt={name:Vn,rule:Ci};import{AST_NODE_TYPES as _}from"@typescript-eslint/utils";import{z as Ne}from"zod/v4";var Ai=Ne.object({disallowedFunctions:Ne.array(Ne.object({name:Ne.string(),allowUsingWithArgs:Ne.boolean().optional(),hookAlternative:Ne.string().optional(),message:Ne.string().optional(),allowUseInside:Ne.array(Ne.string()).optional()}))}),Ii=/^use[A-Z]/,Pi=/^[A-Z]/;function ot(e){return Ii.test(e)}function Xn(e){return Pi.test(e)}function Ni(e){return e.type===_.Identifier?ot(e.name):e.type===_.MemberExpression&&e.property.type===_.Identifier?ot(e.property.name):!1}function Wn(e,t){return e.type===_.Identifier?e.name===t:e.type===_.MemberExpression&&e.object.type===_.Identifier&&e.property.type===_.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Bn(e){return!!(e.parent&&e.parent.type===_.CallExpression&&Wn(e.parent.callee,"forwardRef"))}function Yn(e){return!!(e.parent&&e.parent.type===_.CallExpression&&Wn(e.parent.callee,"memo"))}function Lt(e){if(e.type===_.FunctionDeclaration||e.type===_.FunctionExpression&&e.id)return e.id||void 0;if(e.type===_.FunctionExpression||e.type===_.ArrowFunctionExpression){if(e.parent.type===_.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===_.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===_.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===_.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Ri(e){let t=e.parent,o=!1;for(;t;){if(t.type===_.FunctionDeclaration||t.type===_.FunctionExpression||t.type===_.ArrowFunctionExpression){let r=Lt(t);if(r&&r.type===_.Identifier){if(Xn(r.name)||ot(r.name))return!o;o=!0}else{if(Bn(t)||Yn(t))return!o;if(t.parent.type===_.CallExpression){let i=t.parent;Ni(i.callee)||(o=!0)}else t.parent.type===_.JSXExpressionContainer||(o=!0)}}t=t.parent}return!1}function qn(e){return e.callee.type===_.Identifier?e.callee.name:e.callee.type===_.MemberExpression&&e.callee.property.type===_.Identifier?e.callee.property.name:null}function wi(e,t){if(!t.length)return!1;let o=e.parent;for(;o;){if(o.type===_.FunctionDeclaration||o.type===_.FunctionExpression||o.type===_.ArrowFunctionExpression){let r=Lt(o);if(r&&r.type===_.Identifier&&t.includes(r.name))return!0}else if(o.type===_.CallExpression){let r=qn(o);if(r&&t.includes(r))return!0}o=o.parent}return!1}function Fi(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===_.Identifier&&t.name==="undefined")}function Oi(e,t){let o=!1,r=e.parent;for(;r;){if(r.type===_.FunctionDeclaration||r.type===_.FunctionExpression||r.type===_.ArrowFunctionExpression){let i=Lt(r);if(i&&i.type===_.Identifier){if(Xn(i.name)||ot(i.name)){o=!0;break}}else if(Bn(r)||Yn(r)){o=!0;break}}r=r.parent}return o?t.length===0?Ri(e):!wi(e,t):!1}var _t=D({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[k(Ai)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:o}=t,r=new Map(o.map(i=>[i.name,i]));return{CallExpression(i){let s=qn(i);if(!s)return;let n=r.get(s);if(!n||n.allowUsingWithArgs&&Fi(i))return;let a=n.allowUseInside||[];Oi(i,a)&&e.report({node:i,messageId:"preferHookAlternative",data:{message:n.message?` ${n.message}`:` use ${n.hookAlternative} instead`},suggest:n.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${n.hookAlternative}`,hookAlternative:n.hookAlternative},fix:p=>{let l=n.hookAlternative;return l?i.callee.type===_.Identifier?p.replaceText(i.callee,l):i.callee.type===_.MemberExpression&&i.callee.property.type===_.Identifier?p.replaceText(i.callee.property,l):null:null}}]:[]})}}}});import{AST_NODE_TYPES as oe,AST_TOKEN_TYPES as Zn,ESLintUtils as Di}from"@typescript-eslint/utils";import $t from"zod/v4";var vi=Di.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Hn="prefer-single-line-if",ki=$t.object({maxLineLength:$t.number().optional(),maxNonSimpleConditionLength:$t.number().optional()}),ji=vi({name:Hn,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[k(ki)]},defaultOptions:[{}],create(e,[t]){let o=e.sourceCode;return{IfStatement(r){if(r.consequent.type!==oe.BlockStatement||r.loc.start.line===r.loc.end.line||o.getCommentsInside(r.consequent).length>0||r.alternate||r.consequent.body.length!==1)return;let s=r.consequent.body[0];if(!s)return;if(s.type===oe.ReturnStatement){if(!Qn(s))return}else if(!(s.type===oe.ContinueStatement||s.type===oe.BreakStatement))return;if(r.test.type===oe.LogicalExpression||r.test.type===oe.ConditionalExpression)return;let n;if(t.maxNonSimpleConditionLength){let m=Gn(r.test);if(!m&&r.test.type===oe.UnaryExpression&&r.test.operator==="!"){let u=r.test.argument;Gn(u)&&(m=!0)}if(m&&(n=o.getText(r.test),n.length>t.maxNonSimpleConditionLength))return}n||(n=o.getText(r.test));let a=o.getText(s);if(n.includes(`
|
|
7
|
-
`)
|
|
8
|
-
"
|
|
9
|
-
`)}return null}}]})}}}},FunctionDeclaration(n){if(n.id&&Be(n)&&!or(n.id.name)){e.report({node:n,messageId:"useMemoDirectiveNaming"});return}if(Ut(n,e.sourceCode)){if(Ue(n))return;e.report({node:n,messageId:"functionCallingHooksMustBeComponent"});return}if(Jt(n,void 0,void 0,e.sourceCode)){let a=nr(n,e.sourceCode),p=Be(n);if(!a&&!p){if(Ue(n))return;e.report({node:n,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(l){let d=n.body.range[0]+1;return l.insertTextAfterRange([d,d],`
|
|
10
|
-
"use memo"
|
|
11
|
-
`)}}]})}}},FunctionExpression(n){if(Be(n)){e.report({node:n,messageId:"useMemoDirectiveNaming"});return}if(Ut(n,e.sourceCode)){if(Ue(n))return;e.report({node:n,messageId:"functionCallingHooksMustBeComponent"})}},ReturnStatement(n){if(n.argument?.type!==N.ObjectExpression)return;let a=tr(n);if(!a)return;let p;a.type===N.FunctionDeclaration&&a.id?p=a.id.name:(a.type===N.ArrowFunctionExpression||a.type===N.FunctionExpression)&&a.parent.type===N.VariableDeclarator&&a.parent.id.type===N.Identifier&&(p=a.parent.id.name),p&&it(p)&&(s(n)||(r(n.argument),i(n.argument)))}}}}),Vt={name:ir,rule:Bi};import{AST_NODE_TYPES as re,ESLintUtils as Yi}from"@typescript-eslint/utils";import{z as Ee}from"zod/v4";var qi=Yi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="react-compiler-migration",Zi=Ee.object({disallowHooks:Ee.array(Ee.object({name:Ee.string(),replacement:Ee.string()})).optional(),disallowMethods:Ee.array(Ee.object({name:Ee.string(),replacement:Ee.string().optional(),requireTrueProp:Ee.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:Ee.boolean().optional()}),Gi=/eslint +react-compiler\/react-compiler: +\["error/;function Hi(e){let t=null;if((e.type===re.FunctionDeclaration||e.type===re.FunctionExpression||e.type===re.ArrowFunctionExpression&&e.body.type===re.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let o=t.body[0];return o?o.type===re.ExpressionStatement&&o.expression.type===re.Literal&&o.expression.value==="use no memo":!1}function Ki(e){let t=e.parent;for(;t;){if(t.type===re.FunctionDeclaration||t.type===re.FunctionExpression||t.type===re.ArrowFunctionExpression)return t;t=t.parent}return null}function Qi(e){return e.type===re.Identifier?e.name.startsWith("use"):e.type===re.MemberExpression&&e.property.type===re.Identifier?e.property.name.startsWith("use"):!1}var es=qi({name:pr,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[k(Zi)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let o=!0;if(t.runOnlyWithEnableCompilerDirective){o=!1;for(let i of e.sourceCode.getAllComments())if(Gi.test(i.value)){o=!0;break}}if(!o)return{};function r(i){let s=Ki(i);return s!==null&&Hi(s)}return{CallExpression(i){if(t.disallowHooks?.length){let s=null,n=null;if(i.callee.type===re.Identifier?(s=i.callee.name,n=i.callee):i.callee.type===re.MemberExpression&&i.callee.property.type===re.Identifier&&(s=i.callee.property.name,n=i.callee.property),s){let a=t.disallowHooks.find(p=>p.name===s);if(a&&n){if(r(i))return;e.report({node:i,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:a.name,replacement:a.replacement},suggest:[{messageId:"replace",data:{replacement:a.replacement},fix:p=>p.replaceText(n,a.replacement)}]})}}}if(t.disallowMethods?.length&&Qi(i.callee)){for(let s of i.arguments)if(s.type===re.ObjectExpression){for(let n of s.properties)if(n.type===re.Property&&n.key.type===re.Identifier){let a=n.key.name,p=t.disallowMethods.find(l=>l.name===a);if(p){if(r(i))return;if(p.requireTrueProp){let l=p.requireTrueProp,d=!1;for(let m of s.properties)if(m.type===re.Property&&m.key.type===re.Identifier&&m.key.name===l&&m.value.type===re.Literal&&m.value.value===!0){d=!0;break}if(!d){e.report({node:n,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:p.name,requireTrueProp:l}});continue}}p.replacement&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:p.name,replacement:p.replacement},suggest:[{messageId:"replace",data:{replacement:p.replacement},fix:l=>p.replacement?l.replaceText(n.key,p.replacement):null}]})}}}}}}}}),Xt={name:pr,rule:es};import{AST_NODE_TYPES as B}from"@typescript-eslint/utils";import{z as lr}from"zod/v4";var ts=/\.(tsx|jsx)$/,ns=/^[A-Z][A-Za-z0-9]*$/,rs=/^[A-Z][A-Z0-9_]*$/,cr=80,os=lr.object({ignoreConstCaseVarRegex:lr.string().optional()}),Bt=D({name:"react-no-module-level-single-use-values",meta:{type:"problem",docs:{description:"Disallow module-level allocated data values and long strings that are only used in one React component, excluding functions, inferable aliases, regex values, and class instantiations except Set/Map"},schema:[k(os)],messages:{moveValueInsideComponent:"Module-level `{{valueName}}` is only used in React component `{{componentName}}`. Move it inside the component to improve memory usage."}},defaultOptions:[{}],create(e,[t]){if(!ts.test(e.filename))return{};let o=e.sourceCode,r=gs(t.ignoreConstCaseVarRegex),i=is(o.ast.body);return i.length===0?{}:{VariableDeclarator(s){if(s.id.type!==B.Identifier||!ss(s)||!ls(s.init))return;let n=s.id.name;if(r&&ys(n)&&r.test(n))return;let p=o.getDeclaredVariables(s).find(f=>f.name===n);if(!p)return;let l=new Set,d=!1,m=!1;for(let f of p.references){if(f.init)continue;m=!0;let c=as(f.identifier,i);if(!c){d=!0;break}if(l.add(c),l.size>1)break}if(!m||d||l.size!==1)return;let[u]=Array.from(l);u&&e.report({node:s.id,messageId:"moveValueInsideComponent",data:{valueName:n,componentName:u}})}}}});function is(e){let t=[],o=new Set;function r(s,n){ns.test(s)&&(o.has(s)||(o.add(s),t.push({name:s,range:n.range})))}function i(s){for(let n of s.declarations){if(n.id.type!==B.Identifier)continue;let a=ur(n.init);a&&r(n.id.name,a)}}for(let s of e){if(s.type===B.VariableDeclaration){i(s);continue}if(s.type===B.FunctionDeclaration){r(s.id.name,s);continue}s.type===B.ExportNamedDeclaration&&s.declaration&&(s.declaration.type===B.VariableDeclaration?i(s.declaration):s.declaration.type===B.FunctionDeclaration&&s.declaration.id&&r(s.declaration.id.name,s.declaration))}return t}function ss(e){return e.parent.parent.type===B.Program}function as(e,t){let o=null;for(let r of t){if(!(e.range[0]>=r.range[0]&&e.range[1]<=r.range[1]))continue;if(!o){o=r;continue}let s=o.range[1]-o.range[0];r.range[1]-r.range[0]<s&&(o=r)}return o?.name??null}function ur(e){if(!e)return null;let t=Wt(e);if(t.type===B.ArrowFunctionExpression||t.type===B.FunctionExpression)return t;if(t.type!==B.CallExpression||!ps(t.callee))return null;let o=t.arguments[0];if(!o||o.type===B.SpreadElement)return null;if(o.type===B.CallExpression)return ur(o);let r=Wt(o);return r.type===B.ArrowFunctionExpression||r.type===B.FunctionExpression?r:null}function ps(e){return e.type===B.Identifier?e.name==="memo"||e.name==="forwardRef":e.type===B.MemberExpression?e.property.type===B.Identifier&&(e.property.name==="memo"||e.property.name==="forwardRef"):!1}function Wt(e){let t=e;for(;;){if(t.type===B.TSAsExpression){t=t.expression;continue}if(t.type===B.TSSatisfiesExpression){t=t.expression;continue}if(t.type===B.TSNonNullExpression){t=t.expression;continue}return t}}function ls(e){if(!e)return!1;let t=Wt(e);return cs(t)?!1:us(t)?!0:fs(t)}function cs(e){return e.type===B.Identifier||e.type===B.MemberExpression}function us(e){if(e.type===B.Literal)return typeof e.value=="string"&&e.value.length>=cr;if(e.type===B.TemplateLiteral){if(e.expressions.length>0)return!1;let t=e.quasis[0];return t?t.value.cooked.length>=cr:!1}return!1}function fs(e){return e.type===B.ArrayExpression||e.type===B.ObjectExpression||e.type===B.ClassExpression?!0:e.type===B.NewExpression?ms(e):!1}function ms(e){let t=ds(e.callee);return t==="Set"||t==="Map"}function ds(e){return e.type===B.Identifier?e.name:e.type===B.MemberExpression?e.computed||e.property.type!==B.Identifier?null:e.property.name:null}function ys(e){return rs.test(e)}function gs(e){if(!e)return null;try{return new RegExp(e)}catch{return null}}import{AST_NODE_TYPES as v}from"@typescript-eslint/utils";import{z as fr}from"zod";var Ss=fr.object({runOnlyWithEnableCompilerDirective:fr.boolean().optional()}),Ts=/eslint +react-compiler\/react-compiler: +\["error/,Es=/^\d+$/,xs=/[\s_-]+/,hs=/[a-z][A-Z]/,bs=/^(.+?)([A-Z][a-z]+s?)$/,Cs=/^[a-z][a-zA-Z]*$/;function mr(e,t){let o=[];if(e.type===v.JSXElement){for(let r of e.openingElement.attributes)if(r.type===v.JSXAttribute&&r.name.type===v.JSXIdentifier&&r.value?.type===v.JSXExpressionContainer&&r.value.expression.type!==v.JSXEmptyExpression){let i=r.name.name,s=r.value.expression,n=!1;Pe(s,a=>{switch(a.type){case v.ObjectExpression:case v.ArrowFunctionExpression:case v.FunctionExpression:case v.ArrayExpression:return n=!0,!0}return!1},t),n&&o.push(i)}}return{hasUnstable:o.length>0,problematicProps:o}}function As(e){if(e.body.type===v.JSXElement||e.body.type===v.JSXFragment)return!0;if(e.body.type===v.BlockStatement){for(let t of e.body.body)if(t.type===v.ReturnStatement&&t.argument&&(t.argument.type===v.JSXElement||t.argument.type===v.JSXFragment))return!0}return!1}function Is(e,t){let o=e.callee;if(o.type===v.MemberExpression){let r=o.object;if(r.type===v.Identifier){let i=r.name,s=Ps(i);if(s!==i)return qt(s)}}if(t.length>0){let r=t[0];if(r&&r.type===v.Identifier)return qt(r.name)}return"ListItem"}function Ps(e){let o={people:"person",children:"child",feet:"foot",teeth:"tooth",mice:"mouse",men:"man",women:"woman"}[e.toLowerCase()];if(o)return o;if(e.match(hs)){let r=e.match(bs);if(r){let i=r[1],s=r[2];if(!i||!s)return Yt(e);let n=Yt(s);if(n!==s)return i+n}}return Yt(e)}function Yt(e){return e.endsWith("ies")?`${e.slice(0,-3)}y`:e.endsWith("es")&&e.length>3?e.slice(0,-2):e.endsWith("s")&&e.length>1?e.slice(0,-1):e}function qt(e){return e.match(Cs)?e.charAt(0).toUpperCase()+e.slice(1):e.split(xs).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function dr(e,t,o){let r=[],i=new Set,s=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Pe(e,n=>{if(n.type===v.Identifier&&!t.includes(n.name)&&!s.has(n.name)&&!Es.test(n.name)){let a=n.parent;if(a.type===v.Property&&a.key===n||a.type===v.MemberExpression&&a.property===n&&!a.computed||a.type===v.JSXOpeningElement||a.type===v.JSXClosingElement||a.type===v.JSXAttribute&&a.name.type===v.JSXIdentifier&&a.name.name===n.name)return!1;i.add(n.name)}return!1},o);for(let n of i)t.includes(n)||r.push({name:n,type:"unknown"});return r}function yr(e,t,o,r,i){let n=[...o.map(m=>m.type===v.Identifier?m.name:"item").map((m,u)=>({name:m,type:u===0?`${e}Type`:u===1?"number":"unknown"})),...r],a=n.map(m=>{let u=m.type;return m.name.includes("on")&&u==="any"&&(u="unknown"),` ${m.name}: ${u};`}).join(`
|
|
12
|
-
`),p=n.map(m=>m.name).join(", "),l=i.getText(t),d=`${e}Props`;return`type ${d} = {
|
|
13
|
-
${a}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const ${e}: FC<${d}> = ({ ${p} }) => {
|
|
17
|
-
return (
|
|
18
|
-
${l}
|
|
19
|
-
);
|
|
20
|
-
};`}function Ns(e,t,o,r){let i=t.map(n=>n.type===v.Identifier?n.name:"item"),s=[r?`key={${r}}`:`key={${i[0]}.id}`,...i.map(n=>`${n}={${n}}`),...o.map(n=>`${n.name}={${n.name}}`)].filter(Boolean);return`<${e} ${s.join(" ")} />`}function Rs(e){if(e.type===v.JSXElement&&e.openingElement.name.type===v.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return qt(t)}return"ListItem"}function ws(e,t,o){let r=[o?`key={${o}}`:"",...t.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e}${r.length>0?` ${r.join(" ")}`:""} />`}function gr(e,t){for(let o of e.openingElement.attributes)if(o.type===v.JSXAttribute&&o.name.type===v.JSXIdentifier&&o.name.name==="key"&&o.value&&o.value.type===v.JSXExpressionContainer&&o.value.expression.type!==v.JSXEmptyExpression)return t.getText(o.value.expression);return null}var Zt=D({name:"react-optimized-collections",meta:{type:"suggestion",docs:{description:"Detect unstable values in map renders that prevent React Compiler optimization"},messages:{unstableValueInMap:"Unstable values in {{problematicProps}} prevent React Compiler from optimizing individual list items. Extract the problematic props to outside the loop or extract the item to a separate component.",extractComponent:"Extract to {{componentName}} component"},schema:[k(Ss)],hasSuggestions:!0},defaultOptions:[{runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let{sourceCode:o}=e;if(t.runOnlyWithEnableCompilerDirective){let r=!1;for(let i of o.getAllComments())if(Ts.test(i.value)){r=!0;break}if(!r)return{}}return{CallExpression(r){r.callee.type===v.MemberExpression&&r.callee.property.type===v.Identifier&&(r.callee.property.name==="map"||r.callee.property.name==="push")&&(r.callee.property.name==="map"?Fs(r,o,e):Os(r,o,e))}}}});function Fs(e,t,o){let r=e.arguments[0];if(!r||r.type!==v.ArrowFunctionExpression&&r.type!==v.FunctionExpression||!As(r))return;let i=null;if(r.body.type===v.JSXElement||r.body.type===v.JSXFragment?i=r.body:r.body.type===v.BlockStatement&&r.body.body[0]?.type===v.ReturnStatement&&r.body.body[0].argument&&(r.body.body[0].argument.type===v.JSXElement||r.body.body[0].argument.type===v.JSXFragment)&&(i=r.body.body[0].argument),!i)return;let s=mr(i,t);if(!s.hasUnstable)return;let n=Is(e,r.params),a=r.params.map(m=>m.type===v.Identifier?m.name:"item"),p=dr(i,a,t),l=i.type===v.JSXElement?gr(i,t):null,d=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;o.report({node:i,messageId:"unstableValueInMap",data:{problematicProps:d},suggest:[{messageId:"extractComponent",data:{componentName:n},fix:m=>{let u=yr(n,i,r.params,p,t),f=Ns(n,r.params,p,l),c=e;for(;c.parent.type!==v.Program&&!(c.type===v.FunctionDeclaration||c.type===v.VariableDeclarator&&c.init&&(c.init.type===v.ArrowFunctionExpression||c.init.type===v.FunctionExpression));)c=c.parent;let g=[];return g.push(m.insertTextAfter(c,`
|
|
21
|
-
|
|
22
|
-
${u}`)),g.push(m.replaceText(i,f)),g}}]})}function Os(e,t,o){let r=e.arguments[0];if(!r||r.type!==v.JSXElement&&r.type!==v.JSXFragment)return;let i=r,s=mr(i,t);if(!s.hasUnstable)return;let n=Rs(i),a=dr(i,[],t),p=i.type===v.JSXElement?gr(i,t):null,l=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;o.report({node:i,messageId:"unstableValueInMap",data:{problematicProps:l},suggest:[{messageId:"extractComponent",data:{componentName:n},fix:d=>{let m=yr(n,i,[],a,t),u=ws(n,a,p),f=e;for(;f.parent.type!==v.Program&&!(f.type===v.FunctionDeclaration||f.type===v.VariableDeclarator&&f.init&&(f.init.type===v.ArrowFunctionExpression||f.init.type===v.FunctionExpression));)f=f.parent;let c=[];return c.push(d.insertTextAfter(f,`
|
|
23
|
-
|
|
24
|
-
${m}`)),c.push(d.replaceText(i,u)),c}}]})}import{ESLintUtils as Ds,TSESTree as vs}from"@typescript-eslint/utils";var ks=Ds.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sr="require-description",js=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|oxlint-(?:enable|disable(?:(?:-next)?-line)?)|exported|globals?)(?:\s|$)/u,Ms=/^(?:eslint|oxlint)-disable-(next-)?line$/u,Ls=ks({name:Sr,meta:{type:"problem",docs:{description:"Require descriptions for eslint and oxlint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","oxlint-disable","oxlint-disable-line","oxlint-disable-next-line","oxlint-enable","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let o=e.sourceCode,r=new Set(t.ignore||[]);return{Program(){for(let i of o.getAllComments()){let s=_s(i);s!=null&&(r.has(s.kind)||s.description||e.report({loc:Us(i.loc),messageId:"missingDescription"}))}}}}}),Tr={name:Sr,rule:Ls};function _s(e){let{text:t,description:o}=zs(e.value);if(!t)return null;let r=js.exec(t);if(!r)return null;let i=r[1];if(!i)return null;let s=Ms.test(i);if(e.type===vs.AST_TOKEN_TYPES.Line&&!s||s&&e.loc.start.line!==e.loc.end.line)return null;let n=t.slice(r.index+i.length);return{kind:i,value:n.trim(),description:o}}var $s=/\s-{2,}\s/u;function zs(e){let t=e.split($s);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Us(e){return{start:{line:e.start.line,column:0},end:e.end}}import{AST_NODE_TYPES as J}from"@typescript-eslint/utils";import{z as Re}from"zod/v4";var Js=Re.object({varsToCheck:Re.array(Re.object({selector:Re.string().optional(),fromFnCall:Re.string().optional(),prop:Re.string().or(Re.array(Re.string())),errorMsg:Re.string().optional()}))}),Gt=D({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[k(Js)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let o=new Map;function r(n,a,p,l){let d=new Set;for(let u of n.properties)u.type===J.Property&&u.key.type===J.Identifier&&d.add(u.key.name);let m=a.filter(u=>!d.has(u));if(m.length>0)if(m.length===1)e.report({node:n,messageId:"propNotRead",data:{prop:m[0],fnName:l,customMsg:p||""}});else{let u=m.map(f=>`"${f}"`).join(", ");e.report({node:n,messageId:"propsNotRead",data:{props:u,fnName:l,customMsg:p||""}})}}function i(n){if(n.init?.type===J.CallExpression){if(n.init.callee.type===J.Identifier)return n.init.callee.name;if(n.init.callee.type===J.MemberExpression&&n.init.callee.property.type===J.Identifier)return n.init.callee.object.type===J.Identifier?`${n.init.callee.object.name}.${n.init.callee.property.name}`:n.init.callee.property.name}return"unknown function"}let s={};for(let n of t.varsToCheck)n.selector&&(s[n.selector]=a=>{if(a.type===J.VariableDeclarator&&a.id.type===J.Identifier&&o.set(a.id.name,{props:Array.isArray(n.prop)?n.prop:[n.prop],errorMsg:n.errorMsg,node:a.id,fnName:i(a)}),a.type===J.VariableDeclarator&&a.id.type===J.ObjectPattern){let p=Array.isArray(n.prop)?n.prop:[n.prop];r(a.id,p,n.errorMsg,i(a))}});for(let n of t.varsToCheck)if(n.fromFnCall){let a=n.fromFnCall;if(a.startsWith("*.")){let l=`VariableDeclarator > CallExpression > MemberExpression[property.name="${a.slice(2)}"]`;s[l]=d=>{if(d.type!==J.MemberExpression||d.parent.type!==J.CallExpression)return;let m=d.parent;if(m.parent.type!==J.VariableDeclarator)return;let u=m.parent;if(u.id.type===J.Identifier)o.set(u.id.name,{props:Array.isArray(n.prop)?n.prop:[n.prop],errorMsg:n.errorMsg,node:u.id,fnName:n.fromFnCall||"unknown function"});else if(u.id.type===J.ObjectPattern){let f=Array.isArray(n.prop)?n.prop:[n.prop];r(u.id,f,n.errorMsg,n.fromFnCall||"unknown function")}}}else if(a.includes(".")){let[p,l]=a.split("."),d=`VariableDeclarator > CallExpression > MemberExpression[object.name="${p}"][property.name="${l}"]`;s[d]=m=>{if(m.type!==J.MemberExpression||m.parent.type!==J.CallExpression)return;let u=m.parent;if(u.parent.type!==J.VariableDeclarator)return;let f=u.parent;if(f.id.type===J.Identifier)o.set(f.id.name,{props:Array.isArray(n.prop)?n.prop:[n.prop],errorMsg:n.errorMsg,node:f.id,fnName:n.fromFnCall||"unknown function"});else if(f.id.type===J.ObjectPattern){let c=Array.isArray(n.prop)?n.prop:[n.prop];r(f.id,c,n.errorMsg,n.fromFnCall||"unknown function")}}}else{let p=`VariableDeclarator > CallExpression > Identifier[name="${a}"]`;s[p]=l=>{if(l.type!==J.Identifier||l.parent.type!==J.CallExpression)return;let d=l.parent;if(d.parent.type!==J.VariableDeclarator)return;let m=d.parent;if(m.id.type===J.Identifier)o.set(m.id.name,{props:Array.isArray(n.prop)?n.prop:[n.prop],errorMsg:n.errorMsg,node:m.id,fnName:n.fromFnCall||"unknown function"});else if(m.id.type===J.ObjectPattern){let u=Array.isArray(n.prop)?n.prop:[n.prop];r(m.id,u,n.errorMsg,n.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[n,{props:a,errorMsg:p,node:l,fnName:d}]of o){let u=e.sourceCode.getScope(l).set.get(n);if(u){let f=new Set(a);for(let c of u.references){let g=c.identifier,T=g.parent;if(!(T.type===J.VariableDeclarator&&T.id===g)){if(T.type===J.MemberExpression&&T.object===g&&T.property.type===J.Identifier&&f.has(T.property.name)){if(f.delete(T.property.name),f.size===0)break;continue}if(T.type===J.VariableDeclarator&&T.init===g&&T.id.type===J.ObjectPattern){for(let y of T.id.properties)y.type===J.Property&&y.key.type===J.Identifier&&f.has(y.key.name)&&f.delete(y.key.name);if(f.size===0)break;continue}if(!(T.type===J.MemberExpression&&T.object===g&&T.property.type===J.Identifier&&!a.includes(T.property.name))){f.clear();break}}}if(f.size>0){let c=Array.from(f);if(c.length===1)e.report({node:l,messageId:"propNotRead",data:{prop:c[0],fnName:d,customMsg:p||""}});else{let g=c.map(T=>`"${T}"`).join(", ");e.report({node:l,messageId:"propsNotRead",data:{props:g,fnName:d,customMsg:p||""}})}}}}}}}});import{AST_NODE_TYPES as ae,AST_TOKEN_TYPES as Vs}from"@typescript-eslint/utils";import*as ue from"zod/v4";var Xs=/^\s+$/,Ht=/\r?\n/,Ws=/^(\s*)/,Bs=/^(\s*)\S/,Ys=/\r?\n/,qs=ue.object({indent:ue.union([ue.string().regex(Xs),ue.number().int().min(1)]).optional(),tags:ue.array(ue.string()).optional(),functions:ue.array(ue.string()).optional(),comments:ue.array(ue.string()).optional()}),Kt=D({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[k(qs)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:o=["HTML","indent"],functions:r=["dedent","stripIndent"],tags:i=["outdent","dedent","gql","sql","html","styled"],indent:s}=e.options[0],n=o.map(y=>y.toLowerCase());function a(y){let C=y.split(Ht),A=C.filter(b=>b.trim()!=="");if(A.length===0)return y;let S=Number.POSITIVE_INFINITY;for(let b of A){let E=b.match(Ws);E&&(S=Math.min(S,E[1]?.length??0))}return!isFinite(S)||S===0?y:C.map(b=>b.slice(S)).join(`
|
|
25
|
-
`)}function p(y,C,A){return y.split(Ht).map(b=>b.trim()===""?b:A.repeat(C)+b).join(`
|
|
26
|
-
`)}function l(y){if(y.type===ae.Identifier)return y.name;if(y.type===ae.MemberExpression){let C=y.object.type===ae.Identifier?y.object.name:null,A=y.property.type===ae.Identifier?y.property.name:null;return C&&A?`${C}.${A}`:A}return null}function d(y,C){if(!y)return!1;for(let A of C)if(A.includes(".")){let S=A.split(".");if(y.type===ae.MemberExpression&&y.object.type===ae.Identifier&&y.property.type===ae.Identifier&&y.object.name===S[0]&&y.property.name===S[1])return!0}else if(y.type===ae.Identifier&&y.name===A)return!0;return!1}function m(y,C){let A=y.parent;if(A.type!==ae.TaggedTemplateExpression)return!1;let S=l(A.tag);return S?C.includes(S):!1}function u(y,C){if(!y||y.type!==ae.CallExpression)return!1;let{method:A,argumentsLength:S,optionalCall:b=!0,optionalMember:E=!0}=C;return S!==void 0&&y.arguments.length!==S||!b&&y.optional||y.callee.type!==ae.MemberExpression||!E&&y.callee.optional||y.callee.property.type!==ae.Identifier?!1:y.callee.property.name===A}function f(y,C){if(!y||y.type!==ae.CallExpression)return!1;let{name:A,argumentsLength:S,optionalCall:b=!0}=C;return S!==void 0&&y.arguments.length!==S||!b&&y.optional||y.callee.type!==ae.Identifier?!1:y.callee.name===A}function c(y){return u(y.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&y.parent.type===ae.CallExpression&&y.parent.arguments[0]===y&&f(y.parent.callee.type===ae.MemberExpression?y.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function g(y){if(n.length>0){let C=t.getTokenBefore(y,{includeComments:!0});if(C?.type===Vs.Block&&n.includes(C.value.trim().toLowerCase()))return!0}return!!(c(y)||i.length>0&&m(y,i)||r.length>0&&y.parent.type===ae.CallExpression&&y.parent.arguments.includes(y)&&d(y.parent.callee,r))}function T(y){let C=`__PLACEHOLDER__${Math.random()}`,A=y.quasis.map(X=>t.getText(X).slice(1,X.tail?-1:-2)).join(C),S=A.match(Ys);if(!S)return;let b=S[0],E=t.lines[t.getLocFromIndex(y.range[0]).line-1];if(!E)return;let O=E.match(Bs)?.[1]??"",M;typeof s=="string"?M=s:typeof s=="number"?M=" ".repeat(s):M=O.startsWith(" ")?" ":" ";let Y=a(A).replace(new RegExp(`^${b}|${b}[ ]*$`,"g"),""),h=b+p(Y,1,O+M)+b+O,x=A.includes(`\r
|
|
1
|
+
import{AST_NODE_TYPES as T,AST_TOKEN_TYPES as le}from"@typescript-eslint/types";import{z as R}from"zod/v4";import*as ae from"zod/v4";var xe="https://github.com/lucasols/extended-lint#";function $(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=Object.entries(e);return new Map(t)}function pe(e,t){let o={};for(let c of new Set([...e.keys(),...t.keys()])){let l=e.get(c),f=t.get(c);if(e.has(c)&&t.has(c)){let n=$(l),p=$(f);o[c]=n&&p?pe(n,p):f}else o[c]=e.has(c)?l:f}return o}function he(e,t){let o=structuredClone(e);if(!t)return o;let c=o.map((l,f)=>{let n=t[f];if(n===void 0)return l;let p=$(l),i=$(n);return p&&i?pe(p,i):n});return Object.assign(o,c)}function _({name:e,meta:t,create:o,defaultOptions:c}){return{meta:{...t,docs:{...t.docs,url:`${xe}${e}`}},defaultOptions:c,create(l){return o(l,he(c,l.options))}}}function O(e){return{name:e.name,rule:_(e)}}function P(e){return ae.toJSONSchema(e)}var ue="collapse-simple-objs-in-one-line",Ee=R.object({maxLineLength:R.number().optional(),maxProperties:R.number().optional(),nestedObjMaxLineLength:R.number().optional(),nestedObjMaxProperties:R.number().optional(),ignoreTypesWithSuffix:R.array(R.string()).optional()}),be=_({name:ue,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[P(Ee)]},defaultOptions:[{}],create(e,[t]){let o=e.sourceCode,c=t.ignoreTypesWithSuffix??[],l=t.maxProperties??2,f=t.nestedObjMaxLineLength??t.maxLineLength,n=t.nestedObjMaxProperties??3;function p(r){if(r.type===T.ObjectExpression){let y=r.parent.type===T.Property,g=y?n:l,a=r.properties.length;if(a>g)return!1;if(a===1){let m=r.properties[0];return!m||m.type===T.Property&&m.value.type===T.ObjectExpression||m.type===T.Property&&m.value.type===T.ArrayExpression&&!m.value.elements.every(L=>L&&Y(L))?!1:{text:o.getText(m),isNested:y,propsSize:a}}let u=[];for(let m of r.properties){if(m.type===T.Property&&!Y(m.value))return!1;u.push(o.getText(m))}return{text:u.join(", "),isNested:y,propsSize:a}}else{let y=r.parent.parent?.type===T.TSPropertySignature,g=y?n:l,a=r.members.length;if(a>g)return!1;if(c.length>0&&r.parent.type===T.TSTypeAliasDeclaration){let m=r.parent.id.name;if(c.some(d=>m.endsWith(d)))return!1}if(a===1){let m=r.members[0];return!m||m.type===T.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===T.TSTypeLiteral?!1:{text:o.getText(m),isNested:y,propsSize:1}}if(r.parent.type===T.TSIntersectionType||r.parent.type===T.TSUnionType&&r.parent.types[0]!==r)return!1;let u=[];for(let m of r.members){if(m.type!==T.TSPropertySignature)return!1;let d=m.typeAnnotation?.typeAnnotation;if(!d||d.type===T.TSTypeLiteral||!ce(d))return!1;if(d.type===T.TSTypeReference&&d.typeArguments){if(d.typeArguments.params.length>1)return!1;let s=d.typeArguments.params[0];if(!s||!ce(s))return!1}let L=o.getText(m).trim();(L.endsWith(";")||L.endsWith(","))&&(L=L.slice(0,-1)),u.push(L)}return{text:u.join("; "),isNested:y,propsSize:a}}}function i(r){if(r.loc.start.line===r.loc.end.line)return;if(r.parent.type!==T.JSXExpressionContainer){let d=0,L=!1,s=o.getTokenAfter(r,{filter:S=>S.type!==le.Punctuator||L?!0:S.value===","?(d++,!1):S.value===";"?(d++,L=!0,!1):S.value===")"||S.value==="}"?(d++,!1):!0});if(d>4)return;let x=s?.type===le.Template&&s.value.startsWith(`}
|
|
2
|
+
`);if(s?.loc.start.line===r.loc.end.line&&!x)return}let y=p(r);if(!y)return;let g=y.text;if(g.includes(`
|
|
3
|
+
`)||o.getCommentsInside(r).length>0)return;g.endsWith(";")&&(g=g.slice(0,-1));let a=`{ ${g} }`,u=Ce(o,r),m=y.isNested&&y.propsSize>2?f:t.maxLineLength;m&&a.length+u.length+Le(r,o)>m||e.report({node:r,messageId:"singleLineProp",fix:d=>d.replaceText(r,a)})}return{TSTypeLiteral:i,ObjectExpression:i}}});function ce(e){return e.type===T.TSLiteralType||e.type===T.TSTypeReference||e.type===T.TSNumberKeyword||e.type===T.TSStringKeyword||e.type===T.TSBooleanKeyword||e.type===T.TSNullKeyword||e.type===T.TSUndefinedKeyword}function Y(e,t){return!!(e.type===T.Literal||e.type===T.Identifier||e.type===T.TemplateLiteral||e.type===T.TaggedTemplateExpression||!t&&e.type===T.ArrayExpression&&e.elements.every(o=>o&&Y(o,!0)))}function Le(e,t){let o=t.getLastToken(e);if(!o)return 0;let c=t.text.indexOf(`
|
|
4
|
+
`,o.range[1]);return(c!==-1?c:t.text.length)-o.range[1]}function Ce(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var V={name:ue,rule:be};import{AST_NODE_TYPES as X}from"@typescript-eslint/types";import{z as J}from"zod/v4";var Oe=J.object({allow:J.record(J.string(),J.array(J.string())).optional()}),H=O({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[P(Oe)],messages:{noDataAttributesOnComponents:"Avoid using data-* attributes on custom components. Use regular props instead or apply data attributes to the underlying DOM element."}},defaultOptions:[{}],create(e,[t]){let o=t.allow??{};function c(n){let p=n.charAt(0);return p===p.toUpperCase()&&p!==p.toLowerCase()}function l(n){return n.type===X.JSXIdentifier?{name:n.name,isCustom:c(n.name)}:n.type===X.JSXMemberExpression?{name:"",isCustom:!0}:{name:`${n.namespace.name}:${n.name.name}`,isCustom:!1}}function f(n,p){let i=o[n];return i?i.includes(p):!1}return{JSXAttribute(n){if(n.name.type!==X.JSXIdentifier)return;let p=n.name.name;if(!p.startsWith("data-"))return;let i=l(n.parent.name);!i||!i.isCustom||i.name&&f(i.name,p)||e.report({node:n,messageId:"noDataAttributesOnComponents"})}}}});import{z as j}from"zod/v4";var we="no-restricted-comments",Pe=j.object({regex:j.string().optional(),includes:j.string().optional(),message:j.string().optional(),autoFix:j.boolean().optional()}),Ie=j.object({patterns:j.array(Pe)}),Z=O({name:we,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[P(Ie)],messages:{restrictedComment:"Comment matches restricted pattern '{{pattern}}'",restrictedCommentWithMessage:"{{message}}",removeComment:"Remove this comment"}},defaultOptions:[{patterns:[]}],create(e,[t]){let o=e.sourceCode,c=new Map;function l(n){let p=c.get(n);return p||(p=new RegExp(n),c.set(n,p)),p}function f(n,p){return p.regex?l(p.regex).test(n):p.includes?n.includes(p.includes):!1}return{Program(){let n=o.getAllComments();for(let i of n)for(let r of t.patterns)if(f(i.value,r)){let g=function(a){return a.remove(i)};var p=g;let y=r.regex??r.includes??"";r.message?e.report({loc:i.loc,messageId:"restrictedCommentWithMessage",data:{message:r.message},fix:r.autoFix?g:void 0,suggest:r.autoFix?void 0:[{messageId:"removeComment",fix:g}]}):e.report({loc:i.loc,messageId:"restrictedComment",data:{pattern:y},fix:r.autoFix?g:void 0,suggest:r.autoFix?void 0:[{messageId:"removeComment",fix:g}]});break}}}}});import{AST_NODE_TYPES as F}from"@typescript-eslint/types";var ve="no-unnecessary-async-on-jsx-props";function Ae(e){if(e.body.type!==F.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let o=t[0];return!o||o.type!==F.ExpressionStatement?!1:o.expression.type===F.AwaitExpression}var K=O({name:ve,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(o){Ae(o)&&e.report({node:o,messageId:"unnecessaryAsyncInJsxProp",fix(c){let l=e.sourceCode,f=[],n=l.getFirstToken(o,i=>i.value==="async");if(n){let i=l.getTokenAfter(n);i?f.push(c.replaceTextRange([n.range[0],i.range[0]],"")):f.push(c.remove(n))}function p(i){if(i.type===F.AwaitExpression){let r=l.getFirstToken(i);if(r&&r.value==="await"){let y=l.getTokenAfter(r);y?f.push(c.replaceTextRange([r.range[0],y.range[0]],"")):f.push(c.remove(r))}}if(i.type===F.BlockStatement)for(let r of i.body)p(r);else i.type===F.ExpressionStatement&&p(i.expression)}return p(o.body),f}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});import{AST_NODE_TYPES as v}from"@typescript-eslint/types";import*as B from"zod/v4";var Me=B.object({ignoreWithDescription:B.string().optional()}),G=O({name:"no-unnecessary-describe",meta:{type:"suggestion",docs:{description:"Disallow unnecessary describe blocks that wrap all tests in a file"},messages:{unnecessaryDescribe:"Describe blocks that solely wrap all tests in the file are unnecessary, they just add unnecessary nesting to the code. The file itself should be enough to group tests. Remove it.",removeDescribe:"Remove the describe block"},hasSuggestions:!0,schema:[P(Me)]},defaultOptions:[{}],create(e,[t]){let o=e.getSourceCode(),c=o.ast;function l(i){let r=i.arguments[0];return r&&r.type===v.Literal&&typeof r.value=="string"?r.value:null}function f(i){return!i||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(i)}function n(i){return i.length!==1?!1:c.body.filter(y=>{if(y.type===v.ExpressionStatement){let g=y.expression;if(g.type===v.CallExpression&&g.callee.type===v.Identifier){let a=g.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(a)}}return!1}).length===0}function p(i){let r=i.arguments[1];if(r&&(r.type===v.FunctionExpression||r.type===v.ArrowFunctionExpression)&&r.body.type===v.BlockStatement){let y=r.body.body;return y.length===0?"":y.map(a=>o.text.slice(a.range[0],a.range[1])).join(`
|
|
5
|
+
|
|
6
|
+
`)}return""}return{Program(){let i=[];for(let a of c.body)a.type===v.ExpressionStatement&&a.expression.type===v.CallExpression&&a.expression.callee.type===v.Identifier&&a.expression.callee.name==="describe"&&a.expression.arguments.length===2&&i.push(a.expression);if(!n(i))return;let[r]=i;if(!r)return;let y=l(r);if(f(y))return;let g=c.body.find(a=>a.type===v.ExpressionStatement&&a.expression===r);!g||g.type!==v.ExpressionStatement||e.report({node:r,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(a){let u=p(r);return u?a.replaceText(g,u):null}}]})}}}});import{AST_NODE_TYPES as I}from"@typescript-eslint/types";var Q=O({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===I.ObjectPattern||!t.init||t.init.type!==I.ObjectExpression||t.id.type===I.Identifier&&t.id.typeAnnotation||t.parent.parent.type===I.ExportNamedDeclaration)return;let o=new Map;for(let n of t.init.properties)n.type===I.Property&&n.key.type===I.Identifier&&o.set(n.key.name,n);if(o.size===0||t.id.type!==I.Identifier)return;let c=Ne(t,e.sourceCode);if(c.length===0)return;let l=t.init.properties.some(n=>n.type!==I.Property?!1:n.value.type===I.FunctionExpression),f=new Set;for(let n of c){if(n.identifier.parent.type!==I.MemberExpression)return;let p=n.identifier.parent;if(p.object!==n.identifier)return;if(p.computed)if(p.property.type===I.Literal&&typeof p.property.value=="string")f.add(p.property.value);else return;else{if(p.property.type!==I.Identifier)return;f.add(p.property.name)}if(p.parent.type===I.CallExpression&&l)return}for(let[n,p]of o)f.has(n)||e.report({node:p,messageId:"unusedObjectProperty",data:{name:n}})}}}});function Ne(e,t){let o=t.getDeclaredVariables(e);if(o.length!==1)return[];let c=o[0];return c?c.references.filter(l=>l.identifier!==e.id):[]}import{AST_NODE_TYPES as E}from"@typescript-eslint/types";import{z as A}from"zod/v4";var me="react-compiler-migration",Re=A.object({disallowHooks:A.array(A.object({name:A.string(),replacement:A.string()})).optional(),disallowMethods:A.array(A.object({name:A.string(),replacement:A.string().optional(),requireTrueProp:A.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:A.boolean().optional()}),je=/eslint +react-compiler\/react-compiler: +\["error/;function ke(e){let t=null;if((e.type===E.FunctionDeclaration||e.type===E.FunctionExpression||e.type===E.ArrowFunctionExpression&&e.body.type===E.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let o=t.body[0];return o?o.type===E.ExpressionStatement&&o.expression.type===E.Literal&&o.expression.value==="use no memo":!1}function De(e){let t=e.parent;for(;t;){if(t.type===E.FunctionDeclaration||t.type===E.FunctionExpression||t.type===E.ArrowFunctionExpression)return t;t=t.parent}return null}function Fe(e){return e.type===E.Identifier?e.name.startsWith("use"):e.type===E.MemberExpression&&e.property.type===E.Identifier?e.property.name.startsWith("use"):!1}var ze=_({name:me,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[P(Re)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let o=!0;if(t.runOnlyWithEnableCompilerDirective){o=!1;for(let l of e.sourceCode.getAllComments())if(je.test(l.value)){o=!0;break}}if(!o)return{};function c(l){let f=De(l);return f!==null&&ke(f)}return{CallExpression(l){if(t.disallowHooks?.length){let f=null,n=null;if(l.callee.type===E.Identifier?(f=l.callee.name,n=l.callee):l.callee.type===E.MemberExpression&&l.callee.property.type===E.Identifier&&(f=l.callee.property.name,n=l.callee.property),f){let p=t.disallowHooks.find(i=>i.name===f);if(p&&n){if(c(l))return;e.report({node:l,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:p.name,replacement:p.replacement},suggest:[{messageId:"replace",data:{replacement:p.replacement},fix:i=>i.replaceText(n,p.replacement)}]})}}}if(t.disallowMethods?.length&&Fe(l.callee)){for(let f of l.arguments)if(f.type===E.ObjectExpression){for(let n of f.properties)if(n.type===E.Property&&n.key.type===E.Identifier){let p=n.key.name,i=t.disallowMethods.find(r=>r.name===p);if(i){if(c(l))return;if(i.requireTrueProp){let r=i.requireTrueProp,y=!1;for(let g of f.properties)if(g.type===E.Property&&g.key.type===E.Identifier&&g.key.name===r&&g.value.type===E.Literal&&g.value.value===!0){y=!0;break}if(!y){e.report({node:n,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:i.name,requireTrueProp:r}});continue}}i.replacement&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:r=>i.replacement?r.replaceText(n.key,i.replacement):null}]})}}}}}}}}),ee={name:me,rule:ze};import{AST_NODE_TYPES as k}from"@typescript-eslint/types";import{z as D}from"zod/v4";var _e=D.object({fn:D.string().optional(),selector:D.string().optional(),commentPrefix:D.string(),message:D.string().optional()}),Je=D.object({matches:D.array(_e)}),te=O({name:"require-usage-explanation",meta:{type:"problem",docs:{description:"Require explanatory comments with a specific prefix above matched code patterns"},schema:[P(Je)],messages:{default:"{{message}}"}},defaultOptions:[{matches:[]}],create(e,[t]){let o=e.sourceCode,c={},l=[];function f(a){let u=a;for(;u.parent;){let m=u.parent.type;if(m===k.Program||m===k.BlockStatement||m===k.SwitchCase)return u;u=u.parent}}function n(a,u){for(let m of a){let d=m.value.trim();if(d.startsWith(u)&&d.slice(u.length).trim().length>0)return!0}return!1}function p(a){let{callee:u}=a;if(u.type===k.Identifier)return u.name;if(u.type===k.MemberExpression&&u.property.type===k.Identifier)return u.property.name}function i(a,u,m){let d=`Add a comment with prefix "${a}" to explain why "${u}" is being used.`;return m?`${d} ${m}`:d}function r(a,u){let m=f(a);if(!m)return!1;let d=a;for(;d!==m&&d.parent;){let s=o.getCommentsBefore(d);if(n(s,u))return!0;d=d.parent}let L=o.getCommentsBefore(m);return!!n(L,u)}function y(a,u){r(a,u.commentPrefix)||e.report({node:a,messageId:"default",data:{message:i(u.commentPrefix,u.label,u.message)}})}function g(a,u){let m=c[a];m?c[a]=d=>{m(d),u(d)}:c[a]=u}for(let a of t.matches){if(a.fn){let u=a.fn,m={commentPrefix:a.commentPrefix,label:u,message:a.message};l.push(d=>{p(d)===u&&y(d,m)})}if(a.selector){let u={commentPrefix:a.commentPrefix,label:a.selector,message:a.message};g(a.selector,m=>{y(m,u)})}}return l.length>0&&g("CallExpression",a=>{if(a.type===k.CallExpression)for(let u of l)u(a)}),c}});import{AST_NODE_TYPES as C,AST_TOKEN_TYPES as We}from"@typescript-eslint/types";import*as w from"zod/v4";var Ue=/^\s+$/,re=/\r?\n/,qe=/^(\s*)/,$e=/^(\s*)\S/,Be=/\r?\n/,Ye=w.object({indent:w.union([w.string().regex(Ue),w.number().int().min(1)]).optional(),tags:w.array(w.string()).optional(),functions:w.array(w.string()).optional(),comments:w.array(w.string()).optional()}),ne=O({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[P(Ye)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:o=["HTML","indent"],functions:c=["dedent","stripIndent"],tags:l=["outdent","dedent","gql","sql","html","styled"],indent:f}=e.options[0],n=o.map(s=>s.toLowerCase());function p(s){let x=s.split(re),S=x.filter(b=>b.trim()!=="");if(S.length===0)return s;let h=Number.POSITIVE_INFINITY;for(let b of S){let N=b.match(qe);N&&(h=Math.min(h,N[1]?.length??0))}return!isFinite(h)||h===0?s:x.map(b=>b.slice(h)).join(`
|
|
7
|
+
`)}function i(s,x,S){return s.split(re).map(b=>b.trim()===""?b:S.repeat(x)+b).join(`
|
|
8
|
+
`)}function r(s){if(s.type===C.Identifier)return s.name;if(s.type===C.MemberExpression){let x=s.object.type===C.Identifier?s.object.name:null,S=s.property.type===C.Identifier?s.property.name:null;return x&&S?`${x}.${S}`:S}return null}function y(s,x){if(!s)return!1;for(let S of x)if(S.includes(".")){let h=S.split(".");if(s.type===C.MemberExpression&&s.object.type===C.Identifier&&s.property.type===C.Identifier&&s.object.name===h[0]&&s.property.name===h[1])return!0}else if(s.type===C.Identifier&&s.name===S)return!0;return!1}function g(s,x){let S=s.parent;if(S.type!==C.TaggedTemplateExpression)return!1;let h=r(S.tag);return h?x.includes(h):!1}function a(s,x){if(!s||s.type!==C.CallExpression)return!1;let{method:S,argumentsLength:h,optionalCall:b=!0,optionalMember:N=!0}=x;return h!==void 0&&s.arguments.length!==h||!b&&s.optional||s.callee.type!==C.MemberExpression||!N&&s.callee.optional||s.callee.property.type!==C.Identifier?!1:s.callee.property.name===S}function u(s,x){if(!s||s.type!==C.CallExpression)return!1;let{name:S,argumentsLength:h,optionalCall:b=!0}=x;return h!==void 0&&s.arguments.length!==h||!b&&s.optional||s.callee.type!==C.Identifier?!1:s.callee.name===S}function m(s){return a(s.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&s.parent.type===C.CallExpression&&s.parent.arguments[0]===s&&u(s.parent.callee.type===C.MemberExpression?s.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function d(s){if(n.length>0){let x=t.getTokenBefore(s,{includeComments:!0});if(x?.type===We.Block&&n.includes(x.value.trim().toLowerCase()))return!0}return!!(m(s)||l.length>0&&g(s,l)||c.length>0&&s.parent.type===C.CallExpression&&s.parent.arguments.includes(s)&&y(s.parent.callee,c))}function L(s){let x=`__PLACEHOLDER__${Math.random()}`,S=s.quasis.map(M=>t.getText(M).slice(1,M.tail?-1:-2)).join(x),h=S.match(Be);if(!h)return;let b=h[0],N=t.lines[t.getLocFromIndex(s.range[0]).line-1];if(!N)return;let W=N.match($e)?.[1]??"",z;typeof f=="string"?z=f:typeof f=="number"?z=" ".repeat(f):z=W.startsWith(" ")?" ":" ";let ge=p(S).replace(new RegExp(`^${b}|${b}[ ]*$`,"g"),""),oe=b+i(ge,1,W+z)+b+W,ye=S.includes(`\r
|
|
27
9
|
`)?`\r
|
|
28
10
|
`:`
|
|
29
|
-
`,
|
|
30
|
-
`)}
|
|
31
|
-
${O}`),b.push($)}yield g.insertTextBeforeRange([S,S],`${b.join(`
|
|
32
|
-
|
|
33
|
-
`)}
|
|
34
|
-
|
|
35
|
-
`)}}}return{Program(c){i.push(...c.body)},TSTypeAliasDeclaration(c){if(i.some(T=>T.type===pe.ExportNamedDeclaration&&T.declaration===c?!0:T===c)){let T=s(c);T&&r.set(c.id.name,{node:c,name:c.id.name,statement:T})}},TSInterfaceDeclaration(c){if(i.some(T=>T.type===pe.ExportNamedDeclaration&&T.declaration===c?!0:T===c)){let T=s(c);T&&r.set(c.id.name,{node:c,name:c.id.name,statement:T})}},TSTypeReference(c){if(c.typeName.type===pe.Identifier){if(d(c))return;let g=n(c),T=a(c),y=p(c);m.push({typeName:c.typeName.name,node:c,inFunctionArgs:g,inFCProps:T,inGenericArgAtFunctionCall:y,usagePosition:c.range[0]})}},"Program:exit"(){let c=new Map;function g(y){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let C of t.checkOnly)if(C==="function-args"&&y.inFunctionArgs||C==="FC"&&y.inFCProps||C==="generic-args-at-fn-calls"&&y.inGenericArgAtFunctionCall)return!0;return!1}for(let y of m){let{typeName:C,node:A}=y;if(!r.has(C)||!g(y))continue;let S=s(A),b=r.get(C);if(!S||!b||S===b.statement)continue;c.has(C)||c.set(C,[]);let E=c.get(C);if(!E)return;E.includes(S)||E.push(S)}let T=[];for(let[y,C]of c)if(C.length>0){if(C.length===0)continue;let A=C[0];if(!A)continue;let S=Number.MAX_SAFE_INTEGER,b=!1;for(let I of C)I.range[0]<A.range[0]&&(A=I);for(let I of m)g(I)&&I.typeName===y&&s(I.node)===A&&I.usagePosition<S&&(S=I.usagePosition,b=I.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let I=Number.MAX_SAFE_INTEGER;for(let M of m){if(M.typeName!==y)continue;let $=s(M.node);if(!$)continue;let Y=i.indexOf($);Y!==-1&&Y<I&&(I=Y)}let O=i.indexOf(A);if(I!==Number.MAX_SAFE_INTEGER&&O!==-1&&I<O)continue}else{let I=Number.MAX_SAFE_INTEGER;for(let M of m){if(M.typeName!==y||l(M.node))continue;let $=s(M.node);if(!$)continue;let Y=i.indexOf($);Y!==-1&&Y<I&&(I=Y)}let O=i.indexOf(A);if(I!==Number.MAX_SAFE_INTEGER&&O!==-1&&I<O)continue}T.push({typeName:y,firstUsage:A,firstUsagePosition:S,firstUsageInFunctionArgs:b})}T.length>0&&u(T)}}}});import{AST_NODE_TYPES as V}from"@typescript-eslint/utils";import*as Je from"zod/v4";var Ks=["tsx"],Qs=/^[A-Z][A-Za-z0-9]*$/,ea=Je.object({extensions:Je.array(Je.string()).optional()}),tn=D({name:"react-single-export",meta:{type:"problem",docs:{description:"Enforces only one export per React component file to support fast refresh"},messages:{multipleExports:"React component files should have only one export to support fast refresh, if you want to export multiple components, use a separate file for each component. Type-only exports are allowed."},schema:[k(ea)]},defaultOptions:[{}],create(e,[t]){let o=e.getFilename(),r=t.extensions??Ks,i=!1;for(let S of r)if(o.endsWith(S)){i=!0;break}if(!i)return{};let s=e.sourceCode,n=new Set,a=new Map;function p(S){return Qs.test(S)}function l(S){if(S.type!==V.CallExpression)return!1;let b=S.callee;return b.type===V.Identifier?b.name==="memo"||b.name==="forwardRef":b.type===V.MemberExpression&&b.property.type===V.Identifier?b.property.name==="memo"||b.property.name==="forwardRef":!1}function d(S){if(S.type===V.JSXElement||S.type===V.JSXFragment)return!0;if(S.type===V.ArrayExpression){for(let b of S.elements)if(b&&(b.type===V.JSXElement||b.type===V.JSXFragment))return!0}return!1}function m(S){if(S.type!==V.ArrowFunctionExpression)return!1;let b=S.body;if(b.type===V.ArrowFunctionExpression){let E=b.body;if(d(E))return!0}return!1}function u(S){if(S.id.type!==V.Identifier)return;let b=S.id.name,E=S.init;if(E){if(p(b)&&(E.type===V.ArrowFunctionExpression||E.type===V.FunctionExpression||l(E))){n.add(b);return}E.type===V.Identifier&&a.set(b,E.name),p(b)||m(E)&&n.add(b)}}function f(S){if(S.type===V.VariableDeclaration){for(let b of S.declarations)u(b);return}if(S.type===V.FunctionDeclaration&&S.id){p(S.id.name)&&n.add(S.id.name);return}if(S.type===V.ExportNamedDeclaration&&S.declaration){let b=S.declaration;if(b.type===V.VariableDeclaration){for(let E of b.declarations)u(E);return}if(b.type===V.FunctionDeclaration&&b.id){p(b.id.name)&&n.add(b.id.name);return}}}for(let S of s.ast.body)f(S);function c(S,b=new Set){if(n.has(S))return!0;if(b.has(S))return!1;b.add(S);let E=a.get(S);return E?c(E,b):!1}let g=[];function T(S,b,E){g.push({node:S,isType:b,isComponent:E})}for(let S of s.ast.body){if(S.type===V.ExportNamedDeclaration){let b=S.exportKind==="type";if(S.declaration){let E=S.declaration;if(E.type===V.TSTypeAliasDeclaration||E.type===V.TSInterfaceDeclaration){T(E,!0,!1);continue}if(E.type===V.VariableDeclaration){for(let I of E.declarations){if(I.id.type!==V.Identifier)continue;let O=I.id.name,M=c(O);T(I,b,M)}continue}if(E.type===V.FunctionDeclaration){let I=E.id?.name,O=I?c(I)||p(I):!1;T(E,b,O);continue}T(E,b,!1);continue}if(S.specifiers.length>0)for(let E of S.specifiers){if(E.local.type!==V.Identifier)continue;let I=E.local.name,O=c(I);T(E,b,O)}continue}if(S.type===V.ExportDefaultDeclaration){let b=S.declaration;if(b.type===V.Identifier){let E=c(b.name)||p(b.name);T(S,!1,E);continue}if(b.type===V.FunctionDeclaration||b.type===V.ArrowFunctionExpression||b.type===V.FunctionExpression||b.type===V.CallExpression){T(S,!1,!0);continue}T(S,!1,!1);continue}}let y=!1;for(let S of g)if(!S.isType&&S.isComponent){y=!0;break}if(!y)return{};let C=[];for(let S of g)S.isType||C.push(S);let A=-1;for(let[S,b]of C.entries())if(b.isComponent){A=S;break}if(A===-1)return{};for(let[S,b]of C.entries())if(S!==A){e.report({node:b.node,messageId:"multipleExports"});break}return{}}});import{AST_NODE_TYPES as Fe}from"@typescript-eslint/utils";import{z as nn}from"zod/v4";function st(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ta(e){return e.callee.type===Fe.Identifier?e.callee.name==="useState":e.callee.type===Fe.MemberExpression&&e.callee.object.type===Fe.Identifier&&e.callee.property.type===Fe.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var na=nn.object({ignorePrefixes:nn.array(nn.string()).optional()});function xr(e,t){for(let o of t)if(e.startsWith(o))return e.slice(o.length);return e}function ra(e){return`set${st(e)}`}var rn=D({name:"use-state-setter-naming",meta:{type:"problem",docs:{description:"Enforce consistent naming convention for useState destructuring where setter should be set{Value}"},messages:{incorrectSetterName:'useState setter should follow the pattern "set{{expectedName}}" with a "set" prefix but got "{{actualName}}"',useSuggestedName:'Use "{{expectedSetterName}}" instead'},hasSuggestions:!0,schema:[k(na)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(o){if(!o.init||o.init.type!==Fe.CallExpression||!ta(o.init)||o.id.type!==Fe.ArrayPattern||o.id.elements.length!==2)return;let[r,i]=o.id.elements;if(!r||!i||r.type!==Fe.Identifier||i.type!==Fe.Identifier)return;let s=r.name,n=i.name,a=t.ignorePrefixes||[],p=xr(s,a),l=xr(n,a);if(p===""){if(!l.startsWith("set")){let m=`set${st(s)}`;e.report({node:i,messageId:"incorrectSetterName",data:{expectedName:st(s),actualName:n},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:m},fix:u=>u.replaceText(i,m)}]})}return}let d=ra(p);l!==d&&e.report({node:i,messageId:"incorrectSetterName",data:{expectedName:st(p),actualName:n},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:d},fix:m=>m.replaceText(i,d)}]})}}}});import{AST_NODE_TYPES as ie}from"@typescript-eslint/utils";import{z as Ve}from"zod/v4";var oa=Ve.object({name:Ve.string(),defaults:Ve.array(Ve.unknown())}),ia=Ve.object({functions:Ve.array(oa)});function at(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((i,s)=>at(i,t[s]));let o=Object.keys(e),r=Object.keys(t);if(o.length!==r.length)return!1;for(let i of o){if(!r.includes(i))return!1;let s=Object.getOwnPropertyDescriptor(e,i),n=Object.getOwnPropertyDescriptor(t,i);if(!s||!n)return!1;let a=s.value,p=n.value;if(!at(a,p))return!1}return!0}function sa(e,t){let o=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return o;for(let r in e){if(!(r in t))continue;let i=Object.getOwnPropertyDescriptor(e,r),s=Object.getOwnPropertyDescriptor(t,r);i&&s&&at(i.value,s.value)&&o.add(r)}return o}function hr(e){if(e.type===ie.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case ie.Literal:return e.value;case ie.ObjectExpression:{let t={};for(let o of e.properties)o.type===ie.Property&&o.key.type===ie.Identifier&&!o.computed&&(o.value.type===ie.Literal?t[o.key.name]=o.value.value:o.value.type===ie.ObjectExpression?t[o.key.name]=hr(o.value):t[o.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case ie.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===ie.SpreadElement))return t.type===ie.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function aa(e){return e.type===ie.Identifier?e.name:e.type===ie.MemberExpression&&e.property.type===ie.Identifier&&!e.computed?e.property.name:null}var on=D({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParams:"Function call has redundant parameters matching its default values and can be removed: {{details}}"},fixable:"code",schema:[k(ia)]},defaultOptions:[{functions:[]}],create(e,[t]){let o=new Map;for(let r of t.functions)o.set(r.name,r.defaults);return{CallExpression(r){let i=aa(r.callee);if(!i)return;let s=o.get(i);if(!s)return;let n=r.arguments;if(n.length===0)return;let a=-1,p=!1,l=new Map,d=new Set,m=new Map,u=[];for(let c=0;c<n.length;c++){if(c>=s.length){a=c;continue}let g=s[c],T=n[c];if(!T||T.type===ie.SpreadElement){a=c;continue}let y=hr(T);if(g===void 0){a=c;continue}if(at(y,g)){T.type===ie.ObjectExpression?(d.add(c),u.push({type:"object",position:c+1})):(m.set(c,y),u.push({type:"simple",position:c+1,value:y}));continue}if(T.type===ie.ObjectExpression&&T.properties.length===0&&typeof g=="object"&&g!==null&&Object.keys(g).length>0){d.add(c),u.push({type:"object",position:c+1});continue}let C=sa(y,g);if(C.size>0){let A=typeof g=="object"&&g!==null?Object.keys(g).length:0;if(T.type===ie.ObjectExpression&&T.properties.length===C.size&&T.properties.length===A){d.add(c),u.push({type:"object",position:c+1});continue}else p=!0,l.set(c,C),u.push({type:"partialObject",position:c+1,redundantProperties:Array.from(C)}),a=c}else a=c}if(a<n.length-1||p||d.size>0){let c=function(){let T=[];for(let y of u)if(y.type==="simple")T.push(`Param ${y.position} with value ${JSON.stringify(y.value)}`);else if(y.type==="object")T.push(`Param ${y.position} (object)`);else{let C=y.redundantProperties||[],A=s?s[y.position-1]:void 0;if(typeof A=="object"&&A!==null){let S=A;for(let b of C)if(b in S){let E=Object.getOwnPropertyDescriptor(S,b);E&&T.push(`Param ${y.position} property "${b}" with value ${JSON.stringify(E.value)}`)}}}return{messageId:"redundantParams",data:{details:T.join(", ")}}};var f=c;let g=c();e.report({node:r,messageId:g.messageId,data:g.data,fix(T){let y=[];if(p)for(let[A,S]of l){let b=n[A];if(b&&b.type===ie.ObjectExpression){let E=[];for(let O of b.properties)O.type===ie.Property&&O.key.type===ie.Identifier&&!O.computed&&S.has(O.key.name)||E.push(O);let I=E.map(O=>e.sourceCode.getText(O));y.push(T.replaceText(b,`{ ${I.join(", ")} }`))}}let C=-1;for(let A=n.length-1;A>=0;A--)if(!d.has(A)&&A<=a){C=A;break}if(C<n.length-1)if(C===-1){let A=e.sourceCode.getTokenAfter(r.callee),S=e.sourceCode.getLastToken(r);A&&S&&y.push(T.replaceTextRange([A.range[1],S.range[0]],""))}else{let A=n[C],S=e.sourceCode.getLastToken(r);S&&A&&y.push(T.replaceTextRange([A.range[1],S.range[0]],""))}return y.length>0?y:null}})}}}}});import{AST_NODE_TYPES as ge}from"@typescript-eslint/utils";function pa(e){let t=e.parent;for(;t;){if(t.type===ge.AwaitExpression||t.type===ge.MemberExpression&&t.object===e&&t.property.type===ge.Identifier&&t.property.name==="then"||t.type===ge.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===ge.ArrayExpression&&t.parent.type===ge.CallExpression){let o=t.parent;if(o.callee.type===ge.MemberExpression&&o.callee.object.type===ge.Identifier&&o.callee.object.name==="Promise"&&o.callee.property.type===ge.Identifier&&["all","allSettled","race"].includes(o.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function la(e){let{callee:t}=e;return t.type===ge.Identifier&&t.name==="require"||t.type===ge.MemberExpression&&t.object.type===ge.Identifier&&t.object.name==="require"}var sn=D({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(t){pa(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){la(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});import{AST_NODE_TYPES as R}from"@typescript-eslint/utils";import{z as an}from"zod/v4";var ca=an.object({mainComponentRegex:an.string().optional(),mainComponentSelector:an.string().optional()}),ua=/^[A-Z][A-Za-z0-9]*$/,pn=D({name:"sort-react-components-and-styles",meta:{type:"suggestion",docs:{description:"Sort React components and styles with styles placed above their first usage"},fixable:"code",schema:[k(ca)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let o=e.sourceCode,r=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,i=t.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let n=new Set,a=new Map,p=[],l=[],d=new Set;function m(h){let x=h.node;if(x.type===R.VariableDeclaration){for(let P of x.declarations)if(P.id.type===R.Identifier&&P.id.name===h.name&&P.init)return P.init}if(x.type===R.ExportNamedDeclaration){let P=x.declaration;if(P&&P.type===R.VariableDeclaration){for(let j of P.declarations)if(j.id.type===R.Identifier&&j.id.name===h.name&&j.init)return j.init}}return null}function u(h){let x=new Set;return Pe(h,P=>(P.type===R.Identifier&&P.name!=="styled"&&P.name!=="css"&&x.add(P.name),!1),o),x}function f(h){return ua.test(h)}function c(h){if(h.type!==R.CallExpression)return!1;let x=h.callee;return x.type===R.Identifier?x.name==="memo"||x.name==="forwardRef":x.type===R.MemberExpression&&x.property.type===R.Identifier?x.property.name==="memo"||x.property.name==="forwardRef":!1}function g(h){if(h.type===R.JSXElement||h.type===R.JSXFragment)return!0;if(h.type===R.BlockStatement){for(let x of h.body)if(x.type===R.ReturnStatement&&x.argument)return g(x.argument)}if(h.type===R.ArrayExpression){for(let x of h.elements)if(x&&(x.type===R.JSXElement||x.type===R.JSXFragment))return!0}return!1}function T(h){if(h.type!==R.ArrowFunctionExpression)return!1;let x=h.body;if(x.type===R.ArrowFunctionExpression){let P=x.body;if(g(P))return!0}return!1}function y(h){if(h.type===R.TaggedTemplateExpression){let x=h.tag;if(x.type===R.MemberExpression&&x.object.type===R.Identifier&&x.object.name==="styled")return!0;if(x.type===R.CallExpression){let P=x.callee;if(P.type===R.Identifier&&P.name==="styled")return!0}}return!1}function C(h){if(h.type===R.TaggedTemplateExpression){let x=h.tag;if(x.type===R.Identifier&&x.name==="css")return!0}return!1}function A(h,x){if(h.id.type!==R.Identifier)return;let P=h.id.name,j=h.init;if(j){if(y(j)||C(j)){l.push({node:x,name:P});return}if((f(P)||j.type===R.ArrowFunctionExpression)&&(j.type===R.ArrowFunctionExpression||j.type===R.FunctionExpression||c(j))){if(j.type===R.ArrowFunctionExpression||j.type===R.FunctionExpression){if(g(j.body)){n.add(P);return}}else if(c(j)){n.add(P);return}}j.type===R.Identifier&&a.set(P,j.name),f(P)||T(j)&&n.add(P)}}function S(h){return h.type===R.ExportDefaultDeclaration||h.type===R.ExportNamedDeclaration}function b(h){if(h.type===R.FunctionDeclaration)return h.id?h.id.name:null;if(h.type===R.VariableDeclaration){let x=h.declarations[0];if(x&&x.id.type===R.Identifier)return x.id.name}if(h.type===R.ExportDefaultDeclaration){let x=h.declaration;if(x.type===R.FunctionDeclaration)return x.id?x.id.name:"default";if(x.type===R.Identifier)return x.name}if(h.type===R.ExportNamedDeclaration){let x=h.declaration;if(x&&x.type===R.FunctionDeclaration)return x.id?x.id.name:null;if(x&&x.type===R.VariableDeclaration){let P=x.declarations[0];if(P&&P.id.type===R.Identifier)return P.id.name}}return null}function E(h,x){return i?d.has(h):r?r.test(x):S(h)}function I(h){let x=new Set;Pe(h.node,P=>{if(P.type===R.Identifier)for(let j of l)j.name===P.name&&(x.add(j.name),(j.firstUsagePosition===void 0||P.range[0]<j.firstUsagePosition)&&(j.firstUsagePosition=P.range[0]));if(P.type===R.JSXElement){let j=P.openingElement;if(j.name.type===R.JSXIdentifier)for(let X of l)X.name===j.name.name&&(x.add(X.name),(X.firstUsagePosition===void 0||j.name.range[0]<X.firstUsagePosition)&&(X.firstUsagePosition=j.name.range[0]))}return!1},o),h.usedStyles=x}function O(h){if(h.type===R.VariableDeclaration){for(let x of h.declarations)A(x,h);return}if(h.type===R.FunctionDeclaration){f(h.id.name)&&g(h.body)&&n.add(h.id.name);return}if(h.type===R.ExportNamedDeclaration&&h.declaration){let x=h.declaration;if(x.type===R.VariableDeclaration){for(let P of x.declarations)A(P,h);return}if(x.type===R.FunctionDeclaration&&x.id){f(x.id.name)&&g(x.body)&&n.add(x.id.name);return}}if(h.type===R.ExportDefaultDeclaration){let x=h.declaration;x.type===R.Identifier&&n.add(x.name),(x.type===R.FunctionDeclaration||x.type===R.ArrowFunctionExpression||x.type===R.FunctionExpression)&&(x.type===R.FunctionDeclaration?x.id?n.add(x.id.name):n.add("default"):g(x.body)&&n.add("default"))}}function M(h,x=new Set){if(n.has(h))return!0;if(x.has(h))return!1;x.add(h);let P=a.get(h);return P?M(P,x):!1}let $={};return i&&($[i]=h=>{let x=h;for(;x.parent&&x.parent.type!==R.Program;)x=x.parent;x.parent&&(x.type===R.VariableDeclaration||x.type===R.FunctionDeclaration||x.type===R.ExportNamedDeclaration||x.type===R.ExportDefaultDeclaration)&&d.add(x)}),$["Program:exit"]=h=>{let x=0;for(let F of h.body){if(F.type===R.ImportDeclaration){x+=1;continue}break}for(let F of h.body)O(F);for(let F of h.body){let z=b(F);if(z&&M(z)){let L=E(F,z);p.push({node:F,name:z,isMainComponent:L,usedStyles:new Set,isExported:S(F)})}}if(!i&&r&&!p.some(F=>F.isMainComponent))for(let F of p)F.isExported&&(F.isMainComponent=!0);for(let F of p)I(F);let P=new Set;for(let F of l)P.add(F.name);let j=new Map;for(let F=0;F<h.body.length;F+=1){let z=h.body[F];for(let L of l)L.node===z&&j.set(L.name,F)}let X=new Map;for(let F of l){let z=m(F),L=new Set;if(z){let se=u(z);for(let le of se)P.has(le)&&le!==F.name&&L.add(le)}X.set(F.name,L)}let W=new Map;for(let F of l){let z=X.get(F.name);if(!z)continue;let L=j.get(F.name);if(L!==void 0)for(let se of z){let le=W.get(se);(le===void 0||L<le)&&W.set(se,L)}}let ee=[];for(let F of l){if(F.firstUsagePosition===void 0)continue;let z=h.body.indexOf(F.node),L=-1;for(let me of p){if(!me.usedStyles.has(F.name))continue;let he=h.body.indexOf(me.node);(L===-1||he<L)&&(L=he)}let se=W.get(F.name);if(se!==void 0&&(L===-1||se<L)&&(L=se),L===-1)continue;let le=-1;for(let me of p){let he=h.body.indexOf(me.node);he<L&&he>le&&(le=he)}let xe=z<L,pt=z>le,Ae=-1,yn=X.get(F.name);if(yn)for(let me of yn){let he=j.get(me);he!==void 0&&he>Ae&&(Ae=he)}let Ir=z>Ae;if(!(xe&&pt&&Ir)){let me=le+1;if(Ae+1>me&&(me=Ae+1),me<x&&(me=x),me>L)continue;ee.push({style:F,targetPosition:me})}}let G=null;if(p.length>1){let F=p.map(L=>({c:L,idx:h.body.indexOf(L.node)})).sort((L,se)=>L.idx-se.idx)[0]?.c,z=p.find(L=>L.isMainComponent)||null;F&&z&&F.node!==z.node&&(G={component:z,targetBefore:F.node})}if(ee.length>0||G){let F=ee[0]?.style.node||G?.component.node||h,z=ee.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:F,messageId:z,fix:Y(ee,G,h.body)})}},$;function Y(h,x,P){return function*(j){h.sort((W,ee)=>W.targetPosition-ee.targetPosition);for(let{style:W}of h){let ee=o.getCommentsBefore(W.node),G=W.node.range[0],F=W.node.range[1];ee.length>0&&ee[0]&&(G=ee[0].range[0]),G===W.node.range[0]&&o.text.slice(0,G).trim().length===0&&(G=0),yield j.removeRange([G,F])}let X=new Map;for(let W of h){let ee=X.get(W.targetPosition)||[];ee.push(W),X.set(W.targetPosition,ee)}for(let[W,ee]of X){let G=P[W];if(!G)continue;let F=o.getCommentsBefore(G),z=F.length>0&&F[0]?F[0].range[0]:G.range[0],L=[];for(let{style:se}of ee){let le=o.getCommentsBefore(se.node),xe=o.getText(se.node);le.length>0&&(xe=`${le.map(Ae=>o.getText(Ae)).join(`
|
|
36
|
-
`)}
|
|
37
|
-
${xe}`),L.push(xe)}yield j.insertTextBeforeRange([z,z],`${L.join(`
|
|
38
|
-
|
|
39
|
-
`)}
|
|
40
|
-
|
|
41
|
-
`)}if(x){let{component:W,targetBefore:ee}=x,G=o.getCommentsBefore(W.node),F=W.node.range[0],z=W.node.range[1];G.length>0&&G[0]&&(F=G[0].range[0]),F===W.node.range[0]&&o.text.slice(0,F).trim().length===0&&(F=0);let L=o.getCommentsBefore(ee),se=L.length>0&&L[0]?L[0].range[0]:ee.range[0],le=(()=>{let xe=o.getText(W.node);return G.length>0&&(xe=`${G.map(Ae=>o.getText(Ae)).join(`
|
|
42
|
-
`)}
|
|
43
|
-
${xe}`),xe})();yield j.removeRange([F,z]),yield j.insertTextBeforeRange([se,se],`${le}
|
|
44
|
-
`)}}}}});import{AST_NODE_TYPES as fe}from"@typescript-eslint/utils";import{z as Ze}from"zod/v4";var fa=Ze.object({functions:Ze.array(Ze.string()).optional(),selectors:Ze.array(Ze.string()).optional()});function br(e){let t=e.parent;for(;t;){if(t.type===fe.FunctionDeclaration||t.type===fe.FunctionExpression||t.type===fe.ArrowFunctionExpression)return!0;t=t.parent}return!1}function Cr(e){if(e.type===fe.TaggedTemplateExpression){let{tag:o}=e;return o.type===fe.Identifier?o.name:o.type===fe.MemberExpression&&o.property.type===fe.Identifier?o.property.name:null}let{callee:t}=e;return t.type===fe.Identifier?t.name:t.type===fe.MemberExpression&&t.property.type===fe.Identifier?t.property.name:null}var ln=D({name:"require-lazy-execution",meta:{type:"problem",docs:{description:"Require certain function calls to be executed lazily (inside functions, not at module level)"},messages:{moduleLevel:'Function "{{ functionName }}" must only be called inside functions or getters, not at module level'},schema:[k(fa)]},defaultOptions:[{functions:[],selectors:[]}],create(e){let[t]=e.options,o=new Set(t.functions??[]),r=t.selectors??[];function i(n){if(br(n))return;let a=Cr(n);a&&o.has(a)&&e.report({node:n,messageId:"moduleLevel",data:{functionName:a}})}let s={CallExpression(n){n.type===fe.CallExpression&&i(n)},TaggedTemplateExpression(n){n.type===fe.TaggedTemplateExpression&&i(n)}};for(let n of r)s[n]=a=>{if(a.type!==fe.CallExpression&&a.type!==fe.TaggedTemplateExpression||br(a))return;let p=Cr(a);p&&e.report({node:a,messageId:"moduleLevel",data:{functionName:p}})};return s}});import{AST_NODE_TYPES as Se}from"@typescript-eslint/utils";function ma(e,t){let{body:o}=e;if(o.type!==Se.BlockStatement)return t.getText(o);let r=o.body[0];return!r||r.type!==Se.ReturnStatement?"":r.argument?t.getText(r.argument):"undefined"}function da(e){let t=e.parent;if(t.type!==Se.ReturnStatement)return null;let o=t.parent;if(o.type!==Se.BlockStatement||o.body.length!==1)return null;let r=o.parent;return r.type!==Se.FunctionDeclaration&&r.type!==Se.ArrowFunctionExpression&&r.type!==Se.FunctionExpression?null:{parentFunction:r,returnStatement:t}}var cn=D({name:"no-unnecessary-iife",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary immediately invoked function expressions"},messages:{unnecessaryIife:"Unnecessary IIFE. Can be simplified to the returned expression."},schema:[]},defaultOptions:[],create(e){let t=e.sourceCode;return{CallExpression(o){let{callee:r,arguments:i}=o;if(i.length>0||r.type!==Se.FunctionExpression&&r.type!==Se.ArrowFunctionExpression||r.async||r.params.length>0)return;let{body:s}=r;if(s.type===Se.BlockStatement){if(s.body.length!==1){let l=da(o);if(l){if(t.getCommentsInside(r).length>0)return;let m=t.getText(s);e.report({node:o,messageId:"unnecessaryIife",fix:u=>{let{parentFunction:f}=l;return f.body.type!==Se.BlockStatement?null:u.replaceText(f.body,m)}})}return}let p=s.body[0];if(!p||p.type!==Se.ReturnStatement)return}if(t.getCommentsInside(r).length>0)return;let a=ma(r,t);e.report({node:o,messageId:"unnecessaryIife",fix:p=>p.replaceText(o,a)})}}}});import{z as je}from"zod/v4";var ya="no-restricted-comments",ga=je.object({regex:je.string().optional(),includes:je.string().optional(),message:je.string().optional(),autoFix:je.boolean().optional()}),Sa=je.object({patterns:je.array(ga)}),un=D({name:ya,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[k(Sa)],messages:{restrictedComment:"Comment matches restricted pattern '{{pattern}}'",restrictedCommentWithMessage:"{{message}}",removeComment:"Remove this comment"}},defaultOptions:[{patterns:[]}],create(e,[t]){let o=e.sourceCode,r=new Map;function i(n){let a=r.get(n);return a||(a=new RegExp(n),r.set(n,a)),a}function s(n,a){return a.regex?i(a.regex).test(n):a.includes?n.includes(a.includes):!1}return{Program(){let n=o.getAllComments();for(let p of n)for(let l of t.patterns)if(s(p.value,l)){let m=function(u){return u.remove(p)};var a=m;let d=l.regex??l.includes??"";l.message?e.report({loc:p.loc,messageId:"restrictedCommentWithMessage",data:{message:l.message},fix:l.autoFix?m:void 0,suggest:l.autoFix?void 0:[{messageId:"removeComment",fix:m}]}):e.report({loc:p.loc,messageId:"restrictedComment",data:{pattern:d},fix:l.autoFix?m:void 0,suggest:l.autoFix?void 0:[{messageId:"removeComment",fix:m}]});break}}}}});import{AST_NODE_TYPES as fn}from"@typescript-eslint/utils";import{z as Ge}from"zod/v4";var Ta=Ge.object({allow:Ge.record(Ge.string(),Ge.array(Ge.string())).optional()}),mn=D({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[k(Ta)],messages:{noDataAttributesOnComponents:"Avoid using data-* attributes on custom components. Use regular props instead or apply data attributes to the underlying DOM element."}},defaultOptions:[{}],create(e,[t]){let o=t.allow??{};function r(n){let a=n.charAt(0);return a===a.toUpperCase()&&a!==a.toLowerCase()}function i(n){return n.type===fn.JSXIdentifier?{name:n.name,isCustom:r(n.name)}:n.type===fn.JSXMemberExpression?{name:"",isCustom:!0}:{name:`${n.namespace.name}:${n.name.name}`,isCustom:!1}}function s(n,a){let p=o[n];return p?p.includes(a):!1}return{JSXAttribute(n){if(n.name.type!==fn.JSXIdentifier)return;let a=n.name.name;if(!a.startsWith("data-"))return;let p=i(n.parent.name);!p||!p.isCustom||p.name&&s(p.name,a)||e.report({node:n,messageId:"noDataAttributesOnComponents"})}}}});import{AST_NODE_TYPES as Me}from"@typescript-eslint/utils";import{z as Le}from"zod/v4";var Ea=Le.object({fn:Le.string().optional(),selector:Le.string().optional(),commentPrefix:Le.string(),message:Le.string().optional()}),xa=Le.object({matches:Le.array(Ea)}),dn=D({name:"require-usage-explanation",meta:{type:"problem",docs:{description:"Require explanatory comments with a specific prefix above matched code patterns"},schema:[k(xa)],messages:{default:"{{message}}"}},defaultOptions:[{matches:[]}],create(e,[t]){let o=e.sourceCode,r={},i=[];function s(u){let f=u;for(;f.parent;){let c=f.parent.type;if(c===Me.Program||c===Me.BlockStatement||c===Me.SwitchCase)return f;f=f.parent}}function n(u,f){for(let c of u){let g=c.value.trim();if(g.startsWith(f)&&g.slice(f.length).trim().length>0)return!0}return!1}function a(u){let{callee:f}=u;if(f.type===Me.Identifier)return f.name;if(f.type===Me.MemberExpression&&f.property.type===Me.Identifier)return f.property.name}function p(u,f,c){let g=`Add a comment with prefix "${u}" to explain why "${f}" is being used.`;return c?`${g} ${c}`:g}function l(u,f){let c=s(u);if(!c)return!1;let g=u;for(;g!==c&&g.parent;){let y=o.getCommentsBefore(g);if(n(y,f))return!0;g=g.parent}let T=o.getCommentsBefore(c);return!!n(T,f)}function d(u,f){l(u,f.commentPrefix)||e.report({node:u,messageId:"default",data:{message:p(f.commentPrefix,f.label,f.message)}})}function m(u,f){let c=r[u];c?r[u]=g=>{c(g),f(g)}:r[u]=f}for(let u of t.matches){if(u.fn){let f=u.fn,c={commentPrefix:u.commentPrefix,label:f,message:u.message};i.push(g=>{a(g)===f&&d(g,c)})}if(u.selector){let f={commentPrefix:u.commentPrefix,label:u.selector,message:u.message};m(u.selector,c=>{d(c,f)})}}return i.length>0&&m("CallExpression",u=>{if(u.type===Me.CallExpression)for(let f of i)f(u)}),r}});var Ar={[vt.name]:vt.rule,[dt.name]:dt.rule,[mt.name]:mt.rule,"require-description":Tr.rule,[yt.name]:yt.rule,[St.name]:St.rule,[Mt.name]:Mt.rule,[lt.name]:lt.rule,[ft.name]:ft.rule,[bt.name]:bt.rule,[We.name]:We.rule,[zt.name]:zt.rule,[xt.name]:xt.rule,[gt.name]:gt.rule,[Ct.name]:Ct.rule,[ut.name]:ut.rule,[Xt.name]:Xt.rule,[Vt.name]:Vt.rule,[Bt.name]:Bt.rule,[Zt.name]:Zt.rule,[Pt.name]:Pt.rule,[Nt.name]:Nt.rule,[Ft.name]:Ft.rule,[Ot.name]:Ot.rule,[Rt.name]:Rt.rule,[wt.name]:wt.rule,[_t.name]:_t.rule,[It.name]:It.rule,[At.name]:At.rule,[Qt.name]:Qt.rule,[kt.name]:kt.rule,[Gt.name]:Gt.rule,[Kt.name]:Kt.rule,[en.name]:en.rule,[tn.name]:tn.rule,[rn.name]:rn.rule,[on.name]:on.rule,[sn.name]:sn.rule,[pn.name]:pn.rule,[ln.name]:ln.rule,[We.name]:We.rule,[cn.name]:cn.rule,[un.name]:un.rule,[mn.name]:mn.rule,[dn.name]:dn.rule};var ha={rules:Ar},rf=ha;export{rf as default,ha as extendedLintPlugin};
|
|
11
|
+
`,ie=S.split(re),Se=ie.map((M,U)=>U!==ie.length-1&&M===z+W?"":M).join(ye);if(oe!==Se)return{node:s,messageId:"improperlyIndented",fix:M=>oe.split(x).map((U,Te)=>{let q=s.quasis[Te];return q?M.replaceTextRange([q.range[0]+1,q.range[1]-(q.tail?1:2)],U):[]}).flat()}}return{TemplateLiteral(s){if(!d(s))return;let x=L(s);if(x)return e.report(x)}}}});import{AST_NODE_TYPES as fe}from"@typescript-eslint/types";function Ve(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function Xe(e){let t=e.parent;return t?.type===fe.NewExpression&&t.callee.type===fe.Identifier&&t.callee.name==="RegExp"}var se=O({name:"use-top-level-regex",meta:{type:"suggestion",docs:{description:"Require regex literals to be declared at the top level to avoid performance issues"},messages:{regexShouldBeTopLevel:"Move this regex literal to the top level to avoid creating new RegExp objects on each function call."},schema:[],hasSuggestions:!1},defaultOptions:[],create(e){function t(o){Ve(o)||Xe(o)||e.report({node:o,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var de={[V.name]:V.rule,[H.name]:H.rule,[Z.name]:Z.rule,[K.name]:K.rule,[G.name]:G.rule,[Q.name]:Q.rule,[ee.name]:ee.rule,[te.name]:te.rule,[ne.name]:ne.rule,[se.name]:se.rule};var He={rules:de},Bt=He;export{Bt as default,He as extendedLintPlugin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ls-stack/extended-lint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"@types/node": "^24.3.0",
|
|
29
29
|
"@typescript-eslint/parser": "^8.40.0",
|
|
30
30
|
"@typescript-eslint/rule-tester": "^8.40.0",
|
|
31
|
+
"@typescript-eslint/utils": "^8.40.0",
|
|
31
32
|
"@vitest/ui": "^3.2.4",
|
|
32
33
|
"eslint": "^9.33.0",
|
|
33
34
|
"eslint-vitest-rule-tester": "^2.2.1",
|
|
@@ -40,17 +41,16 @@
|
|
|
40
41
|
"vitest": "^3.2.4"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@typescript-eslint/scope-manager": "^8.40.0",
|
|
44
44
|
"@typescript-eslint/types": "^8.40.0",
|
|
45
|
-
"@typescript-eslint/utils": "^8.40.0",
|
|
46
|
-
"escape-string-regexp": "^5.0.0",
|
|
47
|
-
"espree": "^10.4.0",
|
|
48
|
-
"esutils": "^2.0.3",
|
|
49
45
|
"zod": "^4.0.17"
|
|
50
46
|
},
|
|
51
47
|
"peerDependencies": {
|
|
52
|
-
"eslint": "^9.33.0"
|
|
53
|
-
|
|
48
|
+
"eslint": "^9.33.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"eslint": {
|
|
52
|
+
"optional": true
|
|
53
|
+
}
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"lint": "pnpm tsc && pnpm eslint",
|