@batijs/core 0.0.493 → 0.0.494
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +2 -2
- package/dist/jiti-W5Y5D52V.js +0 -483
- package/dist/src-UAKFXUB2.js +0 -9
package/dist/index.js
CHANGED
|
@@ -1142,7 +1142,7 @@ ${E.map(({test:I,consequent:F})=>`<Match when={${_.getText(I)}}>${n(F)}</Match>`
|
|
|
1142
1142
|
`),j){let z=p.body;if(z.type==="BlockStatement")z.body.length>0&&(yield _.insertTextBefore(z.body[0],j));else{let H=w.getTokenBefore(z);H?.value==="("&&(yield _.remove(H));let G=w.getTokenAfter(z);G?.value===")"&&(yield _.remove(G)),yield _.insertTextBefore(z,`{
|
|
1143
1143
|
${j} return (`),yield _.insertTextAfter(z,`);
|
|
1144
1144
|
}`)}}let B=w.scopeManager?.acquire(p);if(B){for(let[z,H]of T.map(G=>[G,B.set.get(G.var)]))if(H){for(let G of H.references)if(G.isReadOnly()){let ie=z.real.type==="Identifier"&&!z.computed?`.${z.real.name}`:`[${w.getText(z.real)}]`;yield _.replaceText(G.identifier,`${g}${ie}`)}}}}return{FunctionDeclaration:i,FunctionExpression:i,ArrowFunctionExpression:i,"FunctionDeclaration:exit":a,"FunctionExpression:exit":a,"ArrowFunctionExpression:exit":a,JSXElement(){e.length&&(n().hasJSX=!0)},JSXFragment(){e.length&&(n().hasJSX=!0)}}}})}}),RRr,jRr,I7r,wJi=O0({"src/rules/no-innerhtml.ts"(){"use strict";nE(),RRr=u5e.ESLintUtils.RuleCreator.withoutDocs,{getStringIfConstant:jRr}=u5e.ASTUtils,I7r=RRr({meta:{type:"problem",docs:{description:"Disallow usage of the innerHTML attribute, which can often lead to security vulnerabilities.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-innerhtml.md"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",properties:{allowStatic:{description:"if the innerHTML value is guaranteed to be a static HTML string (i.e. no user input), allow it",type:"boolean",default:!0}},additionalProperties:!1}],messages:{dangerous:"The innerHTML attribute is dangerous; passing unsanitized input can lead to security vulnerabilities.",conflict:"The innerHTML attribute should not be used on an element with child elements; they will be overwritten.",notHtml:"The string passed to innerHTML does not appear to be valid HTML.",useInnerText:"For text content, using innerText is clearer and safer.",dangerouslySetInnerHTML:"The dangerouslySetInnerHTML prop is not supported; use innerHTML instead."}},defaultOptions:[{allowStatic:!0}],create(t){let e=!!(t.options[0]?.allowStatic??!0);return{JSXAttribute(n){if(Ase(n)==="dangerouslySetInnerHTML"){if(n.value?.type==="JSXExpressionContainer"&&n.value.expression.type==="ObjectExpression"&&n.value.expression.properties.length===1){let i=n.value.expression.properties[0];i.type==="Property"&&i.key.type==="Identifier"&&i.key.name==="__html"?t.report({node:n,messageId:"dangerouslySetInnerHTML",fix:a=>{let c=n.range,p=i.value.range;return[a.replaceTextRange([c[0],p[0]],"innerHTML={"),a.replaceTextRange([p[1],c[1]],"}")]}}):t.report({node:n,messageId:"dangerouslySetInnerHTML"})}else t.report({node:n,messageId:"dangerouslySetInnerHTML"});return}else if(Ase(n)!=="innerHTML")return;if(e){let i=n.value?.type==="JSXExpressionContainer"?n.value.expression:n.value,a=i&&jRr(i);typeof a=="string"?(0,N7r.default)(a)?n.parent?.parent?.type==="JSXElement"&&n.parent.parent.children?.length&&t.report({node:n.parent.parent,messageId:"conflict"}):t.report({node:n,messageId:"notHtml",suggest:[{fix:c=>c.replaceText(n.name,"innerText"),messageId:"useInnerText"}]}):t.report({node:n,messageId:"dangerous"})}else t.report({node:n,messageId:"dangerous"})}}}})}}),BRr,L7r,PJi=O0({"src/rules/no-proxy-apis.ts"(){"use strict";nE(),BRr=O7r.ESLintUtils.RuleCreator.withoutDocs,L7r=BRr({meta:{type:"problem",docs:{description:"Disallow usage of APIs that use ES6 Proxies, only to target environments that don't support them.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-proxy-apis.md"},schema:[],messages:{noStore:"Solid Store APIs use Proxies, which are incompatible with your target environment.",spreadCall:"Using a function call in JSX spread makes Solid use Proxies, which are incompatible with your target environment.",spreadMember:"Using a property access in JSX spread makes Solid use Proxies, which are incompatible with your target environment.",proxyLiteral:"Proxies are incompatible with your target environment.",mergeProps:"If you pass a function to `mergeProps`, it will create a Proxy, which are incompatible with your target environment."}},defaultOptions:[],create(t){let{matchImport:e,handleImportDeclaration:n}=a5e();return{ImportDeclaration(i){n(i),i.source.value==="solid-js/store"&&t.report({node:i,messageId:"noStore"})},"JSXSpreadAttribute MemberExpression"(i){t.report({node:i,messageId:"spreadMember"})},"JSXSpreadAttribute CallExpression"(i){t.report({node:i,messageId:"spreadCall"})},CallExpression(i){i.callee.type==="Identifier"?e("mergeProps",i.callee.name)&&i.arguments.filter(a=>{if(a.type==="SpreadElement")return!0;let c=Wye(a,t);return c.type==="Identifier"&&!zye(c.name)||Ly(c)}).forEach(a=>{t.report({node:a,messageId:"mergeProps"})}):i.callee.type==="MemberExpression"&&i.callee.object.type==="Identifier"&&i.callee.object.name==="Proxy"&&i.callee.property.type==="Identifier"&&i.callee.property.name==="revocable"&&t.report({node:i,messageId:"proxyLiteral"})},NewExpression(i){i.callee.type==="Identifier"&&i.callee.name==="Proxy"&&t.report({node:i,messageId:"proxyLiteral"})}}}})}}),URr,M7r,kJi=O0({"src/rules/no-react-deps.ts"(){"use strict";nE(),URr=F7r.ESLintUtils.RuleCreator.withoutDocs,M7r=URr({meta:{type:"problem",docs:{description:"Disallow usage of dependency arrays in `createEffect` and `createMemo`.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-react-deps.md"},fixable:"code",schema:[],messages:{noUselessDep:"In Solid, `{{name}}` doesn't accept a dependency array because it automatically tracks its dependencies. If you really need to override the list of dependencies, use `on`."}},defaultOptions:[],create(t){let{matchImport:e,handleImportDeclaration:n}=a5e();return{ImportDeclaration:n,CallExpression(i){if(i.callee.type==="Identifier"&&e(["createEffect","createMemo"],i.callee.name)&&i.arguments.length===2&&i.arguments.every(a=>a.type!=="SpreadElement")){let[a,c]=i.arguments.map(p=>Wye(p,t));Ly(a)&&a.params.length===0&&c.type==="ArrayExpression"&&t.report({node:i.arguments[1],messageId:"noUselessDep",data:{name:i.callee.name},fix:c===i.arguments[1]?p=>p.remove(c):void 0})}}}}})}}),qRr,VRr,j7r,NJi=O0({"src/rules/no-react-specific-props.ts"(){"use strict";nE(),qRr=R7r.ESLintUtils.RuleCreator.withoutDocs,VRr=[{from:"className",to:"class"},{from:"htmlFor",to:"for"}],j7r=qRr({meta:{type:"problem",docs:{description:"Disallow usage of React-specific `className`/`htmlFor` props, which were deprecated in v1.4.0.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-react-specific-props.md"},fixable:"code",schema:[],messages:{prefer:"Prefer the `{{ to }}` prop over the deprecated `{{ from }}` prop.",noUselessKey:"Elements in a <For> or <Index> list do not need a key prop."}},defaultOptions:[],create(t){return{JSXOpeningElement(e){for(let{from:n,to:i}of VRr){let a=_Rr(e.attributes,n);if(a){let c=h7r(e.attributes,i)?void 0:p=>p.replaceText(a.name,i);t.report({node:a,messageId:"prefer",data:{from:n,to:i},fix:c})}}if(e.name.type==="JSXIdentifier"&&HN(e.name.name)){let n=_Rr(e.attributes,"key");n&&t.report({node:n,messageId:"noUselessKey",fix:i=>i.remove(n)})}}}}})}}),zRr,Tbt,YRr,WRr,U7r,IJi=O0({"src/rules/no-unknown-namespaces.ts"(){"use strict";nE(),zRr=B7r.ESLintUtils.RuleCreator.withoutDocs,Tbt=["on","oncapture","use","prop","attr","bool"],YRr=["style","class"],WRr=["xmlns","xlink"],U7r=zRr({meta:{type:"problem",docs:{description:"Enforce using only Solid-specific namespaced attribute names (i.e. `'on:'` in `<div on:click={...} />`).",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-unknown-namespaces.md"},hasSuggestions:!0,schema:[{type:"object",properties:{allowedNamespaces:{description:"an array of additional namespace names to allow",type:"array",items:{type:"string"},default:[],minItems:1,uniqueItems:!0}},additionalProperties:!1}],messages:{unknown:`'{{namespace}}:' is not one of Solid's special prefixes for JSX attributes (${Tbt.map(t=>`'${t}:'`).join(", ")}).`,style:"Using the '{{namespace}}:' special prefix is potentially confusing, prefer the '{{namespace}}' prop instead.",component:"Namespaced props have no effect on components.","component-suggest":"Replace {{namespace}}:{{name}} with {{name}}."}},defaultOptions:[],create(t){let e=t.options?.[0]?.allowedNamespaces;return{"JSXAttribute > JSXNamespacedName":n=>{let i=n.parent.parent;if(i.name.type==="JSXIdentifier"&&!HN(i.name.name)){t.report({node:n,messageId:"component",suggest:[{messageId:"component-suggest",data:{namespace:n.namespace.name,name:n.name.name},fix:c=>c.replaceText(n,n.name.name)}]});return}let a=n.namespace?.name;Tbt.includes(a)||WRr.includes(a)||e?.includes(a)||(YRr.includes(a)?t.report({node:n,messageId:"style",data:{namespace:a}}):t.report({node:n,messageId:"unknown",data:{namespace:a}}))}}}})}}),JRr,V7r,OJi=O0({"src/rules/prefer-classlist.ts"(){"use strict";nE(),JRr=q7r.ESLintUtils.RuleCreator.withoutDocs,V7r=JRr({meta:{type:"problem",docs:{description:"Enforce using the classlist prop over importing a classnames helper. The classlist prop accepts an object `{ [class: string]: boolean }` just like classnames.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/prefer-classlist.md"},fixable:"code",deprecated:!0,schema:[{type:"object",properties:{classnames:{type:"array",description:"An array of names to treat as `classnames` functions",default:["cn","clsx","classnames"],items:{type:"string"},minItems:1,uniqueItems:!0}},additionalProperties:!1}],messages:{preferClasslist:"The classlist prop should be used instead of {{ classnames }} to efficiently set classes based on an object."}},defaultOptions:[],create(t){let e=t.options[0]?.classnames??["cn","clsx","classnames"];return{JSXAttribute(n){if(!(["class","className"].indexOf(Ase(n))===-1||h7r(n.parent?.attributes??[],"classlist"))&&n.value?.type==="JSXExpressionContainer"){let i=n.value.expression;i.type==="CallExpression"&&i.callee.type==="Identifier"&&e.indexOf(i.callee.name)!==-1&&i.arguments.length===1&&i.arguments[0].type==="ObjectExpression"&&t.report({node:n,messageId:"preferClasslist",data:{classnames:i.callee.name},fix:a=>{let c=n.range,p=i.arguments[0].range;return[a.replaceTextRange([c[0],p[0]],"classlist={"),a.replaceTextRange([p[1],c[1]],"}")]}})}}}}})}}),$Rr,KRr,z7r,LJi=O0({"src/rules/prefer-for.ts"(){"use strict";nE(),$Rr=p5e.ESLintUtils.RuleCreator.withoutDocs,{getPropertyName:KRr}=p5e.ASTUtils,z7r=$Rr({meta:{type:"problem",docs:{description:"Enforce using Solid's `<For />` component for mapping an array to JSX elements.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/prefer-for.md"},fixable:"code",schema:[],messages:{preferFor:"Use Solid's `<For />` component for efficiently rendering lists. Array#map causes DOM elements to be recreated.",preferForOrIndex:"Use Solid's `<For />` component or `<Index />` component for rendering lists. Array#map causes DOM elements to be recreated."}},defaultOptions:[],create(t){let e=n=>{let i=n.parent,a=n.callee.object,c=n.arguments[0];t.report({node:n,messageId:"preferFor",fix:p=>{let f=[i.range[0],a.range[0]],_=[a.range[1],c.range[0]],g=[c.range[1],i.range[1]];return[p.replaceTextRange(f,"<For each={"),p.replaceTextRange(_,"}>{"),p.replaceTextRange(g,"}</For>")]}})};return{CallExpression(n){let i=n.parent?.type==="ChainExpression"?n.parent:n;if(i.parent?.type==="JSXExpressionContainer"&&iz(i.parent.parent)&&n.callee.type==="MemberExpression"&&KRr(n.callee)==="map"&&n.arguments.length===1&&Ly(n.arguments[0])){let a=n.arguments[0];a.params.length===1&&a.params[0].type!=="RestElement"?e(n):t.report({node:n,messageId:"preferForOrIndex"})}}}}})}}),GRr,i5e,W7r,FJi=O0({"src/rules/prefer-show.ts"(){"use strict";nE(),XN(),GRr=Y7r.ESLintUtils.RuleCreator.withoutDocs,i5e=["JSXElement","JSXFragment","Identifier"],W7r=GRr({meta:{type:"problem",docs:{description:"Enforce using Solid's `<Show />` component for conditionally showing content. Solid's compiler covers this case, so it's a stylistic rule only.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/prefer-show.md"},fixable:"code",schema:[],messages:{preferShowAnd:"Use Solid's `<Show />` component for conditionally showing content.",preferShowTernary:"Use Solid's `<Show />` component for conditionally showing content with a fallback."}},defaultOptions:[],create(t){let e=LA(t),n=c=>{let p=e.getText(c);return iz(c)?p:`{${p}}`},i=c=>{c.operator==="&&"&&i5e.includes(c.right.type)&&t.report({node:c,messageId:"preferShowAnd",fix:p=>p.replaceText(c.parent?.type==="JSXExpressionContainer"&&iz(c.parent.parent)?c.parent:c,`<Show when={${e.getText(c.left)}}>${n(c.right)}</Show>`)})},a=c=>{(i5e.includes(c.consequent.type)||i5e.includes(c.alternate.type))&&t.report({node:c,messageId:"preferShowTernary",fix:p=>p.replaceText(c.parent?.type==="JSXExpressionContainer"&&iz(c.parent.parent)?c.parent:c,`<Show when={${e.getText(c.test)}} fallback={${e.getText(c.alternate)}}>${n(c.consequent)}</Show>`)})};return{JSXExpressionContainer(c){iz(c.parent)&&(c.expression.type==="LogicalExpression"?i(c.expression):c.expression.type==="ArrowFunctionExpression"&&c.expression.body.type==="LogicalExpression"?i(c.expression.body):c.expression.type==="ConditionalExpression"?a(c.expression):c.expression.type==="ArrowFunctionExpression"&&c.expression.body.type==="ConditionalExpression"&&a(c.expression.body))}}}})}}),HRr,XRr,QRr,ZRr,xse,Cse,$7r,MJi=O0({"src/rules/reactivity.ts"(){"use strict";nE(),XN(),{getFunctionHeadLocation:HRr}=f5e.ASTUtils,XRr=f5e.ESLintUtils.RuleCreator.withoutDocs,QRr=class{node;trackedScopes=[];unnamedDerivedSignals=new Set;hasJSX=!1;constructor(t){this.node=t}},ZRr=class extends Array{currentScope=()=>this[this.length-1];parentScope=()=>this[this.length-2];pushSignal(t,e=this.currentScope().node){this.signals.push({references:t.references.filter(n=>!n.init),variable:t,declarationScope:e})}pushUniqueSignal(t,e){let n=this.signals.find(i=>i.variable===t);n?n.declarationScope=this.findDeepestDeclarationScope(n.declarationScope,e):this.pushSignal(t,e)}pushProps(t,e=this.currentScope().node){this.props.push({references:t.references.filter(n=>!n.init),variable:t,declarationScope:e})}syncCallbacks=new Set;*consumeSignalReferencesInScope(){yield*this.consumeReferencesInScope(this.signals),this.signals=this.signals.filter(t=>t.references.length!==0)}*consumePropsReferencesInScope(){yield*this.consumeReferencesInScope(this.props),this.props=this.props.filter(t=>t.references.length!==0)}*consumeReferencesInScope(t){for(let e of t){let{references:n}=e,i=[],a=[];n.forEach(c=>{this.isReferenceInCurrentScope(c)?i.push(c):a.push(c)}),yield*i.map(c=>({reference:c,declarationScope:e.declarationScope})),e.references=a}}findDeepestDeclarationScope=(t,e)=>{if(t===e)return t;for(let n=this.length-1;n>=0;n-=1){let{node:i}=this[n];if(t===i||e===i)return i}throw new Error("This should never happen")};isReferenceInCurrentScope(t){let e=_bt(t.identifier,s5e);for(;Ly(e)&&this.syncCallbacks.has(e);)e=_bt(e,s5e);return e===this.currentScope().node}signals=[];props=[]},xse=(t,e,n)=>{if(t?.type==="ArrayPattern"){let i=t.elements[e];if(i?.type==="Identifier")return JF(n,i)}return null},Cse=(t,e)=>t.type==="Identifier"?JF(e,t):null,$7r=XRr({meta:{type:"problem",docs:{description:"Enforce that reactivity (props, signals, memos, etc.) is properly used, so changes in those values will be tracked and update the view as expected.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/reactivity.md"},schema:[{type:"object",properties:{customReactiveFunctions:{description:"List of function names to consider as reactive functions (allow signals to be safely passed as arguments). In addition, any create* or use* functions are automatically included.",type:"array",items:{type:"string"},default:[]}},additionalProperties:!1}],messages:{noWrite:"The reactive variable '{{name}}' should not be reassigned or altered directly.",untrackedReactive:"The reactive variable '{{name}}' should be used within JSX, a tracked scope (like createEffect), or inside an event handler function, or else changes will be ignored.",expectedFunctionGotExpression:"The reactive variable '{{name}}' should be wrapped in a function for reactivity. This includes event handler bindings on native elements, which are not reactive like other JSX props.",badSignal:"The reactive variable '{{name}}' should be called as a function when used in {{where}}.",badUnnamedDerivedSignal:"This function should be passed to a tracked scope (like createEffect) or an event handler because it contains reactivity, or else changes will be ignored.",shouldDestructure:"For proper analysis, array destructuring should be used to capture the {{nth}}result of this function call.",shouldAssign:"For proper analysis, a variable should be used to capture the result of this function call.",noAsyncTrackedScope:"This tracked scope should not be async. Solid's reactivity only tracks synchronously."}},defaultOptions:[{customReactiveFunctions:[]}],create(t,[e]){let n=(j,B)=>t.report({node:j,messageId:"shouldDestructure",data:B?{nth:B+" "}:void 0}),i=j=>t.report({node:j,messageId:"shouldAssign"}),a=LA(t),c=new ZRr,{currentScope:p,parentScope:f}=c,{matchImport:_,handleImportDeclaration:g}=a5e(),y=(j,B)=>{if(j.params.length===1&&j.params[0].type==="Identifier"&&j.parent?.type!=="JSXExpressionContainer"&&j.parent?.type!=="TemplateLiteral"&&B(j.params[0])){let z=JF(t,j.params[0]);z&&c.pushProps(z,j)}},T=j=>{if(Ly(j)){if(c.syncCallbacks.has(j))return;y(j,B=>zye(B.name))}c.push(new QRr(j))},b=(j,B)=>{switch(j.expect){case"function":case"called-function":return B===j.node;case"expression":return!!bJi(B,p().node,z=>z===j.node)}},E=(j,B)=>{let z=p().node;if(!p().trackedScopes.find(H=>b(H,j))){let H=p().trackedScopes.find(G=>b({...G,expect:"expression"},j));if(B===z){let G=null;if(j.parent?.type==="MemberExpression")for(G=j.parent;G.parent?.type==="MemberExpression";)G=G.parent;let ie=j.parent?.type==="CallExpression"?j.parent:null;t.report({node:G??ie??j,messageId:H?"expectedFunctionGotExpression":"untrackedReactive",data:{name:G?a.getText(G):j.name}})}else{if(!f()||!Ly(z))throw new Error("this shouldn't happen!");let G=()=>(f().unnamedDerivedSignals??=new Set).add(z);if(z.type==="FunctionDeclaration"){let ie=a.scopeManager?.getDeclaredVariables(z)?.[0];ie?c.pushUniqueSignal(ie,B):G()}else if(z.parent?.type==="VariableDeclarator"){let ie=z.parent,pe=a.scopeManager?.getDeclaredVariables(ie)?.[0];pe?c.pushUniqueSignal(pe,B):G()}else z.parent?.type==="Property"||G()}}},x=j=>{if(Ly(j)&&y(j,z=>{if(!zye(z.name)&&p().hasJSX){let H=xbt(j);if(H&&!/^[a-z]/.test(H))return!0}return!1}),Ly(j)&&c.syncCallbacks.has(j))return;for(let{reference:z,declarationScope:H}of c.consumeSignalReferencesInScope()){let G=z.identifier;if(z.isWrite())t.report({node:G,messageId:"noWrite",data:{name:G.name}});else if(G.type==="Identifier"){let ie=pe=>t.report({node:G,messageId:"badSignal",data:{name:G.name,where:pe}});if(G.parent?.type==="CallExpression"||G.parent?.type==="ArrayExpression"&&G.parent.parent?.type==="CallExpression")E(G,H);else if(G.parent?.type==="TemplateLiteral")ie("template literals");else if(G.parent?.type==="BinaryExpression"&&["<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","**","|","^","&","in"].includes(G.parent.operator))ie("arithmetic or comparisons");else if(G.parent?.type==="UnaryExpression"&&["-","+","~"].includes(G.parent.operator))ie("unary expressions");else if(G.parent?.type==="MemberExpression"&&G.parent.computed&&G.parent.property===G)ie("property accesses");else if(G.parent?.type==="JSXExpressionContainer"&&!p().trackedScopes.find(pe=>pe.node===G&&(pe.expect==="function"||pe.expect==="called-function"))){let pe=G.parent.parent;(iz(pe)||pe?.type==="JSXAttribute"&&pe.parent?.type==="JSXOpeningElement"&&pe.parent.name.type==="JSXIdentifier"&&HN(pe.parent.name.name))&&ie("JSX")}}}for(let{reference:z,declarationScope:H}of c.consumePropsReferencesInScope()){let G=z.identifier;if(z.isWrite())t.report({node:G,messageId:"noWrite",data:{name:G.name}});else if(G.parent?.type==="MemberExpression"&&G.parent.object===G){let{parent:ie}=G;ie.parent?.type==="AssignmentExpression"&&ie.parent.left===ie?t.report({node:G,messageId:"noWrite",data:{name:G.name}}):ie.property.type==="Identifier"&&/^(?:initial|default|static[A-Z])/.test(ie.property.name)||E(G,H)}else(G.parent?.type==="AssignmentExpression"||G.parent?.type==="VariableDeclarator")&&t.report({node:G,messageId:"untrackedReactive",data:{name:G.name}})}let{unnamedDerivedSignals:B}=p();if(B)for(let z of B)p().trackedScopes.find(H=>b(H,z))||t.report({loc:HRr(z,a),messageId:"badUnnamedDerivedSignal"});c.pop()},w=j=>{if(j.arguments.length===1&&Ly(j.arguments[0])&&!j.arguments[0].async&&(j.callee.type==="Identifier"&&_(["batch","produce"],j.callee.name)||j.callee.type==="MemberExpression"&&!j.callee.computed&&j.callee.object.type!=="ObjectExpression"&&/^(?:forEach|map|flatMap|reduce|reduceRight|find|findIndex|filter|every|some)$/.test(j.callee.property.name))&&c.syncCallbacks.add(j.arguments[0]),j.callee.type==="Identifier"){if(_(["createSignal","createStore"],j.callee.name)&&j.parent?.type==="VariableDeclarator"){let B=xse(j.parent.id,1,t);if(B)for(let z of B.references){let{identifier:H}=z;if(!z.init&&z.isRead()&&H.parent?.type==="CallExpression")for(let G of H.parent.arguments)Ly(G)&&!G.async&&c.syncCallbacks.add(G)}}else if(_(["mapArray","indexArray"],j.callee.name)){let B=j.arguments[1];Ly(B)&&c.syncCallbacks.add(B)}}Ly(j.callee)&&c.syncCallbacks.add(j.callee)},I=(j,B)=>{if(B=vbt(B),B.type==="CallExpression"&&B.callee.type==="Identifier"){let{callee:z}=B;if(_(["createSignal","useTransition"],z.name)){let H=j&&xse(j,0,t);H?c.pushSignal(H,p().node):n(j??B,"first")}else if(_(["createMemo","createSelector"],z.name)){let H=j&&Cse(j,t);H?c.pushSignal(H,p().node):i(j??B)}else if(_("createStore",z.name)){let H=j&&xse(j,0,t);H?c.pushProps(H,p().node):n(j??B,"first")}else if(_("mergeProps",z.name)){let H=j&&Cse(j,t);H?c.pushProps(H,p().node):i(j??B)}else if(_("splitProps",z.name))if(j?.type==="ArrayPattern"){let H=j.elements.map((G,ie)=>xse(j,ie,t)).filter(Boolean);H.length===0?n(j):H.forEach(G=>{c.pushProps(G,p().node)})}else{let H=j&&Cse(j,t);H&&c.pushProps(H,p().node)}else if(_("createResource",z.name)){let H=j&&xse(j,0,t);H&&c.pushProps(H,p().node)}else if(_("createMutable",z.name)){let H=j&&Cse(j,t);H&&c.pushProps(H,p().node)}else if(_("mapArray",z.name)){let H=B.arguments[1];if(Ly(H)&&H.params.length>=2&&H.params[1].type==="Identifier"){let G=JF(t,H.params[1]);G&&c.pushSignal(G)}}else if(_("indexArray",z.name)){let H=B.arguments[1];if(Ly(H)&&H.params.length>=1&&H.params[0].type==="Identifier"){let G=JF(t,H.params[0]);G&&c.pushSignal(G)}}}},F=j=>{let B=(H,G)=>{p().trackedScopes.push({node:H,expect:G}),G!=="called-function"&&Ly(H)&&H.async&&t.report({node:H,messageId:"noAsyncTrackedScope"})},z=H=>{(0,J7r.traverse)(H,{enter(G){let ie=G,pe=Wye(ie,t);(Ly(pe)||pe.type==="Identifier"&&pe.parent.type!=="MemberExpression"&&!(pe.parent.type==="CallExpression"&&pe.parent.callee===pe))&&(B(ie,"called-function"),this.skip())},fallback:"iteration"})};if(j.type==="JSXExpressionContainer")j.parent?.type==="JSXAttribute"&&a.getText(j.parent.name).startsWith("on")&&j.parent.parent?.type==="JSXOpeningElement"&&j.parent.parent.name.type==="JSXIdentifier"&&HN(j.parent.parent.name.name)||j.parent?.type==="JSXAttribute"&&j.parent.name.type==="JSXNamespacedName"&&j.parent.name.namespace.name==="use"&&Ly(j.expression)?B(j.expression,"called-function"):j.parent?.type==="JSXAttribute"&&j.parent.name.name==="value"&&j.parent.parent?.type==="JSXOpeningElement"&&(j.parent.parent.name.type==="JSXIdentifier"&&j.parent.parent.name.name.endsWith("Provider")||j.parent.parent.name.type==="JSXMemberExpression"&&j.parent.parent.name.property.name==="Provider")||j.parent?.type==="JSXAttribute"&&j.parent.name?.type==="JSXIdentifier"&&/^static[A-Z]/.test(j.parent.name.name)&&j.parent.parent?.type==="JSXOpeningElement"&&j.parent.parent.name.type==="JSXIdentifier"&&!HN(j.parent.parent.name.name)||(j.parent?.type==="JSXAttribute"&&j.parent.name.name==="ref"&&Ly(j.expression)?B(j.expression,"called-function"):iz(j.parent)&&Ly(j.expression)?B(j.expression,"function"):B(j.expression,"expression"));else if(j.type==="JSXSpreadAttribute")B(j.argument,"expression");else if(j.type==="NewExpression"){let{callee:H,arguments:{0:G}}=j;H.type==="Identifier"&&G&&["IntersectionObserver","MutationObserver","PerformanceObserver","ReportingObserver","ResizeObserver"].includes(H.name)&&B(G,"called-function")}else if(j.type==="CallExpression"){if(j.callee.type==="Identifier"){let{callee:H,arguments:{0:G,1:ie}}=j;if(_(["createMemo","children","createEffect","createRenderEffect","createDeferred","createComputed","createSelector","untrack","mapArray","indexArray","observable"],H.name)||_("createResource",H.name)&&j.arguments.length>=2)B(G,"function");else if(_(["onMount","onCleanup","onError"],H.name)||["setInterval","setTimeout","setImmediate","requestAnimationFrame","requestIdleCallback"].includes(H.name))B(G,"called-function");else if(_("on",H.name))G&&(G.type==="ArrayExpression"?G.elements.forEach(pe=>{pe&&pe?.type!=="SpreadElement"&&B(pe,"function")}):B(G,"function")),ie&&B(ie,"called-function");else if(_("createStore",H.name)&&G?.type==="ObjectExpression")for(let pe of G.properties)pe.type==="Property"&&pe.kind==="get"&&Ly(pe.value)&&B(pe.value,"function");else if(_("runWithOwner",H.name)){if(ie){let pe=!0,Ee=G.type==="Identifier"&&JF(t,G);if(Ee){let ke=Ee.defs[0];if(ke&&ke.node.type==="VariableDeclarator"&&ke.node.init?.type==="CallExpression"&&ke.node.init.callee.type==="Identifier"&&_("getOwner",ke.node.init.callee.name)){let Te=_bt(ke.node,s5e),Be=c.findIndex(({node:Re})=>Te===Re);(Be>=1&&!c[Be-1].trackedScopes.some(Re=>Re.expect==="function"&&Re.node===Te)||Be===0)&&(pe=!1)}}pe&&B(ie,"function")}}else if(/^(?:use|create)[A-Z]/.test(H.name)||e.customReactiveFunctions.includes(H.name))for(let pe of j.arguments)z(pe)}else if(j.callee.type==="MemberExpression"){let{property:H}=j.callee;if(H.type==="Identifier"&&H.name==="addEventListener"&&j.arguments.length>=2)B(j.arguments[1],"called-function");else if(H.type==="Identifier"&&(/^(?:use|create)[A-Z]/.test(H.name)||e.customReactiveFunctions.includes(H.name)))for(let G of j.arguments)z(G)}}else if(j.type==="VariableDeclarator"){if(j.init?.type==="CallExpression"&&j.init.callee.type==="Identifier"&&_(["createReactive","createReaction"],j.init.callee.name)){let H=Cse(j.id,t);if(H){for(let G of H.references)if(!G.init&&G.isReadOnly()&&G.identifier.parent?.type==="CallExpression"&&G.identifier.parent.callee===G.identifier){let ie=G.identifier.parent.arguments[0];ie&&B(ie,"function")}}Ly(j.init.arguments[0])&&B(j.init.arguments[0],"called-function")}}else if(j.type==="AssignmentExpression")j.left.type==="MemberExpression"&&j.left.property.type==="Identifier"&&Ly(j.right)&&/^on[a-z]+$/.test(j.left.property.name)&&B(j.right,"called-function");else if(j.type==="TaggedTemplateExpression"){for(let H of j.quasi.expressions)if(Ly(H)){B(H,"called-function");for(let G of H.params)if(G.type==="Identifier"&&zye(G.name)){let ie=JF(t,G);ie&&c.pushProps(ie,p().node)}}}};return{ImportDeclaration:g,JSXExpressionContainer(j){F(j)},JSXSpreadAttribute(j){F(j)},CallExpression(j){F(j),w(j);let B=j.parent&&vbt(j.parent,!0);B?.type!=="AssignmentExpression"&&B?.type!=="VariableDeclarator"&&I(null,j)},NewExpression(j){F(j)},VariableDeclarator(j){j.init&&(I(j.id,j.init),F(j))},AssignmentExpression(j){j.left.type!=="MemberExpression"&&I(j.left,j.right),F(j)},TaggedTemplateExpression(j){F(j)},"JSXElement > JSXExpressionContainer > :function"(j){if(Ly(j)&&j.parent?.type==="JSXExpressionContainer"&&j.parent.parent?.type==="JSXElement"){let B=j.parent.parent;if(B.openingElement.name.type==="JSXIdentifier"){let z=B.openingElement.name.name;if(_("For",z)&&j.params.length===2&&j.params[1].type==="Identifier"){let H=JF(t,j.params[1]);H&&c.pushSignal(H,p().node)}else if(_("Index",z)&&j.params.length>=1&&j.params[0].type==="Identifier"){let H=JF(t,j.params[0]);H&&c.pushSignal(H,p().node)}}}},FunctionExpression:T,ArrowFunctionExpression:T,FunctionDeclaration:T,Program:T,"FunctionExpression:exit":x,"ArrowFunctionExpression:exit":x,"FunctionDeclaration:exit":x,"Program:exit":x,JSXElement(){c.length&&(p().hasJSX=!0)},JSXFragment(){c.length&&(p().hasJSX=!0)}}}})}});function RJi(t){return t.name.type==="JSXIdentifier"&&!HN(t.name.name)||t.name.type==="JSXMemberExpression"}function jJi(t){return G7r.test(t)}function BJi(t){return t.parent.children.length===0}function UJi(t){let e=t.parent.children;return e.length===1&&e[0].type==="JSXText"&&e[0].value.indexOf(`
|
|
1145
|
-
`)!==-1&&e[0].value.replace(/(?!\xA0)\s/g,"")===""}var e7r,G7r,H7r,qJi=O0({"src/rules/self-closing-comp.ts"(){"use strict";nE(),XN(),e7r=K7r.ESLintUtils.RuleCreator.withoutDocs,G7r=/^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,H7r=e7r({meta:{type:"layout",docs:{description:"Disallow extra closing tags for components without children.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/self-closing-comp.md"},fixable:"code",schema:[{type:"object",properties:{component:{type:"string",description:"which Solid components should be self-closing when possible",enum:["all","none"],default:"all"},html:{type:"string",description:"which native elements should be self-closing when possible",enum:["all","void","none"],default:"all"}},additionalProperties:!1}],messages:{selfClose:"Empty components are self-closing.",dontSelfClose:"This element should not be self-closing."}},defaultOptions:[],create(t){function e(n){if(RJi(n))return(t.options[0]?.component??"all")==="all";if(n.name.type==="JSXIdentifier"&&HN(n.name.name))switch(t.options[0]?.html??"all"){case"all":return!0;case"void":return jJi(n.name.name);case"none":return!1}return!0}return{JSXOpeningElement(n){if(BJi(n)||UJi(n)){let a=e(n);a&&!n.selfClosing?t.report({node:n,messageId:"selfClose",fix(c){let p=n.range[1]-1,f=n.parent.closingElement.range[1],_=[p,f];return c.replaceTextRange(_," />")}}):!a&&n.selfClosing&&t.report({node:n,messageId:"dontSelfClose",fix(c){let p=LA(t),f=p.getText(n.name),_=n.range[1],g=p.getLastTokens(n,{count:3}),T=[p.isSpaceBetween?.(g[0],g[1])?_-3:_-2,_];return c.replaceTextRange(T,`></${f}>`)}})}}}}})}}),t7r,r7r,n7r,i7r,Z7r,VJi=O0({"src/rules/style-prop.ts"(){"use strict";nE(),XN(),t7r=_5e.ESLintUtils.RuleCreator.withoutDocs,{getPropertyName:r7r,getStaticValue:n7r}=_5e.ASTUtils,i7r=/\b(?:width|height|margin|padding|border-width|font-size)\b/i,Z7r=t7r({meta:{type:"problem",docs:{description:"Require CSS properties in the `style` prop to be valid and kebab-cased (ex. 'font-size'), not camel-cased (ex. 'fontSize') like in React, and that property values with dimensions are strings, not numbers with implicit 'px' units.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/style-prop.md"},fixable:"code",schema:[{type:"object",properties:{styleProps:{description:"an array of prop names to treat as a CSS style object",default:["style"],type:"array",items:{type:"string"},minItems:1,uniqueItems:!0},allowString:{description:"if allowString is set to true, this rule will not convert a style string literal into a style object (not recommended for performance)",type:"boolean",default:!1}},additionalProperties:!1}],messages:{kebabStyleProp:"Use {{ kebabName }} instead of {{ name }}.",invalidStyleProp:"{{ name }} is not a valid CSS property.",numericStyleValue:'This CSS property value should be a string with a unit; Solid does not automatically append a "px" unit.',stringStyle:"Use an object for the style prop instead of a string."}},defaultOptions:[],create(t){let e=new Set(Q7r.all),n=!!t.options[0]?.allowString,i=t.options[0]?.styleProps||["style"];return{JSXAttribute(a){if(i.indexOf(Ase(a))===-1)return;let c=a.value?.type==="JSXExpressionContainer"?a.value.expression:a.value;if(c)if(c.type==="Literal"&&typeof c.value=="string"&&!n){let p;try{p=pRr(c.value)??void 0}catch{}t.report({node:c,messageId:"stringStyle",fix:p&&(f=>f.replaceText(a.value,`{${JSON.stringify(p)}}`))})}else c.type==="TemplateLiteral"&&!n?t.report({node:c,messageId:"stringStyle"}):c.type==="ObjectExpression"&&c.properties.filter(f=>f.type==="Property").forEach(f=>{let _=r7r(f,Yye(t,f));if(_&&!_.startsWith("--")&&!e.has(_)){let g=(0,X7r.default)(_);e.has(g)?t.report({node:f.key,messageId:"kebabStyleProp",data:{name:_,kebabName:g},fix:y=>y.replaceText(f.key,`"${g}"`)}):t.report({node:f.key,messageId:"invalidStyleProp",data:{name:_}})}else if(!_||!_.startsWith("--")&&i7r.test(_)){let g=n7r(f.value)?.value;typeof g=="number"&&g!==0&&t.report({node:f.value,messageId:"numericStyleValue"})}});else return}}}})}}),s7r,t9r,zJi=O0({"src/rules/no-array-handlers.ts"(){"use strict";nE(),s7r=e9r.ESLintUtils.RuleCreator.withoutDocs,t9r=s7r({meta:{type:"problem",docs:{description:"Disallow usage of type-unsafe event handlers.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-array-handlers.md"},schema:[],messages:{noArrayHandlers:"Passing an array as an event handler is potentially type-unsafe."}},defaultOptions:[],create(t){return{JSXAttribute(e){let n=e.parent;if(n.name.type!=="JSXIdentifier"||!HN(n.name.name))return;let i=e.name.type==="JSXNamespacedName"&&e.name.namespace.name==="on",a=e.name.type==="JSXIdentifier"&&/^on[a-zA-Z]/.test(e.name.name);(i||a)&&e.value?.type==="JSXExpressionContainer"&&Wye(e.value.expression,t).type==="ArrayExpression"&&t.report({node:e,messageId:"noArrayHandlers"})}}}})}}),YJi=p7r({"package.json"(t,e){e.exports={name:"eslint-plugin-solid",version:"0.14.5",description:"Solid-specific linting rules for ESLint.",keywords:["eslint","eslintplugin","solid","solidjs","reactivity"],repository:"https://github.com/solidjs-community/eslint-plugin-solid",license:"MIT",author:"Josh Wilson <joshwilsonvu@gmail.com>",exports:{".":{types:{import:"./dist/index.d.mts",require:"./dist/index.d.ts"},import:"./dist/index.mjs",require:"./dist/index.js"},"./configs/recommended":{types:{import:"./dist/configs/recommended.d.mts",require:"./dist/configs/recommended.d.ts"},import:"./dist/configs/recommended.mjs",require:"./dist/configs/recommended.js"},"./configs/typescript":{types:{import:"./dist/configs/typescript.d.mts",require:"./dist/configs/typescript.d.ts"},import:"./dist/configs/typescript.mjs",require:"./dist/configs/typescript.js"},"./package.json":"./package.json"},main:"dist/index.js",types:"dist/index.d.ts",files:["src","dist","README.md"],scripts:{build:"tsup",test:"vitest --run","test:all":"PARSER=all vitest --run","test:babel":"PARSER=babel vitest --run","test:ts":"PARSER=ts vitest --run","test:v6":"PARSER=v6 vitest --run","test:v7":"PARSER=v7 vitest --run","test:watch":"vitest","turbo:build":"tsup","turbo:docs":"PARSER=none tsx scripts/docs.ts","turbo:test":"vitest --run"},dependencies:{"@typescript-eslint/utils":"^7.13.1 || ^8.0.0",estraverse:"^5.3.0","is-html":"^2.0.0","kebab-case":"^1.0.2","known-css-properties":"^0.30.0","style-to-object":"^1.0.6"},devDependencies:{"@babel/core":"^7.24.4","@babel/eslint-parser":"^7.24.7","@microsoft/api-extractor":"^7.47.6","@types/eslint":"^8.56.10","@types/eslint-v6":"npm:@types/eslint@6","@types/eslint-v7":"npm:@types/eslint@7","@types/eslint-v8":"npm:@types/eslint@8","@types/eslint__js":"^8.42.3","@types/estraverse":"^5.1.7","@types/is-html":"^2.0.2","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0",eslint:"^9.5.0","eslint-v6":"npm:eslint@6","eslint-v7":"npm:eslint@7","eslint-v8":"npm:eslint@8","markdown-magic":"^3.3.0",prettier:"^2.8.8",tsup:"^8.2.4",tsx:"^4.17.0",vitest:"^1.5.2"},peerDependencies:{eslint:"^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",typescript:">=4.8.4"},engines:{node:">=18.0.0"}}}}),a7r,o7r,l7r,c7r,r9r,WJi=O0({"src/plugin.ts"(){"use strict";TJi(),vJi(),SJi(),EJi(),xJi(),CJi(),AJi(),DJi(),wJi(),PJi(),kJi(),NJi(),IJi(),OJi(),LJi(),FJi(),MJi(),qJi(),VJi(),zJi(),{name:a7r,version:o7r}=YJi(),l7r={name:a7r,version:o7r},c7r={"components-return-once":b7r,"event-handlers":T7r,imports:S7r,"jsx-no-duplicate-props":x7r,"jsx-no-undef":D7r,"jsx-no-script-url":C7r,"jsx-uses-vars":P7r,"no-destructure":k7r,"no-innerhtml":I7r,"no-proxy-apis":L7r,"no-react-deps":M7r,"no-react-specific-props":j7r,"no-unknown-namespaces":U7r,"prefer-classlist":V7r,"prefer-for":z7r,"prefer-show":W7r,reactivity:$7r,"self-closing-comp":H7r,"style-prop":Z7r,"no-array-handlers":t9r},r9r={meta:l7r,rules:c7r}}}),n9r=p7r({"src/configs/recommended.ts"(t,e){WJi();var n={plugins:{solid:r9r},languageOptions:{sourceType:"module",parserOptions:{ecmaFeatures:{jsx:!0}}},rules:{"solid/jsx-no-duplicate-props":2,"solid/jsx-no-undef":2,"solid/jsx-uses-vars":2,"solid/no-unknown-namespaces":2,"solid/no-innerhtml":2,"solid/jsx-no-script-url":2,"solid/components-return-once":1,"solid/no-destructure":2,"solid/prefer-for":2,"solid/reactivity":1,"solid/event-handlers":1,"solid/imports":1,"solid/style-prop":1,"solid/no-react-deps":1,"solid/no-react-specific-props":1,"solid/self-closing-comp":1,"solid/no-array-handlers":0,"solid/prefer-show":0,"solid/no-proxy-apis":0,"solid/prefer-classlist":0}};e.exports=n}});var i9r=n9r();function sz(t,e){let i=new Function(`{ return function(BATI, BATI_TEST){ return ${t} } };`).call(null).call(null,e.BATI,e.BATI_TEST);if(i!=="remove-comments-only"&&typeof i!="boolean")throw new Error("Condition evaluation failed");return i}function s9r(t){return!t.includes("BATI.has")&&!t.includes("BATI_TEST")?null:t.replace(/^# /,"").trim()}function a9r(t,e){if(!e.test.range)return null;let n=t.text.slice(e.test.range[0],e.test.range[1]);return s9r(n)}function d5e(t){return s9r(t.value)}function o9r(t){return t.value.includes(" BATI ")?t.value.replace(/^#/,"").replace(/#$/,"").replace(/\s+BATI\s+/,"").trim().split(","):null}function l9r(t){return[t.body[0].range[0],t.body[t.body.length-1].range[1]]}function c9r(t,e,n){return t.type==="ConditionalExpression"&&"parent"in t&&t.parent&&t.parent.type==="JSXExpressionContainer"&&(e.type==="JSXElement"||n==="null"||n==="undefined")?{range:t.parent.range,body:n==="null"||n==="undefined"?"":n}:{range:t.range,body:n}}function az(t,e,n,i){let a=a9r(e,n);if(a===null)return;let c=sz(a,i);t.report({node:n,message:"bati/if-statement",*fix(p){if(c)if(n.consequent.type==="BlockStatement"){let f=e.text.slice(...l9r(n.consequent));yield p.replaceTextRange(n.range,f)}else{let f=e.text.slice(...n.consequent.range),_=c9r(n,n.consequent,f);yield p.replaceTextRange(_.range,_.body)}else if(n.alternate)if(n.alternate.type==="BlockStatement"){let f=e.text.slice(...l9r(n.alternate));yield p.replaceTextRange(n.range,f)}else{let f=e.text.slice(...n.alternate.range),_=c9r(n,n.alternate,f);yield p.replaceTextRange(_.range,_.body)}else yield p.remove(n)}})}function u9r(t,e,n){let i=e.getAllComments();if(i.length>0&&i[0].range?.[0]===0){let a=i[0],c=o9r(a);if(c===null||c.length===0)return;let p=Wie(t);for(let f of c)switch(f){case"include-if-imported":p?.addFlag(f);break;default:t.report({node:n,message:`Unknown BATI file flag ${f}`,loc:a.loc});return}t.report({node:n,message:"bati/global-comment",*fix(f){yield f.remove(a)}})}}function $G(t,e,n,i){let a=e.getCommentsBefore(n);if(a.length>0){let c=a[0];if(c.handled)return;c.handled=!0;let p=d5e(c);if(p===null)return;let f=sz(p,i),_,g;if(!(a.length>1&&f==="remove-comments-only")){let T=["Property"];for(["SpreadElement","Identifier"].includes(n.type)&&T.includes(n.parent?.type)&&(n=n.parent),_=n.range[0],g=n.range[1];e.text[g]?.match(/\s|,/)&&(g+=1,e.text[g-1]!==","););}t.report({node:n,message:"bati/statement-comments",*fix(T){if(!f||f==="remove-comments-only"){_!==void 0&&g!==void 0&&(yield T.removeRange([_,g]));for(let b of a)yield T.remove(b)}else yield T.remove(c)}})}}function m5e(t,e,n,i){Cbt(t,e,n.typeAnnotation,i,()=>{let a=n.expression.range[1]+1,c=n.range[1];return[a,c]},(a,c)=>c.name==="IfAsUnknown"?` as unknown as ${a}`:` as ${a}`)}function h5e(t,e,n,i){for(let a of n.params)Cbt(t,e,a,i,()=>[n.params[0].range[0],n.params[n.params.length-1].range[1]],c=>c)}function g5e(t,e,n,i){Cbt(t,e,n,i,()=>n.range,a=>a)}function Cbt(t,e,n,i,a,c){if(n.type==="TSTypeReference"&&n.typeName.type==="TSQualifiedName"&&n.typeName.left.type==="Identifier"&&n.typeName.left.name==="BATI"){let{right:p}=n.typeName,f=a();switch(p.name){case"Any":t.report({node:n,message:"bati/as-expression-any",*fix(_){yield _.removeRange(f)}});break;case"If":case"IfAsUnknown":if(n.typeArguments?.type==="TSTypeParameterInstantiation"&&n.typeArguments.params[0].type==="TSTypeLiteral"){let _=n.typeArguments.params[0].members;t.report({node:n,message:"bati/as-expression-if",*fix(g){let y,T=!1;for(let b of _){if(b.type!=="TSPropertySignature"||b.key.type!=="Literal"&&b.key.type!=="Identifier"||b.typeAnnotation?.type!=="TSTypeAnnotation")throw console.log(),new Error("Linter: Malformed BATI.If members type");let E="value"in b.key?b.key.value:b.key.name,x=e.text.slice(b.typeAnnotation.typeAnnotation.range[0],b.typeAnnotation.typeAnnotation.range[1]);if(E==="_"){y=x;continue}if(sz(E,i)){yield g.replaceTextRange(f,c(x,p)),T=!0;break}}T||(y?yield g.replaceTextRange(f,c(y,p)):yield g.removeRange(f))}})}else throw new Error("Linter: Malformed BATI.If type");break;default:throw new Error(`Linter: Unhandled BATI.${p.name} type`)}}}function Abt(t){let e={rules:{ts:{meta:{fixable:"code"},create(i){let a=i.sourceCode;return{Program(c){u9r(i,a,c)},ImportDeclaration(c){qOe(i,c)},":expression"(c){$G(i,a,c,t)},":statement"(c){$G(i,a,c,t)},SpreadElement(c){$G(i,a,c,t)},ConditionalExpression(c){az(i,a,c,t)},IfStatement(c){az(i,a,c,t)},JSXAttribute(c){$G(i,a,c,t)},TSAsExpression(c){m5e(i,a,c,t)},TSTypeParameterInstantiation(c){h5e(i,a,c,t)},TSTypeReference(c){g5e(i,a,c,t)}}}}}},n=[{plugins:{batiTs:e},languageOptions:{parser:p9r,parserOptions:{warnOnUnsupportedTypeScriptVersion:!1}},rules:{"batiTs/ts":"error"},files:["**/*.ts","**/*.js","**/*.tsx","**/*.jsx"]}];return t.BATI.has("solid")&&n.push({files:["**/*.{ts,tsx}"],...i9r,languageOptions:{parser:p9r}}),{plugin:e,config:n}}var wGi=M_(G8e(),1),PGi=M_(ujr(),1);function pjr(t,e){let n=e.getTokenBefore("startTag"in t?t.startTag:t,{includeComments:!0,filter:i=>i.type!=="HTMLWhitespace"});return n&&n.type==="HTMLComment"?[...pjr(n,e),n]:[]}function lTt(t){let e={rules:{vue:{meta:{fixable:"code"},create(i){let a=i.sourceCode,c=a.parserServices.getTemplateBodyTokenStore();return a.parserServices.defineTemplateBodyVisitor({ConditionalExpression(p){az(i,a,p,t)},IfStatement(p){az(i,a,p,t)},VElement(p){let f=pjr(p,c);if(f.length>0){let _=d5e(f[0]);if(_===null)return;let g=sz(_,t);i.report({node:p,message:"bati/vue-velement",*fix(y){g?yield y.removeRange([f[0].range[0],f[0].range[1]]):(yield y.remove(p),yield y.removeRange([f[0].range[0],f[f.length-1].range[1]]))}})}}},{ImportDeclaration(p){qOe(i,p)},":statement"(p){$G(i,a,p,t)},ConditionalExpression(p){az(i,a,p,t)},IfStatement(p){az(i,a,p,t)},TSAsExpression(p){m5e(i,a,p,t)},TSTypeParameterInstantiation(p){h5e(i,a,p,t)},TSTypeReference(p){g5e(i,a,p,t)}})}}}};return{plugin:e,config:[{plugins:{batiVue:e},languageOptions:{parser:PGi,parserOptions:{parser:wGi,ecmaVersion:2022,sourceType:"module"}},rules:{"batiVue/vue":"error"},files:["**/*.vue"]}]}}var C$r=M_(b$r(),1),A$r=M_(x$r(),1);var Kps=(t,e)=>(n,i)=>{let{parent:a}=n.node??i.sourceCode.getNodeByRangeIndex(i.sourceCode.getIndexFromLoc(n.loc.start));return a?/^Import(|Default|Namespace)Specifier$/.test(a.type)===t&&Object.assign(n,e?.(a,i)):n},yxt={filter:t=>t.value===","},Gps={includeComments:!0},Hps=Kps(!0,(t,e)=>({fix(n){let i=t.parent;if(!i)return null;let a=Wie(e);if(i.specifiers.length===1){let c=e.sourceCode.getTokenAfter(i,Gps),p=c?c.loc.start.line-i.loc.start.line:0,f=c?c.range[0]:i.range[1],_=Math.max(0,p-1);return a?.deleteImport(i.source.value),[n.remove(i),n.replaceTextRange([i.range[1],f],`
|
|
1145
|
+
`)!==-1&&e[0].value.replace(/(?!\xA0)\s/g,"")===""}var e7r,G7r,H7r,qJi=O0({"src/rules/self-closing-comp.ts"(){"use strict";nE(),XN(),e7r=K7r.ESLintUtils.RuleCreator.withoutDocs,G7r=/^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,H7r=e7r({meta:{type:"layout",docs:{description:"Disallow extra closing tags for components without children.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/self-closing-comp.md"},fixable:"code",schema:[{type:"object",properties:{component:{type:"string",description:"which Solid components should be self-closing when possible",enum:["all","none"],default:"all"},html:{type:"string",description:"which native elements should be self-closing when possible",enum:["all","void","none"],default:"all"}},additionalProperties:!1}],messages:{selfClose:"Empty components are self-closing.",dontSelfClose:"This element should not be self-closing."}},defaultOptions:[],create(t){function e(n){if(RJi(n))return(t.options[0]?.component??"all")==="all";if(n.name.type==="JSXIdentifier"&&HN(n.name.name))switch(t.options[0]?.html??"all"){case"all":return!0;case"void":return jJi(n.name.name);case"none":return!1}return!0}return{JSXOpeningElement(n){if(BJi(n)||UJi(n)){let a=e(n);a&&!n.selfClosing?t.report({node:n,messageId:"selfClose",fix(c){let p=n.range[1]-1,f=n.parent.closingElement.range[1],_=[p,f];return c.replaceTextRange(_," />")}}):!a&&n.selfClosing&&t.report({node:n,messageId:"dontSelfClose",fix(c){let p=LA(t),f=p.getText(n.name),_=n.range[1],g=p.getLastTokens(n,{count:3}),T=[p.isSpaceBetween?.(g[0],g[1])?_-3:_-2,_];return c.replaceTextRange(T,`></${f}>`)}})}}}}})}}),t7r,r7r,n7r,i7r,Z7r,VJi=O0({"src/rules/style-prop.ts"(){"use strict";nE(),XN(),t7r=_5e.ESLintUtils.RuleCreator.withoutDocs,{getPropertyName:r7r,getStaticValue:n7r}=_5e.ASTUtils,i7r=/\b(?:width|height|margin|padding|border-width|font-size)\b/i,Z7r=t7r({meta:{type:"problem",docs:{description:"Require CSS properties in the `style` prop to be valid and kebab-cased (ex. 'font-size'), not camel-cased (ex. 'fontSize') like in React, and that property values with dimensions are strings, not numbers with implicit 'px' units.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/style-prop.md"},fixable:"code",schema:[{type:"object",properties:{styleProps:{description:"an array of prop names to treat as a CSS style object",default:["style"],type:"array",items:{type:"string"},minItems:1,uniqueItems:!0},allowString:{description:"if allowString is set to true, this rule will not convert a style string literal into a style object (not recommended for performance)",type:"boolean",default:!1}},additionalProperties:!1}],messages:{kebabStyleProp:"Use {{ kebabName }} instead of {{ name }}.",invalidStyleProp:"{{ name }} is not a valid CSS property.",numericStyleValue:'This CSS property value should be a string with a unit; Solid does not automatically append a "px" unit.',stringStyle:"Use an object for the style prop instead of a string."}},defaultOptions:[],create(t){let e=new Set(Q7r.all),n=!!t.options[0]?.allowString,i=t.options[0]?.styleProps||["style"];return{JSXAttribute(a){if(i.indexOf(Ase(a))===-1)return;let c=a.value?.type==="JSXExpressionContainer"?a.value.expression:a.value;if(c)if(c.type==="Literal"&&typeof c.value=="string"&&!n){let p;try{p=pRr(c.value)??void 0}catch{}t.report({node:c,messageId:"stringStyle",fix:p&&(f=>f.replaceText(a.value,`{${JSON.stringify(p)}}`))})}else c.type==="TemplateLiteral"&&!n?t.report({node:c,messageId:"stringStyle"}):c.type==="ObjectExpression"&&c.properties.filter(f=>f.type==="Property").forEach(f=>{let _=r7r(f,Yye(t,f));if(_&&!_.startsWith("--")&&!e.has(_)){let g=(0,X7r.default)(_);e.has(g)?t.report({node:f.key,messageId:"kebabStyleProp",data:{name:_,kebabName:g},fix:y=>y.replaceText(f.key,`"${g}"`)}):t.report({node:f.key,messageId:"invalidStyleProp",data:{name:_}})}else if(!_||!_.startsWith("--")&&i7r.test(_)){let g=n7r(f.value)?.value;typeof g=="number"&&g!==0&&t.report({node:f.value,messageId:"numericStyleValue"})}});else return}}}})}}),s7r,t9r,zJi=O0({"src/rules/no-array-handlers.ts"(){"use strict";nE(),s7r=e9r.ESLintUtils.RuleCreator.withoutDocs,t9r=s7r({meta:{type:"problem",docs:{description:"Disallow usage of type-unsafe event handlers.",url:"https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-array-handlers.md"},schema:[],messages:{noArrayHandlers:"Passing an array as an event handler is potentially type-unsafe."}},defaultOptions:[],create(t){return{JSXAttribute(e){let n=e.parent;if(n.name.type!=="JSXIdentifier"||!HN(n.name.name))return;let i=e.name.type==="JSXNamespacedName"&&e.name.namespace.name==="on",a=e.name.type==="JSXIdentifier"&&/^on[a-zA-Z]/.test(e.name.name);(i||a)&&e.value?.type==="JSXExpressionContainer"&&Wye(e.value.expression,t).type==="ArrayExpression"&&t.report({node:e,messageId:"noArrayHandlers"})}}}})}}),YJi=p7r({"package.json"(t,e){e.exports={name:"eslint-plugin-solid",version:"0.14.5",description:"Solid-specific linting rules for ESLint.",keywords:["eslint","eslintplugin","solid","solidjs","reactivity"],repository:"https://github.com/solidjs-community/eslint-plugin-solid",license:"MIT",author:"Josh Wilson <joshwilsonvu@gmail.com>",exports:{".":{types:{import:"./dist/index.d.mts",require:"./dist/index.d.ts"},import:"./dist/index.mjs",require:"./dist/index.js"},"./configs/recommended":{types:{import:"./dist/configs/recommended.d.mts",require:"./dist/configs/recommended.d.ts"},import:"./dist/configs/recommended.mjs",require:"./dist/configs/recommended.js"},"./configs/typescript":{types:{import:"./dist/configs/typescript.d.mts",require:"./dist/configs/typescript.d.ts"},import:"./dist/configs/typescript.mjs",require:"./dist/configs/typescript.js"},"./package.json":"./package.json"},main:"dist/index.js",types:"dist/index.d.ts",files:["src","dist","README.md"],scripts:{build:"tsup",test:"vitest --run","test:all":"PARSER=all vitest --run","test:babel":"PARSER=babel vitest --run","test:ts":"PARSER=ts vitest --run","test:v6":"PARSER=v6 vitest --run","test:v7":"PARSER=v7 vitest --run","test:watch":"vitest","turbo:build":"tsup","turbo:docs":"PARSER=none tsx scripts/docs.ts","turbo:test":"vitest --run"},dependencies:{"@typescript-eslint/utils":"^7.13.1 || ^8.0.0",estraverse:"^5.3.0","is-html":"^2.0.0","kebab-case":"^1.0.2","known-css-properties":"^0.30.0","style-to-object":"^1.0.6"},devDependencies:{"@babel/core":"^7.24.4","@babel/eslint-parser":"^7.24.7","@microsoft/api-extractor":"^7.47.6","@types/eslint":"^8.56.10","@types/eslint-v6":"npm:@types/eslint@6","@types/eslint-v7":"npm:@types/eslint@7","@types/eslint-v8":"npm:@types/eslint@8","@types/eslint__js":"^8.42.3","@types/estraverse":"^5.1.7","@types/is-html":"^2.0.2","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0",eslint:"^9.5.0","eslint-v6":"npm:eslint@6","eslint-v7":"npm:eslint@7","eslint-v8":"npm:eslint@8","markdown-magic":"^3.3.0",prettier:"^2.8.8",tsup:"^8.2.4",tsx:"^4.17.0",vitest:"^1.5.2"},peerDependencies:{eslint:"^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",typescript:">=4.8.4"},engines:{node:">=18.0.0"}}}}),a7r,o7r,l7r,c7r,r9r,WJi=O0({"src/plugin.ts"(){"use strict";TJi(),vJi(),SJi(),EJi(),xJi(),CJi(),AJi(),DJi(),wJi(),PJi(),kJi(),NJi(),IJi(),OJi(),LJi(),FJi(),MJi(),qJi(),VJi(),zJi(),{name:a7r,version:o7r}=YJi(),l7r={name:a7r,version:o7r},c7r={"components-return-once":b7r,"event-handlers":T7r,imports:S7r,"jsx-no-duplicate-props":x7r,"jsx-no-undef":D7r,"jsx-no-script-url":C7r,"jsx-uses-vars":P7r,"no-destructure":k7r,"no-innerhtml":I7r,"no-proxy-apis":L7r,"no-react-deps":M7r,"no-react-specific-props":j7r,"no-unknown-namespaces":U7r,"prefer-classlist":V7r,"prefer-for":z7r,"prefer-show":W7r,reactivity:$7r,"self-closing-comp":H7r,"style-prop":Z7r,"no-array-handlers":t9r},r9r={meta:l7r,rules:c7r}}}),n9r=p7r({"src/configs/recommended.ts"(t,e){WJi();var n={plugins:{solid:r9r},languageOptions:{sourceType:"module",parserOptions:{ecmaFeatures:{jsx:!0}}},rules:{"solid/jsx-no-duplicate-props":2,"solid/jsx-no-undef":2,"solid/jsx-uses-vars":2,"solid/no-unknown-namespaces":2,"solid/no-innerhtml":2,"solid/jsx-no-script-url":2,"solid/components-return-once":1,"solid/no-destructure":2,"solid/prefer-for":2,"solid/reactivity":1,"solid/event-handlers":1,"solid/imports":1,"solid/style-prop":1,"solid/no-react-deps":1,"solid/no-react-specific-props":1,"solid/self-closing-comp":1,"solid/no-array-handlers":0,"solid/prefer-show":0,"solid/no-proxy-apis":0,"solid/prefer-classlist":0}};e.exports=n}});var i9r=n9r();function sz(t,e){let i=new Function(`{ return function(BATI, BATI_TEST){ return ${t} } };`).call(null).call(null,e.BATI,e.BATI_TEST);if(i!=="remove-comments-only"&&typeof i!="boolean")throw new Error("Condition evaluation failed");return i}function s9r(t){return!t.includes("BATI.has")&&!t.includes("BATI_TEST")?null:t.replace(/^# /,"").trim()}function a9r(t,e){if(!e.test.range)return null;let n=t.text.slice(e.test.range[0],e.test.range[1]);return s9r(n)}function d5e(t){return s9r(t.value)}function o9r(t){return t.value.includes(" BATI ")?t.value.replace(/^#/,"").replace(/#$/,"").replace(/\s+BATI\s+/,"").trim().split(","):null}function l9r(t){return t.body.length===0?[t.range[0]+1,t.range[1]-1]:[t.body[0].range[0],t.body[t.body.length-1].range[1]]}function c9r(t,e,n){return t.type==="ConditionalExpression"&&"parent"in t&&t.parent&&t.parent.type==="JSXExpressionContainer"&&(e.type==="JSXElement"||n==="null"||n==="undefined")?{range:t.parent.range,body:n==="null"||n==="undefined"?"":n}:{range:t.range,body:n}}function az(t,e,n,i){let a=a9r(e,n);if(a===null)return;let c=sz(a,i);t.report({node:n,message:"bati/if-statement",*fix(p){if(c)if(n.consequent.type==="BlockStatement"){let f=e.text.slice(...l9r(n.consequent));yield p.replaceTextRange(n.range,f)}else{let f=e.text.slice(...n.consequent.range),_=c9r(n,n.consequent,f);yield p.replaceTextRange(_.range,_.body)}else if(n.alternate)if(n.alternate.type==="BlockStatement"){let f=e.text.slice(...l9r(n.alternate));yield p.replaceTextRange(n.range,f)}else{let f=e.text.slice(...n.alternate.range),_=c9r(n,n.alternate,f);yield p.replaceTextRange(_.range,_.body)}else yield p.remove(n)}})}function u9r(t,e,n){let i=e.getAllComments();if(i.length>0&&i[0].range?.[0]===0){let a=i[0],c=o9r(a);if(c===null||c.length===0)return;let p=Wie(t);for(let f of c)switch(f){case"include-if-imported":p?.addFlag(f);break;default:t.report({node:n,message:`Unknown BATI file flag ${f}`,loc:a.loc});return}t.report({node:n,message:"bati/global-comment",*fix(f){yield f.remove(a)}})}}function $G(t,e,n,i){let a=e.getCommentsBefore(n);if(a.length>0){let c=a[0];if(c.handled)return;c.handled=!0;let p=d5e(c);if(p===null)return;let f=sz(p,i),_,g;if(!(a.length>1&&f==="remove-comments-only")){let T=["Property"];for(["SpreadElement","Identifier"].includes(n.type)&&T.includes(n.parent?.type)&&(n=n.parent),_=n.range[0],g=n.range[1];e.text[g]?.match(/\s|,/)&&(g+=1,e.text[g-1]!==","););}t.report({node:n,message:"bati/statement-comments",*fix(T){if(!f||f==="remove-comments-only"){_!==void 0&&g!==void 0&&(yield T.removeRange([_,g]));for(let b of a)yield T.remove(b)}else yield T.remove(c)}})}}function m5e(t,e,n,i){Cbt(t,e,n.typeAnnotation,i,()=>{let a=n.expression.range[1]+1,c=n.range[1];return[a,c]},(a,c)=>c.name==="IfAsUnknown"?` as unknown as ${a}`:` as ${a}`)}function h5e(t,e,n,i){for(let a of n.params)Cbt(t,e,a,i,()=>[n.params[0].range[0],n.params[n.params.length-1].range[1]],c=>c)}function g5e(t,e,n,i){Cbt(t,e,n,i,()=>n.range,a=>a)}function Cbt(t,e,n,i,a,c){if(n.type==="TSTypeReference"&&n.typeName.type==="TSQualifiedName"&&n.typeName.left.type==="Identifier"&&n.typeName.left.name==="BATI"){let{right:p}=n.typeName,f=a();switch(p.name){case"Any":t.report({node:n,message:"bati/as-expression-any",*fix(_){yield _.removeRange(f)}});break;case"If":case"IfAsUnknown":if(n.typeArguments?.type==="TSTypeParameterInstantiation"&&n.typeArguments.params[0].type==="TSTypeLiteral"){let _=n.typeArguments.params[0].members;t.report({node:n,message:"bati/as-expression-if",*fix(g){let y,T=!1;for(let b of _){if(b.type!=="TSPropertySignature"||b.key.type!=="Literal"&&b.key.type!=="Identifier"||b.typeAnnotation?.type!=="TSTypeAnnotation")throw console.log(),new Error("Linter: Malformed BATI.If members type");let E="value"in b.key?b.key.value:b.key.name,x=e.text.slice(b.typeAnnotation.typeAnnotation.range[0],b.typeAnnotation.typeAnnotation.range[1]);if(E==="_"){y=x;continue}if(sz(E,i)){yield g.replaceTextRange(f,c(x,p)),T=!0;break}}T||(y?yield g.replaceTextRange(f,c(y,p)):yield g.removeRange(f))}})}else throw new Error("Linter: Malformed BATI.If type");break;default:throw new Error(`Linter: Unhandled BATI.${p.name} type`)}}}function Abt(t){let e={rules:{ts:{meta:{fixable:"code"},create(i){let a=i.sourceCode;return{Program(c){u9r(i,a,c)},ImportDeclaration(c){qOe(i,c)},":expression"(c){$G(i,a,c,t)},":statement"(c){$G(i,a,c,t)},SpreadElement(c){$G(i,a,c,t)},ConditionalExpression(c){az(i,a,c,t)},IfStatement(c){az(i,a,c,t)},JSXAttribute(c){$G(i,a,c,t)},TSAsExpression(c){m5e(i,a,c,t)},TSTypeParameterInstantiation(c){h5e(i,a,c,t)},TSTypeReference(c){g5e(i,a,c,t)}}}}}},n=[{plugins:{batiTs:e},languageOptions:{parser:p9r,parserOptions:{warnOnUnsupportedTypeScriptVersion:!1}},rules:{"batiTs/ts":"error"},files:["**/*.ts","**/*.js","**/*.tsx","**/*.jsx"]}];return t.BATI.has("solid")&&n.push({files:["**/*.{ts,tsx}"],...i9r,languageOptions:{parser:p9r}}),{plugin:e,config:n}}var wGi=M_(G8e(),1),PGi=M_(ujr(),1);function pjr(t,e){let n=e.getTokenBefore("startTag"in t?t.startTag:t,{includeComments:!0,filter:i=>i.type!=="HTMLWhitespace"});return n&&n.type==="HTMLComment"?[...pjr(n,e),n]:[]}function lTt(t){let e={rules:{vue:{meta:{fixable:"code"},create(i){let a=i.sourceCode,c=a.parserServices.getTemplateBodyTokenStore();return a.parserServices.defineTemplateBodyVisitor({ConditionalExpression(p){az(i,a,p,t)},IfStatement(p){az(i,a,p,t)},VElement(p){let f=pjr(p,c);if(f.length>0){let _=d5e(f[0]);if(_===null)return;let g=sz(_,t);i.report({node:p,message:"bati/vue-velement",*fix(y){g?yield y.removeRange([f[0].range[0],f[0].range[1]]):(yield y.remove(p),yield y.removeRange([f[0].range[0],f[f.length-1].range[1]]))}})}}},{ImportDeclaration(p){qOe(i,p)},":statement"(p){$G(i,a,p,t)},ConditionalExpression(p){az(i,a,p,t)},IfStatement(p){az(i,a,p,t)},TSAsExpression(p){m5e(i,a,p,t)},TSTypeParameterInstantiation(p){h5e(i,a,p,t)},TSTypeReference(p){g5e(i,a,p,t)}})}}}};return{plugin:e,config:[{plugins:{batiVue:e},languageOptions:{parser:PGi,parserOptions:{parser:wGi,ecmaVersion:2022,sourceType:"module"}},rules:{"batiVue/vue":"error"},files:["**/*.vue"]}]}}var C$r=M_(b$r(),1),A$r=M_(x$r(),1);var Kps=(t,e)=>(n,i)=>{let{parent:a}=n.node??i.sourceCode.getNodeByRangeIndex(i.sourceCode.getIndexFromLoc(n.loc.start));return a?/^Import(|Default|Namespace)Specifier$/.test(a.type)===t&&Object.assign(n,e?.(a,i)):n},yxt={filter:t=>t.value===","},Gps={includeComments:!0},Hps=Kps(!0,(t,e)=>({fix(n){let i=t.parent;if(!i)return null;let a=Wie(e);if(i.specifiers.length===1){let c=e.sourceCode.getTokenAfter(i,Gps),p=c?c.loc.start.line-i.loc.start.line:0,f=c?c.range[0]:i.range[1],_=Math.max(0,p-1);return a?.deleteImport(i.source.value),[n.remove(i),n.replaceTextRange([i.range[1],f],`
|
|
1146
1146
|
`.repeat(_))]}if(t!==i.specifiers[i.specifiers.length-1]){let c=e.sourceCode.getTokenAfter(t,yxt),p=e.sourceCode.getTokenBefore(t);return[n.removeRange([p.range[1],t.range[0]]),n.remove(t),n.remove(c)]}if(i.specifiers.filter(c=>c.type==="ImportSpecifier").length===1){let c=e.sourceCode.getTokenBefore(t,yxt),p=e.sourceCode.getTokenAfter(t,{filter:f=>f.value==="}"});return n.removeRange([c.range[0],p.range[1]])}return n.removeRange([e.sourceCode.getTokenBefore(t,yxt).range[0],t.range[1]])}}));function bxt(){let t=C$r.default.rules["no-unused-vars"];t.meta.fixable="code";let e={rules:{"unused-imports":A$r.default.filterReports(t,Hps)}};return{plugin:e,config:[{plugins:{"unused-imports":e},rules:{"unused-imports/unused-imports":"error"}}]}}function D$r(t,e,n){return Hkr(t,[...Abt(n).config,...lTt(n).config,...bxt().config],e)}var w$r=new Function("return this")().Promise,xxt=!1;try{xxt=new Function("return (async function(){}).constructor")()}catch(t){if(!(t instanceof SyntaxError))throw t}function N$r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function d1e(t,e,n){for(var i in e)N$r(e,i)&&(e[i]!=null&&typeof e[i]=="object"&&(i==="storage"||i==="prefixes")&&!n?t[i]=d1e({},e[i]):t[i]=e[i]);return t}function Xps(t,e,n,i){var a,c;return typeof e.autoTrim=="string"?a=c=e.autoTrim:Array.isArray(e.autoTrim)&&(a=e.autoTrim[1],c=e.autoTrim[0]),(n||n===!1)&&(a=n),(i||i===!1)&&(c=i),a==="slurp"&&c==="slurp"?t.trim():(a==="_"||a==="slurp"?String.prototype.trimLeft?t=t.trimLeft():t=t.replace(/^[\s\uFEFF\xA0]+/,""):(a==="-"||a==="nl")&&(t=t.replace(/^(?:\n|\r|\r\n)/,"")),c==="_"||c==="slurp"?String.prototype.trimRight?t=t.trimRight():t=t.replace(/[\s\uFEFF\xA0]+$/,""):(c==="-"||c==="nl")&&(t=t.replace(/(?:\n|\r|\r\n)$/,"")),t)}function Qps(t){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)}var c7e=(function(){function t(e){this.cache=e}return t.prototype.define=function(e,n){this.cache[e]=n},t.prototype.get=function(e){return this.cache[e]},t.prototype.remove=function(e){delete this.cache[e]},t.prototype.reset=function(){this.cache={}},t.prototype.load=function(e){d1e(this.cache,e,!0)},t})();function Zps(t,e){Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e}function iS(t){var e=new Error(t);return Zps(e,iS.prototype),e}iS.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});function Fz(t,e,n){var i=e.slice(0,n).split(/\n/),a=i.length,c=i[a-1].length+1;throw t+=" at line "+a+" col "+c+`:
|
|
1147
1147
|
|
|
1148
1148
|
`+e.split(/\n/)[a-1]+`
|
|
@@ -1152,7 +1152,7 @@ ${j} return (`),yield _.insertTextAfter(z,`);
|
|
|
1152
1152
|
|
|
1153
1153
|
`+a.message+`
|
|
1154
1154
|
`+Array(a.message.length+1).join("=")+`
|
|
1155
|
-
`+k$r(t,n)):a}}var Axt=$s("fs"),vxt=$s("path"),lfs=/^\uFEFF/;function Sxt(t,e,n){var i=vxt.resolve(n?e:vxt.dirname(e),t),a=vxt.extname(t);return a||(i+=".sqrl"),i}function cfs(t,e){var n,i,a=e.views,c=/^[A-Za-z]+:\\|^\//.exec(t);if(c&&c.length)n=Sxt(t.replace(/^\/*/,""),e.root||"/",!0);else if(e.filename&&(i=Sxt(t,e.filename),Axt.existsSync(i)&&(n=i)),n||Array.isArray(a)&&a.some(function(p){return i=Sxt(t,p,!0),Axt.existsSync(i)})&&(n=i),!n)throw iS('Could not find the include file "'+t+'"');return n}function M$r(t){return Axt.readFileSync(t).toString().replace(lfs,"")}function ufs(t,e){var n=u7e(e),i=M$r(t);try{var a=wxt(i,n);return n.storage.templates.define(n.filename,a),a}catch{throw iS("Loading file: "+t+" failed")}}function pfs(t){var e=t.filename;if(t.cache){var n=t.storage.templates.get(e);return n||ufs(e,t)}return wxt(M$r(e),t)}function R$r(t,e){var n=u7e({filename:cfs(t,e)},e);return pfs(n)}function ffs(t,e,n){if(e&&e.length>0)throw iS("Helper 'includeFile' doesn't accept blocks");return R$r(t.params[0],n)(t.params[1],n)}function _fs(t,e,n){var i=t.params[1]||{};i.content=t.exec();for(var a=0;a<e.length;a++){var c=e[a];i[c.name]=c.exec()}return R$r(t.params[0],n)(i,n)}function Ext(t,e){var n;return e.cache&&e.name&&e.storage.templates.get(e.name)?e.storage.templates.get(e.name):(typeof t=="function"?n=t:n=wxt(t,e),e.cache&&e.name&&e.storage.templates.define(e.name,n),n)}function j$r(t,e,n,i){var a=u7e(n||{});if(a.async){var c;if(i)try{Ext(t,a)(e,a,i)}catch(p){return i(p)}else{if(typeof w$r=="function")return new w$r(function(p,f){try{c=Ext(t,a)(e,a),p(c)}catch(_){f(_)}});throw iS("Please provide a callback function, this env doesn't support Promises")}}else return Ext(t,a)(e,a)}Dxt.define("includeFile",ffs);Dxt.define("extendsFile",_fs);var Pxt=["/*{","}*/"];function B$r(t,e){return j$r(t,e,{tags:Pxt})}function dfs(t,e){return{eslint:(t.includes("BATI.has")||t.includes("BATI_TEST")||t.includes("/*# BATI ")||t.includes("@batijs/")||e.endsWith(".ts")||e.endsWith(".tsx"))&&!e.endsWith(".css"),squirelly:t.includes(Pxt[0])}}async function mfs(t,e,n){let{eslint:i,squirelly:a}=dfs(t,n.filepath),c=t,p,f=!1;if(a&&(c=B$r(c,e),f=!0),i){let _=D$r(c,n.filepath,e);c=_.code,p=_.context,f=!0}return{code:f?await Pit(c,n):c,context:p}}import{randomBytes as DBs}from"crypto";var kxt={name:"@batijs/core",version:"0.0.
|
|
1155
|
+
`+k$r(t,n)):a}}var Axt=$s("fs"),vxt=$s("path"),lfs=/^\uFEFF/;function Sxt(t,e,n){var i=vxt.resolve(n?e:vxt.dirname(e),t),a=vxt.extname(t);return a||(i+=".sqrl"),i}function cfs(t,e){var n,i,a=e.views,c=/^[A-Za-z]+:\\|^\//.exec(t);if(c&&c.length)n=Sxt(t.replace(/^\/*/,""),e.root||"/",!0);else if(e.filename&&(i=Sxt(t,e.filename),Axt.existsSync(i)&&(n=i)),n||Array.isArray(a)&&a.some(function(p){return i=Sxt(t,p,!0),Axt.existsSync(i)})&&(n=i),!n)throw iS('Could not find the include file "'+t+'"');return n}function M$r(t){return Axt.readFileSync(t).toString().replace(lfs,"")}function ufs(t,e){var n=u7e(e),i=M$r(t);try{var a=wxt(i,n);return n.storage.templates.define(n.filename,a),a}catch{throw iS("Loading file: "+t+" failed")}}function pfs(t){var e=t.filename;if(t.cache){var n=t.storage.templates.get(e);return n||ufs(e,t)}return wxt(M$r(e),t)}function R$r(t,e){var n=u7e({filename:cfs(t,e)},e);return pfs(n)}function ffs(t,e,n){if(e&&e.length>0)throw iS("Helper 'includeFile' doesn't accept blocks");return R$r(t.params[0],n)(t.params[1],n)}function _fs(t,e,n){var i=t.params[1]||{};i.content=t.exec();for(var a=0;a<e.length;a++){var c=e[a];i[c.name]=c.exec()}return R$r(t.params[0],n)(i,n)}function Ext(t,e){var n;return e.cache&&e.name&&e.storage.templates.get(e.name)?e.storage.templates.get(e.name):(typeof t=="function"?n=t:n=wxt(t,e),e.cache&&e.name&&e.storage.templates.define(e.name,n),n)}function j$r(t,e,n,i){var a=u7e(n||{});if(a.async){var c;if(i)try{Ext(t,a)(e,a,i)}catch(p){return i(p)}else{if(typeof w$r=="function")return new w$r(function(p,f){try{c=Ext(t,a)(e,a),p(c)}catch(_){f(_)}});throw iS("Please provide a callback function, this env doesn't support Promises")}}else return Ext(t,a)(e,a)}Dxt.define("includeFile",ffs);Dxt.define("extendsFile",_fs);var Pxt=["/*{","}*/"];function B$r(t,e){return j$r(t,e,{tags:Pxt})}function dfs(t,e){return{eslint:(t.includes("BATI.has")||t.includes("BATI_TEST")||t.includes("/*# BATI ")||t.includes("@batijs/")||e.endsWith(".ts")||e.endsWith(".tsx"))&&!e.endsWith(".css"),squirelly:t.includes(Pxt[0])}}async function mfs(t,e,n){let{eslint:i,squirelly:a}=dfs(t,n.filepath),c=t,p,f=!1;if(a&&(c=B$r(c,e),f=!0),i){let _=D$r(c,n.filepath,e);c=_.code,p=_.context,f=!0}return{code:f?await Pit(c,n):c,context:p}}import{randomBytes as DBs}from"crypto";var kxt={name:"@batijs/core",version:"0.0.494",description:"",type:"module",types:"./dist/index.d.ts",scripts:{"check-types":"tsc --noEmit",vue:"tsx src/parse/linters/vue.ts",test:"vitest run","test:ci":"vitest run",build:"tsup"},keywords:[],author:"Jo\xEBl Charles <joel.charles91@gmail.com>",repository:"https://github.com/vikejs/bati",license:"MIT",devDependencies:{"@batijs/features":"workspace:*","@types/eslint":"^9.6.1","@types/estree":"^1.0.8","@types/node":"^20.19.21","@types/which":"^3.0.4","@typescript-eslint/parser":"^8.46.2","@typescript-eslint/utils":"^8.46.2","attributes-parser":"^2.2.3",colorette:"^2.0.20",esbuild:"^0.25.12",eslint:"^9.39.0","eslint-plugin-solid":"^0.14.5","eslint-rule-composer":"^0.3.0",espree:"^10.4.0",magicast:"^0.5.1","mdast-builder":"^1.1.1","mdast-util-from-markdown":"^2.0.2","mdast-util-to-markdown":"^2.1.2","mdast-util-to-string":"^4.0.0","mdast-util-toc":"^7.1.0",prettier:"^3.6.2",squirrelly:"^9.1.0",tsup:"^8.5.0",tsx:"^4.20.6",typescript:"^5.9.3","unplugin-purge-polyfills":"^0.1.0",vitest:"^4.0.6","vue-eslint-parser":"^10.2.0",which:"^5.0.0",yaml:"^2.8.1"},exports:{".":"./dist/index.js","./types":{types:"./global.d.ts"}},typesVersions:{"*":{types:["./global.d.ts"]}},files:["dist/"]};function gfs(){if(process.env.npm_config_user_agent)return yfs(process.env.npm_config_user_agent)}function yfs(t){let e=t.split(" ")[0],n=e.lastIndexOf("/"),i=e.substring(0,n);return{name:i==="npminstall"?"cnpm":i,version:e.substring(n+1)}}function NBs(){switch(gfs()?.name){case"pnpm":return"pnpm create vike@latest";case"yarn":return"yarn create vike@latest";case"bun":return"bun create vike@latest";default:return"npm create vike@latest ---"}}function IBs(){let t=kxt.version.split("."),e=t[0],n=t[1],i=t.slice(2).join(".");return{version:kxt.version,semver:[e,n,i]}}function LBs(t,e,n,i){t??="",t.endsWith(`
|
|
1156
1156
|
|
|
1157
1157
|
`)||(t.endsWith(`
|
|
1158
1158
|
`)?t=`${t}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@batijs/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.494",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"vue-eslint-parser": "^10.2.0",
|
|
39
39
|
"which": "^5.0.0",
|
|
40
40
|
"yaml": "^2.8.1",
|
|
41
|
-
"@batijs/features": "0.0.
|
|
41
|
+
"@batijs/features": "0.0.494"
|
|
42
42
|
},
|
|
43
43
|
"exports": {
|
|
44
44
|
".": "./dist/index.js",
|