@batijs/core 0.0.529 → 0.0.530
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/index.js
CHANGED
|
@@ -1134,7 +1134,7 @@ ${E.map(({test:k,consequent:F})=>`<Match when={${_.getText(k)}}>${n(F)}</Match>`
|
|
|
1134
1134
|
`),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,`{
|
|
1135
1135
|
${j} return (`),yield _.insertTextAfter(z,`);
|
|
1136
1136
|
}`)}}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 oe=z.real.type==="Identifier"&&!z.computed?`.${z.real.name}`:`[${w.getText(z.real)}]`;yield _.replaceText(G.identifier,`${g}${oe}`)}}}}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)}}}})}}),IFr,OFr,DMr,vUi=I0({"src/rules/no-innerhtml.ts"(){"use strict";ZS(),IFr=h8e.ESLintUtils.RuleCreator.withoutDocs,{getStringIfConstant:OFr}=h8e.ASTUtils,DMr=IFr({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(tse(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(tse(n)!=="innerHTML")return;if(e){let i=n.value?.type==="JSXExpressionContainer"?n.value.expression:n.value,a=i&&OFr(i);typeof a=="string"?(0,AMr.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"})}}}})}}),LFr,PMr,SUi=I0({"src/rules/no-proxy-apis.ts"(){"use strict";ZS(),LFr=wMr.ESLintUtils.RuleCreator.withoutDocs,PMr=LFr({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}=f8e();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=bye(a,t);return c.type==="Identifier"&&!gye(c.name)||Oy(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"})}}}})}}),FFr,NMr,EUi=I0({"src/rules/no-react-deps.ts"(){"use strict";ZS(),FFr=kMr.ESLintUtils.RuleCreator.withoutDocs,NMr=FFr({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}=f8e();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=>bye(p,t));Oy(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})}}}}})}}),MFr,RFr,OMr,xUi=I0({"src/rules/no-react-specific-props.ts"(){"use strict";ZS(),MFr=IMr.ESLintUtils.RuleCreator.withoutDocs,RFr=[{from:"className",to:"class"},{from:"htmlFor",to:"for"}],OMr=MFr({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 RFr){let a=lFr(e.attributes,n);if(a){let c=pMr(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"&&qN(e.name.name)){let n=lFr(e.attributes,"key");n&&t.report({node:n,messageId:"noUselessKey",fix:i=>i.remove(n)})}}}}})}}),jFr,c0t,BFr,UFr,FMr,CUi=I0({"src/rules/no-unknown-namespaces.ts"(){"use strict";ZS(),jFr=LMr.ESLintUtils.RuleCreator.withoutDocs,c0t=["on","oncapture","use","prop","attr","bool"],BFr=["style","class"],UFr=["xmlns","xlink"],FMr=jFr({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 (${c0t.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"&&!qN(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;c0t.includes(a)||UFr.includes(a)||e?.includes(a)||(BFr.includes(a)?t.report({node:n,messageId:"style",data:{namespace:a}}):t.report({node:n,messageId:"unknown",data:{namespace:a}}))}}}})}}),qFr,RMr,AUi=I0({"src/rules/prefer-classlist.ts"(){"use strict";ZS(),qFr=MMr.ESLintUtils.RuleCreator.withoutDocs,RMr=qFr({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(tse(n))===-1||pMr(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]],"}")]}})}}}}})}}),VFr,zFr,jMr,DUi=I0({"src/rules/prefer-for.ts"(){"use strict";ZS(),VFr=g8e.ESLintUtils.RuleCreator.withoutDocs,{getPropertyName:zFr}=g8e.ASTUtils,jMr=VFr({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"&&RV(i.parent.parent)&&n.callee.type==="MemberExpression"&&zFr(n.callee)==="map"&&n.arguments.length===1&&Oy(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"})}}}}})}}),YFr,u8e,UMr,wUi=I0({"src/rules/prefer-show.ts"(){"use strict";ZS(),VN(),YFr=BMr.ESLintUtils.RuleCreator.withoutDocs,u8e=["JSXElement","JSXFragment","Identifier"],UMr=YFr({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=PA(t),n=c=>{let p=e.getText(c);return RV(c)?p:`{${p}}`},i=c=>{c.operator==="&&"&&u8e.includes(c.right.type)&&t.report({node:c,messageId:"preferShowAnd",fix:p=>p.replaceText(c.parent?.type==="JSXExpressionContainer"&&RV(c.parent.parent)?c.parent:c,`<Show when={${e.getText(c.left)}}>${n(c.right)}</Show>`)})},a=c=>{(u8e.includes(c.consequent.type)||u8e.includes(c.alternate.type))&&t.report({node:c,messageId:"preferShowTernary",fix:p=>p.replaceText(c.parent?.type==="JSXExpressionContainer"&&RV(c.parent.parent)?c.parent:c,`<Show when={${e.getText(c.test)}} fallback={${e.getText(c.alternate)}}>${n(c.consequent)}</Show>`)})};return{JSXExpressionContainer(c){RV(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))}}}})}}),WFr,JFr,$Fr,KFr,Zie,ese,VMr,PUi=I0({"src/rules/reactivity.ts"(){"use strict";ZS(),VN(),{getFunctionHeadLocation:WFr}=y8e.ASTUtils,JFr=y8e.ESLintUtils.RuleCreator.withoutDocs,$Fr=class{node;trackedScopes=[];unnamedDerivedSignals=new Set;hasJSX=!1;constructor(t){this.node=t}},KFr=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=r0t(t.identifier,p8e);for(;Oy(e)&&this.syncCallbacks.has(e);)e=r0t(e,p8e);return e===this.currentScope().node}signals=[];props=[]},Zie=(t,e,n)=>{if(t?.type==="ArrayPattern"){let i=t.elements[e];if(i?.type==="Identifier")return IF(n,i)}return null},ese=(t,e)=>t.type==="Identifier"?IF(e,t):null,VMr=JFr({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=PA(t),c=new KFr,{currentScope:p,parentScope:f}=c,{matchImport:_,handleImportDeclaration:g}=f8e(),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=IF(t,j.params[0]);z&&c.pushProps(z,j)}},T=j=>{if(Oy(j)){if(c.syncCallbacks.has(j))return;y(j,B=>gye(B.name))}c.push(new $Fr(j))},b=(j,B)=>{switch(j.expect){case"function":case"called-function":return B===j.node;case"expression":return!!fUi(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 oe=j.parent?.type==="CallExpression"?j.parent:null;t.report({node:G??oe??j,messageId:H?"expectedFunctionGotExpression":"untrackedReactive",data:{name:G?a.getText(G):j.name}})}else{if(!f()||!Oy(z))throw new Error("this shouldn't happen!");let G=()=>(f().unnamedDerivedSignals??=new Set).add(z);if(z.type==="FunctionDeclaration"){let oe=a.scopeManager?.getDeclaredVariables(z)?.[0];oe?c.pushUniqueSignal(oe,B):G()}else if(z.parent?.type==="VariableDeclarator"){let oe=z.parent,pe=a.scopeManager?.getDeclaredVariables(oe)?.[0];pe?c.pushUniqueSignal(pe,B):G()}else z.parent?.type==="Property"||G()}}},C=j=>{if(Oy(j)&&y(j,z=>{if(!gye(z.name)&&p().hasJSX){let H=_0t(j);if(H&&!/^[a-z]/.test(H))return!0}return!1}),Oy(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 oe=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")oe("template literals");else if(G.parent?.type==="BinaryExpression"&&["<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","**","|","^","&","in"].includes(G.parent.operator))oe("arithmetic or comparisons");else if(G.parent?.type==="UnaryExpression"&&["-","+","~"].includes(G.parent.operator))oe("unary expressions");else if(G.parent?.type==="MemberExpression"&&G.parent.computed&&G.parent.property===G)oe("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;(RV(pe)||pe?.type==="JSXAttribute"&&pe.parent?.type==="JSXOpeningElement"&&pe.parent.name.type==="JSXIdentifier"&&qN(pe.parent.name.name))&&oe("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:oe}=G;oe.parent?.type==="AssignmentExpression"&&oe.parent.left===oe?t.report({node:G,messageId:"noWrite",data:{name:G.name}}):oe.property.type==="Identifier"&&/^(?:initial|default|static[A-Z])/.test(oe.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:WFr(z,a),messageId:"badUnnamedDerivedSignal"});c.pop()},w=j=>{if(j.arguments.length===1&&Oy(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=Zie(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)Oy(G)&&!G.async&&c.syncCallbacks.add(G)}}else if(_(["mapArray","indexArray"],j.callee.name)){let B=j.arguments[1];Oy(B)&&c.syncCallbacks.add(B)}}Oy(j.callee)&&c.syncCallbacks.add(j.callee)},k=(j,B)=>{if(B=u0t(B),B.type==="CallExpression"&&B.callee.type==="Identifier"){let{callee:z}=B;if(_(["createSignal","useTransition"],z.name)){let H=j&&Zie(j,0,t);H?c.pushSignal(H,p().node):n(j??B,"first")}else if(_(["createMemo","createSelector"],z.name)){let H=j&&ese(j,t);H?c.pushSignal(H,p().node):i(j??B)}else if(_("createStore",z.name)){let H=j&&Zie(j,0,t);H?c.pushProps(H,p().node):n(j??B,"first")}else if(_("mergeProps",z.name)){let H=j&&ese(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,oe)=>Zie(j,oe,t)).filter(Boolean);H.length===0?n(j):H.forEach(G=>{c.pushProps(G,p().node)})}else{let H=j&&ese(j,t);H&&c.pushProps(H,p().node)}else if(_("createResource",z.name)){let H=j&&Zie(j,0,t);H&&c.pushProps(H,p().node)}else if(_("createMutable",z.name)){let H=j&&ese(j,t);H&&c.pushProps(H,p().node)}else if(_("mapArray",z.name)){let H=B.arguments[1];if(Oy(H)&&H.params.length>=2&&H.params[1].type==="Identifier"){let G=IF(t,H.params[1]);G&&c.pushSignal(G)}}else if(_("indexArray",z.name)){let H=B.arguments[1];if(Oy(H)&&H.params.length>=1&&H.params[0].type==="Identifier"){let G=IF(t,H.params[0]);G&&c.pushSignal(G)}}}},F=j=>{let B=(H,G)=>{p().trackedScopes.push({node:H,expect:G}),G!=="called-function"&&Oy(H)&&H.async&&t.report({node:H,messageId:"noAsyncTrackedScope"})},z=H=>{(0,qMr.traverse)(H,{enter(G){let oe=G,pe=bye(oe,t);(Oy(pe)||pe.type==="Identifier"&&pe.parent.type!=="MemberExpression"&&!(pe.parent.type==="CallExpression"&&pe.parent.callee===pe))&&(B(oe,"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"&&qN(j.parent.parent.name.name)||j.parent?.type==="JSXAttribute"&&j.parent.name.type==="JSXNamespacedName"&&j.parent.name.namespace.name==="use"&&Oy(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"&&!qN(j.parent.parent.name.name)||(j.parent?.type==="JSXAttribute"&&j.parent.name.name==="ref"&&Oy(j.expression)?B(j.expression,"called-function"):RV(j.parent)&&Oy(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:oe}}=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")),oe&&B(oe,"called-function");else if(_("createStore",H.name)&&G?.type==="ObjectExpression")for(let pe of G.properties)pe.type==="Property"&&pe.kind==="get"&&Oy(pe.value)&&B(pe.value,"function");else if(_("runWithOwner",H.name)){if(oe){let pe=!0,Ee=G.type==="Identifier"&&IF(t,G);if(Ee){let Se=Ee.defs[0];if(Se&&Se.node.type==="VariableDeclarator"&&Se.node.init?.type==="CallExpression"&&Se.node.init.callee.type==="Identifier"&&_("getOwner",Se.node.init.callee.name)){let we=r0t(Se.node,p8e),Be=c.findIndex(({node:Re})=>we===Re);(Be>=1&&!c[Be-1].trackedScopes.some(Re=>Re.expect==="function"&&Re.node===we)||Be===0)&&(pe=!1)}}pe&&B(oe,"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=ese(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 oe=G.identifier.parent.arguments[0];oe&&B(oe,"function")}}Oy(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"&&Oy(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(Oy(H)){B(H,"called-function");for(let G of H.params)if(G.type==="Identifier"&&gye(G.name)){let oe=IF(t,G);oe&&c.pushProps(oe,p().node)}}}};return{ImportDeclaration:g,JSXExpressionContainer(j){F(j)},JSXSpreadAttribute(j){F(j)},CallExpression(j){F(j),w(j);let B=j.parent&&u0t(j.parent,!0);B?.type!=="AssignmentExpression"&&B?.type!=="VariableDeclarator"&&k(null,j)},NewExpression(j){F(j)},VariableDeclarator(j){j.init&&(k(j.id,j.init),F(j))},AssignmentExpression(j){j.left.type!=="MemberExpression"&&k(j.left,j.right),F(j)},TaggedTemplateExpression(j){F(j)},"JSXElement > JSXExpressionContainer > :function"(j){if(Oy(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=IF(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=IF(t,j.params[0]);H&&c.pushSignal(H,p().node)}}}},FunctionExpression:T,ArrowFunctionExpression:T,FunctionDeclaration:T,Program:T,"FunctionExpression:exit":C,"ArrowFunctionExpression:exit":C,"FunctionDeclaration:exit":C,"Program:exit":C,JSXElement(){c.length&&(p().hasJSX=!0)},JSXFragment(){c.length&&(p().hasJSX=!0)}}}})}});function kUi(t){return t.name.type==="JSXIdentifier"&&!qN(t.name.name)||t.name.type==="JSXMemberExpression"}function NUi(t){return YMr.test(t)}function IUi(t){return t.parent.children.length===0}function OUi(t){let e=t.parent.children;return e.length===1&&e[0].type==="JSXText"&&e[0].value.indexOf(`
|
|
1137
|
-
`)!==-1&&e[0].value.replace(/(?!\xA0)\s/g,"")===""}var GFr,YMr,WMr,LUi=I0({"src/rules/self-closing-comp.ts"(){"use strict";ZS(),VN(),GFr=zMr.ESLintUtils.RuleCreator.withoutDocs,YMr=/^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,WMr=GFr({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(kUi(n))return(t.options[0]?.component??"all")==="all";if(n.name.type==="JSXIdentifier"&&qN(n.name.name))switch(t.options[0]?.html??"all"){case"all":return!0;case"void":return NUi(n.name.name);case"none":return!1}return!0}return{JSXOpeningElement(n){if(IUi(n)||OUi(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=PA(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}>`)}})}}}}})}}),HFr,XFr,QFr,ZFr,KMr,FUi=I0({"src/rules/style-prop.ts"(){"use strict";ZS(),VN(),HFr=b8e.ESLintUtils.RuleCreator.withoutDocs,{getPropertyName:XFr,getStaticValue:QFr}=b8e.ASTUtils,ZFr=/\b(?:width|height|margin|padding|border-width|font-size)\b/i,KMr=HFr({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($Mr.all),n=!!t.options[0]?.allowString,i=t.options[0]?.styleProps||["style"];return{JSXAttribute(a){if(i.indexOf(tse(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=aFr(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 _=XFr(f,yye(t,f));if(_&&!_.startsWith("--")&&!e.has(_)){let g=(0,JMr.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("--")&&ZFr.test(_)){let g=QFr(f.value)?.value;typeof g=="number"&&g!==0&&t.report({node:f.value,messageId:"numericStyleValue"})}});else return}}}})}}),eMr,HMr,MUi=I0({"src/rules/no-array-handlers.ts"(){"use strict";ZS(),eMr=GMr.ESLintUtils.RuleCreator.withoutDocs,HMr=eMr({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"||!qN(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"&&bye(e.value.expression,t).type==="ArrayExpression"&&t.report({node:e,messageId:"noArrayHandlers"})}}}})}}),RUi=aMr({"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"}}}}),tMr,rMr,nMr,iMr,XMr,jUi=I0({"src/plugin.ts"(){"use strict";_Ui(),dUi(),mUi(),hUi(),gUi(),yUi(),bUi(),TUi(),vUi(),SUi(),EUi(),xUi(),CUi(),AUi(),DUi(),wUi(),PUi(),LUi(),FUi(),MUi(),{name:tMr,version:rMr}=RUi(),nMr={name:tMr,version:rMr},iMr={"components-return-once":dMr,"event-handlers":mMr,imports:gMr,"jsx-no-duplicate-props":bMr,"jsx-no-undef":SMr,"jsx-no-script-url":TMr,"jsx-uses-vars":xMr,"no-destructure":CMr,"no-innerhtml":DMr,"no-proxy-apis":PMr,"no-react-deps":NMr,"no-react-specific-props":OMr,"no-unknown-namespaces":FMr,"prefer-classlist":RMr,"prefer-for":jMr,"prefer-show":UMr,reactivity:VMr,"self-closing-comp":WMr,"style-prop":KMr,"no-array-handlers":HMr},XMr={meta:nMr,rules:iMr}}}),QMr=aMr({"src/configs/recommended.ts"(t,e){jUi();var n={plugins:{solid:XMr},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 ZMr=QMr();function jV(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 e8r(t){return!t.includes("BATI.has")&&!t.includes("BATI_TEST")?null:t.replace(/^# /,"").trim()}function t8r(t,e){if(!e.test.range)return null;let n=t.text.slice(e.test.range[0],e.test.range[1]);return e8r(n)}function T8e(t){return e8r(t.value)}function r8r(t){return t.value.includes(" BATI ")?t.value.replace(/^#/,"").replace(/#$/,"").replace(/\s+BATI\s+/,"").trim().split(","):null}function n8r(t){return[t.range[0]+1,t.range[1]-1]}function i8r(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 BV(t,e,n,i){let a=t8r(e,n);if(a===null)return;let c=jV(a,i);t.report({node:n,message:"bati/if-statement",*fix(p){if(c)if(n.consequent.type==="BlockStatement"){let f=e.text.slice(...n8r(n.consequent));yield p.replaceTextRange(n.range,f)}else{let f=e.text.slice(...n.consequent.range),_=i8r(n,n.consequent,f);yield p.replaceTextRange(_.range,_.body)}else if(n.alternate)if(n.alternate.type==="BlockStatement"){let f=e.text.slice(...n8r(n.alternate));yield p.replaceTextRange(n.range,f)}else{let f=e.text.slice(...n.alternate.range),_=i8r(n,n.alternate,f);yield p.replaceTextRange(_.range,_.body)}else yield p.remove(n)}})}function s8r(t,e,n){let i=e.getAllComments();if(i.length>0&&i[0].range?.[0]===0){let a=i[0],c=r8r(a);if(c===null||c.length===0)return;let p=xie(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 DG(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=T8e(c);if(p===null)return;let f=jV(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 v8e(t,e,n,i){d0t(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 S8e(t,e,n,i){for(let a of n.params)d0t(t,e,a,i,()=>[n.params[0].range[0],n.params[n.params.length-1].range[1]],c=>c)}function E8e(t,e,n,i){d0t(t,e,n,i,()=>n.range,a=>a)}function d0t(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,C=e.text.slice(b.typeAnnotation.typeAnnotation.range[0],b.typeAnnotation.typeAnnotation.range[1]);if(E==="_"){y=C;continue}if(jV(E,i)){yield g.replaceTextRange(f,c(C,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 m0t(t){let e={rules:{ts:{meta:{fixable:"code"},create(i){let a=i.sourceCode;return{Program(c){s8r(i,a,c)},ImportDeclaration(c){yOe(i,c)},":expression"(c){DG(i,a,c,t)},":statement"(c){DG(i,a,c,t)},SpreadElement(c){DG(i,a,c,t)},ConditionalExpression(c){BV(i,a,c,t)},IfStatement(c){BV(i,a,c,t)},JSXAttribute(c){DG(i,a,c,t)},TSAsExpression(c){v8e(i,a,c,t)},TSTypeParameterInstantiation(c){S8e(i,a,c,t)},TSTypeReference(c){E8e(i,a,c,t)}}}}}},n=[{plugins:{batiTs:e},languageOptions:{parser:a8r,parserOptions:{warnOnUnsupportedTypeScriptVersion:!1}},rules:{"batiTs/ts":"error"},files:["**/*.ts","**/*.js","**/*.tsx","**/*.jsx"]}];return t.BATI.has("solid")&&n.push({files:["**/*.{ts,tsx}"],...ZMr,languageOptions:{parser:a8r}}),{plugin:e,config:n}}var vzi=F_(t8e(),1),Szi=F_(s5r(),1);function a5r(t,e){let n=e.getTokenBefore("startTag"in t?t.startTag:t,{includeComments:!0,filter:i=>i.type!=="HTMLWhitespace"});return n&&n.type==="HTMLComment"?[...a5r(n,e),n]:[]}function X0t(t){let e={rules:{vue:{meta:{fixable:"code"},create(i){let a=i.sourceCode,c=a.parserServices.getTemplateBodyTokenStore();return a.parserServices.defineTemplateBodyVisitor({ConditionalExpression(p){BV(i,a,p,t)},IfStatement(p){BV(i,a,p,t)},VElement(p){let f=a5r(p,c);if(f.length>0){let _=T8e(f[0]);if(_===null)return;let g=jV(_,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){yOe(i,p)},":statement"(p){DG(i,a,p,t)},ConditionalExpression(p){BV(i,a,p,t)},IfStatement(p){BV(i,a,p,t)},TSAsExpression(p){v8e(i,a,p,t)},TSTypeParameterInstantiation(p){S8e(i,a,p,t)},TSTypeReference(p){E8e(i,a,p,t)}})}}}};return{plugin:e,config:[{plugins:{batiVue:e},languageOptions:{parser:Szi,parserOptions:{parser:vzi,ecmaVersion:2022,sourceType:"module"}},rules:{"batiVue/vue":"error"},files:["**/*.vue"]}]}}var Azr=F_(Tzr(),1),Dzr=F_(Czr(),1);var Xss=(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},uSt={filter:t=>t.value===","},Qss={includeComments:!0},Zss=Xss(!0,(t,e)=>({fix(n){let i=t.parent;if(!i)return null;let a=xie(e);if(i.specifiers.length===1){let c=e.sourceCode.getTokenAfter(i,Qss),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],`
|
|
1137
|
+
`)!==-1&&e[0].value.replace(/(?!\xA0)\s/g,"")===""}var GFr,YMr,WMr,LUi=I0({"src/rules/self-closing-comp.ts"(){"use strict";ZS(),VN(),GFr=zMr.ESLintUtils.RuleCreator.withoutDocs,YMr=/^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,WMr=GFr({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(kUi(n))return(t.options[0]?.component??"all")==="all";if(n.name.type==="JSXIdentifier"&&qN(n.name.name))switch(t.options[0]?.html??"all"){case"all":return!0;case"void":return NUi(n.name.name);case"none":return!1}return!0}return{JSXOpeningElement(n){if(IUi(n)||OUi(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=PA(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}>`)}})}}}}})}}),HFr,XFr,QFr,ZFr,KMr,FUi=I0({"src/rules/style-prop.ts"(){"use strict";ZS(),VN(),HFr=b8e.ESLintUtils.RuleCreator.withoutDocs,{getPropertyName:XFr,getStaticValue:QFr}=b8e.ASTUtils,ZFr=/\b(?:width|height|margin|padding|border-width|font-size)\b/i,KMr=HFr({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($Mr.all),n=!!t.options[0]?.allowString,i=t.options[0]?.styleProps||["style"];return{JSXAttribute(a){if(i.indexOf(tse(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=aFr(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 _=XFr(f,yye(t,f));if(_&&!_.startsWith("--")&&!e.has(_)){let g=(0,JMr.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("--")&&ZFr.test(_)){let g=QFr(f.value)?.value;typeof g=="number"&&g!==0&&t.report({node:f.value,messageId:"numericStyleValue"})}});else return}}}})}}),eMr,HMr,MUi=I0({"src/rules/no-array-handlers.ts"(){"use strict";ZS(),eMr=GMr.ESLintUtils.RuleCreator.withoutDocs,HMr=eMr({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"||!qN(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"&&bye(e.value.expression,t).type==="ArrayExpression"&&t.report({node:e,messageId:"noArrayHandlers"})}}}})}}),RUi=aMr({"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"}}}}),tMr,rMr,nMr,iMr,XMr,jUi=I0({"src/plugin.ts"(){"use strict";_Ui(),dUi(),mUi(),hUi(),gUi(),yUi(),bUi(),TUi(),vUi(),SUi(),EUi(),xUi(),CUi(),AUi(),DUi(),wUi(),PUi(),LUi(),FUi(),MUi(),{name:tMr,version:rMr}=RUi(),nMr={name:tMr,version:rMr},iMr={"components-return-once":dMr,"event-handlers":mMr,imports:gMr,"jsx-no-duplicate-props":bMr,"jsx-no-undef":SMr,"jsx-no-script-url":TMr,"jsx-uses-vars":xMr,"no-destructure":CMr,"no-innerhtml":DMr,"no-proxy-apis":PMr,"no-react-deps":NMr,"no-react-specific-props":OMr,"no-unknown-namespaces":FMr,"prefer-classlist":RMr,"prefer-for":jMr,"prefer-show":UMr,reactivity:VMr,"self-closing-comp":WMr,"style-prop":KMr,"no-array-handlers":HMr},XMr={meta:nMr,rules:iMr}}}),QMr=aMr({"src/configs/recommended.ts"(t,e){jUi();var n={plugins:{solid:XMr},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 ZMr=QMr();function jV(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 e8r(t){return!t.includes("BATI.has")&&!t.includes("BATI_TEST")?null:t.replace(/^# /,"").trim()}function t8r(t,e){if(!e.test.range)return null;let n=t.text.slice(e.test.range[0],e.test.range[1]);return e8r(n)}function T8e(t){return e8r(t.value)}function r8r(t){return t.value.includes(" BATI ")?t.value.replace(/^#/,"").replace(/#$/,"").replace(/\s+BATI\s+/,"").trim().split(","):null}function n8r(t){return[t.range[0]+1,t.range[1]-1]}function i8r(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 BV(t,e,n,i){let a=t8r(e,n);if(a===null)return;let c=jV(a,i);t.report({node:n,message:"bati/if-statement",*fix(p){if(c)if(n.consequent.type==="BlockStatement"){let f=e.text.slice(...n8r(n.consequent));yield p.replaceTextRange(n.range,f)}else{let f=e.text.slice(...n.consequent.range),_=i8r(n,n.consequent,f);yield p.replaceTextRange(_.range,_.body)}else if(n.alternate)if(n.alternate.type==="BlockStatement"){let f=e.text.slice(...n8r(n.alternate));yield p.replaceTextRange(n.range,f)}else{let f=e.text.slice(...n.alternate.range),_=i8r(n,n.alternate,f);yield p.replaceTextRange(_.range,_.body)}else yield p.remove(n)}})}function s8r(t,e,n){let i=e.getAllComments();if(i.length>0&&i[0].range?.[0]===0){let a=i[0],c=r8r(a);if(c===null||c.length===0)return;let p=xie(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 DG(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=T8e(c);if(p===null)return;let f=jV(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 v8e(t,e,n,i){d0t(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 S8e(t,e,n,i){for(let a of n.params)d0t(t,e,a,i,()=>[n.params[0].range[0],n.params[n.params.length-1].range[1]],c=>c)}function E8e(t,e,n,i){d0t(t,e,n,i,()=>n.range,a=>a)}function d0t(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 new Error("Linter: Malformed BATI.If members type");let E="value"in b.key?b.key.value:b.key.name,C=e.text.slice(b.typeAnnotation.typeAnnotation.range[0],b.typeAnnotation.typeAnnotation.range[1]);if(E==="_"){y=C;continue}if(jV(E,i)){yield g.replaceTextRange(f,c(C,p)),T=!0;break}}T||(y?yield g.replaceTextRange(f,c(y,p)):n.parent?.parent?.type==="Identifier"?yield g.removeRange([f[0]-2,f[1]]):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 m0t(t){let e={rules:{ts:{meta:{fixable:"code"},create(i){let a=i.sourceCode;return{Program(c){s8r(i,a,c)},ImportDeclaration(c){yOe(i,c)},":expression"(c){DG(i,a,c,t)},":statement"(c){DG(i,a,c,t)},SpreadElement(c){DG(i,a,c,t)},ConditionalExpression(c){BV(i,a,c,t)},IfStatement(c){BV(i,a,c,t)},JSXAttribute(c){DG(i,a,c,t)},TSAsExpression(c){v8e(i,a,c,t)},TSTypeParameterInstantiation(c){S8e(i,a,c,t)},TSTypeReference(c){E8e(i,a,c,t)}}}}}},n=[{plugins:{batiTs:e},languageOptions:{parser:a8r,parserOptions:{warnOnUnsupportedTypeScriptVersion:!1}},rules:{"batiTs/ts":"error"},files:["**/*.ts","**/*.js","**/*.tsx","**/*.jsx"]}];return t.BATI.has("solid")&&n.push({files:["**/*.{ts,tsx}"],...ZMr,languageOptions:{parser:a8r}}),{plugin:e,config:n}}var vzi=F_(t8e(),1),Szi=F_(s5r(),1);function a5r(t,e){let n=e.getTokenBefore("startTag"in t?t.startTag:t,{includeComments:!0,filter:i=>i.type!=="HTMLWhitespace"});return n&&n.type==="HTMLComment"?[...a5r(n,e),n]:[]}function X0t(t){let e={rules:{vue:{meta:{fixable:"code"},create(i){let a=i.sourceCode,c=a.parserServices.getTemplateBodyTokenStore();return a.parserServices.defineTemplateBodyVisitor({ConditionalExpression(p){BV(i,a,p,t)},IfStatement(p){BV(i,a,p,t)},VElement(p){let f=a5r(p,c);if(f.length>0){let _=T8e(f[0]);if(_===null)return;let g=jV(_,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){yOe(i,p)},":statement"(p){DG(i,a,p,t)},ConditionalExpression(p){BV(i,a,p,t)},IfStatement(p){BV(i,a,p,t)},TSAsExpression(p){v8e(i,a,p,t)},TSTypeParameterInstantiation(p){S8e(i,a,p,t)},TSTypeReference(p){E8e(i,a,p,t)}})}}}};return{plugin:e,config:[{plugins:{batiVue:e},languageOptions:{parser:Szi,parserOptions:{parser:vzi,ecmaVersion:2022,sourceType:"module"}},rules:{"batiVue/vue":"error"},files:["**/*.vue"]}]}}var Azr=F_(Tzr(),1),Dzr=F_(Czr(),1);var Xss=(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},uSt={filter:t=>t.value===","},Qss={includeComments:!0},Zss=Xss(!0,(t,e)=>({fix(n){let i=t.parent;if(!i)return null;let a=xie(e);if(i.specifiers.length===1){let c=e.sourceCode.getTokenAfter(i,Qss),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],`
|
|
1138
1138
|
`.repeat(_))]}if(t!==i.specifiers[i.specifiers.length-1]){let c=e.sourceCode.getTokenAfter(t,uSt),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,uSt),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,uSt).range[0],t.range[1]])}}));function pSt(){let t=Azr.default.rules["no-unused-vars"];t.meta.fixable="code";let e={rules:{"unused-imports":Dzr.default.filterReports(t,Zss)}};return{plugin:e,config:[{plugins:{"unused-imports":e},rules:{"unused-imports/unused-imports":"error"}}]}}function wzr(t,e,n){return qwr(t,[...m0t(n).config,...X0t(n).config,...pSt().config],e)}var Pzr=new Function("return this")().Promise,hSt=!1;try{hSt=new Function("return (async function(){}).constructor")()}catch(t){if(!(t instanceof SyntaxError))throw t}function Izr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function W0e(t,e,n){for(var i in e)Izr(e,i)&&(e[i]!=null&&typeof e[i]=="object"&&(i==="storage"||i==="prefixes")&&!n?t[i]=W0e({},e[i]):t[i]=e[i]);return t}function eas(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 tas(t){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)}var vRe=(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){W0e(this.cache,e,!0)},t})();function ras(t,e){Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e}function eS(t){var e=new Error(t);return ras(e,eS.prototype),e}eS.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});function hz(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+`:
|
|
1139
1139
|
|
|
1140
1140
|
`+e.split(/\n/)[a-1]+`
|
|
@@ -1144,7 +1144,7 @@ ${j} return (`),yield _.insertTextAfter(z,`);
|
|
|
1144
1144
|
|
|
1145
1145
|
`+a.message+`
|
|
1146
1146
|
`+Array(a.message.length+1).join("=")+`
|
|
1147
|
-
`+Nzr(t,n)):a}}var ySt=Ta("fs"),_St=Ta("path"),pas=/^\uFEFF/;function dSt(t,e,n){var i=_St.resolve(n?e:_St.dirname(e),t),a=_St.extname(t);return a||(i+=".sqrl"),i}function fas(t,e){var n,i,a=e.views,c=/^[A-Za-z]+:\\|^\//.exec(t);if(c&&c.length)n=dSt(t.replace(/^\/*/,""),e.root||"/",!0);else if(e.filename&&(i=dSt(t,e.filename),ySt.existsSync(i)&&(n=i)),n||Array.isArray(a)&&a.some(function(p){return i=dSt(t,p,!0),ySt.existsSync(i)})&&(n=i),!n)throw eS('Could not find the include file "'+t+'"');return n}function Rzr(t){return ySt.readFileSync(t).toString().replace(pas,"")}function _as(t,e){var n=SRe(e),i=Rzr(t);try{var a=TSt(i,n);return n.storage.templates.define(n.filename,a),a}catch{throw eS("Loading file: "+t+" failed")}}function das(t){var e=t.filename;if(t.cache){var n=t.storage.templates.get(e);return n||_as(e,t)}return TSt(Rzr(e),t)}function jzr(t,e){var n=SRe({filename:fas(t,e)},e);return das(n)}function mas(t,e,n){if(e&&e.length>0)throw eS("Helper 'includeFile' doesn't accept blocks");return jzr(t.params[0],n)(t.params[1],n)}function has(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 jzr(t.params[0],n)(i,n)}function mSt(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=TSt(t,e),e.cache&&e.name&&e.storage.templates.define(e.name,n),n)}function Bzr(t,e,n,i){var a=SRe(n||{});if(a.async){var c;if(i)try{mSt(t,a)(e,a,i)}catch(p){return i(p)}else{if(typeof Pzr=="function")return new Pzr(function(p,f){try{c=mSt(t,a)(e,a),p(c)}catch(_){f(_)}});throw eS("Please provide a callback function, this env doesn't support Promises")}}else return mSt(t,a)(e,a)}bSt.define("includeFile",mas);bSt.define("extendsFile",has);var vSt=["/*{","}*/"];function Uzr(t,e){return Bzr(t,e,{tags:vSt})}function gas(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(vSt[0])}}var yas=/\/\/\s*eslint(?:-disable|-enable|-disable-next-line|-disable-line)?[^\n]*/gim,bas=/\/\/\s*biome-ignore[^\n]*/gim,Tas=/\/\*+\s*eslint(?:-disable|-enable|-disable-next-line|-disable-line)?[^\n*]*\*+\//gim,vas=/\/\*+\s*biome-ignore[^\n*]*\*+\//gim,qzr=new RegExp(`${yas.source}|${Tas.source}`,"gim"),Vzr=new RegExp(`${bas.source}|${vas.source}`,"gim");async function Sas(t,e,n){let{eslint:i,squirelly:a}=gas(t,n.filepath),c=t,p,f=!1;if(a&&(c=Uzr(c,e),f=!0),i){let _=wzr(c,n.filepath,e);c=_.code,p=_.context,f=!0}return!e.BATI.has("eslint")&&qzr.test(c)&&(c=c.replace(qzr,""),f=!0),!e.BATI.has("biome")&&Vzr.test(c)&&(c=c.replace(Vzr,""),f=!0),{code:f?await Unt(c,n):c,context:p}}import{randomBytes as OMs}from"crypto";var SSt={name:"@batijs/core",version:"0.0.
|
|
1147
|
+
`+Nzr(t,n)):a}}var ySt=Ta("fs"),_St=Ta("path"),pas=/^\uFEFF/;function dSt(t,e,n){var i=_St.resolve(n?e:_St.dirname(e),t),a=_St.extname(t);return a||(i+=".sqrl"),i}function fas(t,e){var n,i,a=e.views,c=/^[A-Za-z]+:\\|^\//.exec(t);if(c&&c.length)n=dSt(t.replace(/^\/*/,""),e.root||"/",!0);else if(e.filename&&(i=dSt(t,e.filename),ySt.existsSync(i)&&(n=i)),n||Array.isArray(a)&&a.some(function(p){return i=dSt(t,p,!0),ySt.existsSync(i)})&&(n=i),!n)throw eS('Could not find the include file "'+t+'"');return n}function Rzr(t){return ySt.readFileSync(t).toString().replace(pas,"")}function _as(t,e){var n=SRe(e),i=Rzr(t);try{var a=TSt(i,n);return n.storage.templates.define(n.filename,a),a}catch{throw eS("Loading file: "+t+" failed")}}function das(t){var e=t.filename;if(t.cache){var n=t.storage.templates.get(e);return n||_as(e,t)}return TSt(Rzr(e),t)}function jzr(t,e){var n=SRe({filename:fas(t,e)},e);return das(n)}function mas(t,e,n){if(e&&e.length>0)throw eS("Helper 'includeFile' doesn't accept blocks");return jzr(t.params[0],n)(t.params[1],n)}function has(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 jzr(t.params[0],n)(i,n)}function mSt(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=TSt(t,e),e.cache&&e.name&&e.storage.templates.define(e.name,n),n)}function Bzr(t,e,n,i){var a=SRe(n||{});if(a.async){var c;if(i)try{mSt(t,a)(e,a,i)}catch(p){return i(p)}else{if(typeof Pzr=="function")return new Pzr(function(p,f){try{c=mSt(t,a)(e,a),p(c)}catch(_){f(_)}});throw eS("Please provide a callback function, this env doesn't support Promises")}}else return mSt(t,a)(e,a)}bSt.define("includeFile",mas);bSt.define("extendsFile",has);var vSt=["/*{","}*/"];function Uzr(t,e){return Bzr(t,e,{tags:vSt})}function gas(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(vSt[0])}}var yas=/\/\/\s*eslint(?:-disable|-enable|-disable-next-line|-disable-line)?[^\n]*/gim,bas=/\/\/\s*biome-ignore[^\n]*/gim,Tas=/\/\*+\s*eslint(?:-disable|-enable|-disable-next-line|-disable-line)?[^\n*]*\*+\//gim,vas=/\/\*+\s*biome-ignore[^\n*]*\*+\//gim,qzr=new RegExp(`${yas.source}|${Tas.source}`,"gim"),Vzr=new RegExp(`${bas.source}|${vas.source}`,"gim");async function Sas(t,e,n){let{eslint:i,squirelly:a}=gas(t,n.filepath),c=t,p,f=!1;if(a&&(c=Uzr(c,e),f=!0),i){let _=wzr(c,n.filepath,e);c=_.code,p=_.context,f=!0}return!e.BATI.has("eslint")&&qzr.test(c)&&(c=c.replace(qzr,""),f=!0),!e.BATI.has("biome")&&Vzr.test(c)&&(c=c.replace(Vzr,""),f=!0),{code:f?await Unt(c,n):c,context:p}}import{randomBytes as OMs}from"crypto";var SSt={name:"@batijs/core",version:"0.0.530",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.25","@types/which":"^3.0.4","@typescript-eslint/parser":"^8.48.0","@typescript-eslint/utils":"^8.48.0","attributes-parser":"^2.2.3",colorette:"^2.0.20",esbuild:"^0.27.0",eslint:"^9.39.1","eslint-plugin-solid":"^0.14.5","eslint-rule-composer":"^0.3.0",espree:"^11.0.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.1",tsx:"^4.20.6",typescript:"^5.9.3","unplugin-purge-polyfills":"^0.1.0",vitest:"^4.0.13","vue-eslint-parser":"^10.2.0",which:"^6.0.0",yaml:"^2.8.1"},exports:{".":"./dist/index.js","./config":"./dist/config.js","./types":{types:"./global.d.ts"}},typesVersions:{"*":{config:["./dist/config.d.ts"],types:["./global.d.ts"]}},files:["dist/"]};function xas(){return process.env.npm_config_user_agent?Cas(process.env.npm_config_user_agent):{name:"npm",run:"npm run"}}function Cas(t){let e=t.split(" ")[0],n=e.lastIndexOf("/"),i=e.substring(0,n);return i=i==="npminstall"?"cnpm":i,{name:i,version:e.substring(n+1),run:i==="npm"?"npm run":i}}function RMs(){switch(xas().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 jMs(){let t=SSt.version.split("."),e=t[0],n=t[1],i=t.slice(2).join(".");return{version:SSt.version,semver:[e,n,i]}}function UMs(t,e,n,i){t??="",t.endsWith(`
|
|
1148
1148
|
|
|
1149
1149
|
`)||(t.endsWith(`
|
|
1150
1150
|
`)?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.530",
|
|
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": "^6.0.0",
|
|
40
40
|
"yaml": "^2.8.1",
|
|
41
|
-
"@batijs/features": "0.0.
|
|
41
|
+
"@batijs/features": "0.0.530"
|
|
42
42
|
},
|
|
43
43
|
"exports": {
|
|
44
44
|
".": "./dist/index.js",
|