eslint-plugin-qwik
Advanced tools
Comparing version 0.19.2 to 0.20.0
14
index.js
@@ -1,2 +0,2 @@ | ||
"use strict";var B=Object.create;var I=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var Q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),X=(e,t)=>{for(var n in t)I(e,n,{get:t[n],enumerable:!0})},L=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of J(t))!W.call(e,i)&&i!==n&&I(e,i,{get:()=>t[i],enumerable:!(r=j(t,i))||r.enumerable});return e};var R=(e,t,n)=>(n=e!=null?B(V(e)):{},L(t||!e||!e.__esModule?I(n,"default",{value:e,enumerable:!0}):n,e)),Z=e=>L(I({},"__esModule",{value:!0}),e);var D=Q((ce,O)=>{"use strict";O.exports=e=>{let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((n,r)=>Math.min(n,r.length),1/0):0}});var ae={};X(ae,{configs:()=>se,rules:()=>ie});module.exports=Z(ae);var v=require("@typescript-eslint/utils"),w=R(require("typescript"));var q=R(D(),1);function N(e){let t=(0,q.default)(e);if(t===0)return e;let n=new RegExp(`^[ \\t]{${t}}`,"gm");return e.replace(n,"")}function A(e,t=1,n={}){let{indent:r=" ",includeEmptyLines:i=!1}=n;if(typeof e!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if(typeof t!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(t<0)throw new RangeError(`Expected \`count\` to be at least 0, got \`${t}\``);if(typeof r!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(t===0)return e;let l=i?/^/gm:/^(?!\s*$)/gm;return e.replace(l,r.repeat(t))}function $(e,t=0,n={}){return A(N(e),t,n)}var G=v.ESLintUtils.RuleCreator(()=>"https://qwik.builder.io/docs/advanced/dollar/"),P=G({name:"valid-lexical-scope",defaultOptions:[{allowAny:!0}],meta:{type:"problem",docs:{description:"Used the tsc typechecker to detect the capture of unserializable data in dollar ($) scopes.",recommended:"error"},schema:[{type:"object",properties:{allowAny:{type:"boolean"}},default:{allowAny:!0}}],messages:{referencesOutside:`Seems like you are referencing "{{varName}}" inside a different scope ({{dollarName}}), when this happens, Qwik needs to serialize the value, however {{reason}}. | ||
"use strict";var j=Object.create;var I=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var X=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),H=(e,t)=>{for(var n in t)I(e,n,{get:t[n],enumerable:!0})},R=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of V(t))!Q.call(e,i)&&i!==n&&I(e,i,{get:()=>t[i],enumerable:!(r=J(t,i))||r.enumerable});return e};var L=(e,t,n)=>(n=e!=null?j(W(e)):{},R(t||!e||!e.__esModule?I(n,"default",{value:e,enumerable:!0}):n,e)),Z=e=>R(I({},"__esModule",{value:!0}),e);var D=X((de,O)=>{"use strict";O.exports=e=>{let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((n,r)=>Math.min(n,r.length),1/0):0}});var ce={};H(ce,{configs:()=>le,rules:()=>ae});module.exports=Z(ce);var v=require("@typescript-eslint/utils"),w=L(require("typescript"));var q=L(D(),1);function C(e){let t=(0,q.default)(e);if(t===0)return e;let n=new RegExp(`^[ \\t]{${t}}`,"gm");return e.replace(n,"")}function $(e,t=1,n={}){let{indent:r=" ",includeEmptyLines:i=!1}=n;if(typeof e!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if(typeof t!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(t<0)throw new RangeError(`Expected \`count\` to be at least 0, got \`${t}\``);if(typeof r!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(t===0)return e;let l=i?/^/gm:/^(?!\s*$)/gm;return e.replace(l,r.repeat(t))}function A(e,t=0,n={}){return $(C(e),t,n)}var G=v.ESLintUtils.RuleCreator(()=>"https://qwik.builder.io/docs/advanced/dollar/"),F=G({name:"valid-lexical-scope",defaultOptions:[{allowAny:!0}],meta:{type:"problem",docs:{description:"Used the tsc typechecker to detect the capture of unserializable data in dollar ($) scopes.",recommended:"error"},schema:[{type:"object",properties:{allowAny:{type:"boolean"}},default:{allowAny:!0}}],messages:{referencesOutside:`Seems like you are referencing "{{varName}}" inside a different scope ({{dollarName}}), when this happens, Qwik needs to serialize the value, however {{reason}}. | ||
Check out https://qwik.builder.io/docs/advanced/dollar/ for more details.`,invalidJsxDollar:`Seems like you are using "{{varName}}" as an event handler, however functions are not serializable. | ||
@@ -7,11 +7,11 @@ Did you mean to wrap it in \`$()\`? | ||
Check out https://qwik.builder.io/docs/advanced/dollar/ for more details.`,mutableIdentifier:`Seems like you are mutating the value of ("{{varName}}"), but this is not possible when captured by the ({{dollarName}}) closure, instead create an object and mutate one of its properties. | ||
Check out https://qwik.builder.io/docs/advanced/dollar/ for more details.`}},create(e){var C;let n={allowAny:((C=e.options[0])==null?void 0:C.allowAny)??!0},r=e.getSourceCode().scopeManager,i=v.ESLintUtils.getParserServices(e),l=i.esTreeNodeToTSNodeMap,o=i.program.getTypeChecker(),s=new Map,c=[];function h(m){m.references.forEach(a=>{var u,g;let y=a.resolved,d=(u=a.resolved)==null?void 0:u.scope;if(y&&d){let b=(g=y.defs.at(0))==null?void 0:g.type;if(b==="Type"||b==="ImportBinding")return;let p=a.from,f;for(;p&&(f=s.get(p),!f);)p=p.upper;if(p&&f){let T=d.type;if(T==="global"||T==="module")return;let S=a.identifier,M=l.get(S),x=d;for(;x&&!s.has(x);)x=x.upper;if(x!==p){S.parent&&S.parent.type==="AssignmentExpression"&&S.parent.left===S&&e.report({messageId:"mutableIdentifier",node:a.identifier,data:{varName:a.identifier.name,dollarName:f}});let k=H(e,o,M,a.identifier,n);k&&e.report({messageId:"referencesOutside",node:a.identifier,data:{varName:a.identifier.name,dollarName:f,reason:K(k)}})}}}}),m.childScopes.forEach(h)}return{CallExpression(m){if(m.callee.type==="Identifier"&&m.callee.name.endsWith("$")){let a=m.arguments.at(0);if(a&&a.type==="ArrowFunctionExpression"){let y=r.acquire(a);y&&s.set(y,m.callee.name)}}},JSXAttribute(m){let a=m.name,y=a.type==="JSXIdentifier"?a.name:a.name.name;if(y.endsWith("$")){let d=m.value;if(d&&d.type==="JSXExpressionContainer"){let u=r.acquire(d.expression);if(u)s.set(u,y);else if(d.expression.type==="Identifier"){let g=l.get(d.expression),b=o.getTypeAtLocation(g);if(!F(b)){if(b.symbol.name==="PropFnInterface")return;e.report({messageId:"invalidJsxDollar",node:d.expression,data:{varName:d.expression.name,solution:`const ${d.expression.name} = $( | ||
${_(b.symbol,e.getSourceCode().text)} | ||
Check out https://qwik.builder.io/docs/advanced/dollar/ for more details.`}},create(e){var N;let n={allowAny:((N=e.options[0])==null?void 0:N.allowAny)??!0},r=e.getSourceCode().scopeManager,i=v.ESLintUtils.getParserServices(e),l=i.esTreeNodeToTSNodeMap,o=i.program.getTypeChecker(),s=new Map,c=[];function h(m){m.references.forEach(a=>{var p,g;let y=a.resolved,u=(p=a.resolved)==null?void 0:p.scope;if(y&&u){let b=(g=y.defs.at(0))==null?void 0:g.type;if(b==="Type"||b==="ImportBinding")return;let d=a.from,f;for(;d&&(f=s.get(d),!f);)d=d.upper;if(d&&f){let T=u.type;if(T==="global"||T==="module")return;let S=a.identifier,B=l.get(S),x=u;for(;x&&!s.has(x);)x=x.upper;if(x!==d){S.parent&&S.parent.type==="AssignmentExpression"&&S.parent.left===S&&e.report({messageId:"mutableIdentifier",node:a.identifier,data:{varName:a.identifier.name,dollarName:f}});let k=K(e,o,B,a.identifier,n);k&&e.report({messageId:"referencesOutside",node:a.identifier,data:{varName:a.identifier.name,dollarName:f,reason:Y(k)}})}}}}),m.childScopes.forEach(h)}return{CallExpression(m){if(m.callee.type==="Identifier"&&m.callee.name.endsWith("$")){let a=m.arguments.at(0);if(a&&a.type==="ArrowFunctionExpression"){let y=r.acquire(a);y&&s.set(y,m.callee.name)}}},JSXAttribute(m){let a=m.name,y=a.type==="JSXIdentifier"?a.name:a.name.name;if(y.endsWith("$")){let u=m.value;if(u&&u.type==="JSXExpressionContainer"){let p=r.acquire(u.expression);if(p)s.set(p,y);else if(u.expression.type==="Identifier"){let g=l.get(u.expression),b=o.getTypeAtLocation(g);if(!_(b)){if(b.symbol.name==="PropFnInterface")return;e.report({messageId:"invalidJsxDollar",node:u.expression,data:{varName:u.expression.name,solution:`const ${u.expression.name} = $( | ||
${P(b.symbol,e.getSourceCode().text)} | ||
); | ||
`}})}}}}},Program(m){let a=l.get(m),y=o.getSymbolAtLocation(a);y&&(c=o.getExportsOfModule(y))},"Program:exit"(){h(r.globalScope)}}}});function H(e,t,n,r,i){let l=t.getTypeAtLocation(n);return Y(e,t,l,n,r,i,new Set)}function K(e){let t="";return e.location?t+=`"${e.location}" `:t+="it ",t+=`${e.reason}`,t}function Y(e,t,n,r,i,l,o){let s=E(e,t,n,r,l,0,o);if(s){let c=s.location;return c&&(s.location=`${i.name}.${c}`),s}return s}function E(e,t,n,r,i,l,o){if(o.has(n)||(o.add(n),n.getProperty("__no_serialize__")))return;if(n.flags&w.default.TypeFlags.Unknown)return{type:n,typeStr:t.typeToString(n),reason:"is unknown, which could be serializable or not, please make the type for specific"};let c=n.flags&w.default.TypeFlags.Any;if(!i.allowAny&&c)return{type:n,typeStr:t.typeToString(n),reason:"is any, which is not serializable"};if(n.flags&w.default.TypeFlags.BigIntLike)return{type:n,typeStr:t.typeToString(n),reason:"is BigInt and it is not supported yet, use a number instead"};if(n.flags&w.default.TypeFlags.ESSymbolLike)return{type:n,typeStr:t.typeToString(n),reason:"is Symbol, which is not serializable"};if(n.flags&w.default.TypeFlags.EnumLike)return{type:n,typeStr:t.typeToString(n),reason:"is an enum, use an string or a number instead"};if(F(n))return;if(n.getCallSignatures().length>0){if(n.symbol.name==="PropFnInterface")return;let u="is a function, which is not serializable";if(l===0&&w.default.isIdentifier(r)){let g=`const ${r.text} = $( | ||
${_(n.symbol,e.getSourceCode().text)} | ||
);`;u+=`. | ||
`}})}}}}},Program(m){let a=l.get(m),y=o.getSymbolAtLocation(a);y&&(c=o.getExportsOfModule(y))},"Program:exit"(){h(r.globalScope)}}}});function K(e,t,n,r,i){let l=t.getTypeAtLocation(n);return ee(e,t,l,n,r,i,new Set)}function Y(e){let t="";return e.location?t+=`"${e.location}" `:t+="it ",t+=`${e.reason}`,t}function ee(e,t,n,r,i,l,o){let s=E(e,t,n,r,l,0,o);if(s){let c=s.location;return c&&(s.location=`${i.name}.${c}`),s}return s}function E(e,t,n,r,i,l,o){if(o.has(n)||(o.add(n),n.getProperty("__no_serialize__")))return;if(n.flags&w.default.TypeFlags.Unknown)return{type:n,typeStr:t.typeToString(n),reason:"is unknown, which could be serializable or not, please make the type for specific"};let c=n.flags&w.default.TypeFlags.Any;if(!i.allowAny&&c)return{type:n,typeStr:t.typeToString(n),reason:"is any, which is not serializable"};if(n.flags&w.default.TypeFlags.BigIntLike)return{type:n,typeStr:t.typeToString(n),reason:"is BigInt and it is not supported yet, use a number instead"};if(n.flags&w.default.TypeFlags.ESSymbolLike)return{type:n,typeStr:t.typeToString(n),reason:"is Symbol, which is not serializable"};if(n.flags&w.default.TypeFlags.EnumLike)return{type:n,typeStr:t.typeToString(n),reason:"is an enum, use an string or a number instead"};if(_(n))return;if(n.getCallSignatures().length>0){if(n.symbol.name==="PropFnInterface")return;let p="is a function, which is not serializable";if(l===0&&w.default.isIdentifier(r)){let g=`const ${r.text} = $( | ||
${P(n.symbol,e.getSourceCode().text)} | ||
);`;p+=`. | ||
Did you mean to wrap it in \`$()\`? | ||
${g} | ||
`}return{type:n,typeStr:t.typeToString(n),reason:u}}if(n.isUnion()){for(let d of n.types){let u=E(e,t,d,r,i,l+1,o);if(u)return u}return}if((n.flags&w.default.TypeFlags.Object)!==0){let d=te(n,t);if(d)return E(e,t,d,r,i,l+1,o);let u=ne(n,t);if(u){for(let p of u){let f=E(e,t,p,r,i,l+1,o);if(f)return f}return}let g=n.symbol.name;if(n.getProperty("nextElementSibling")||n.getProperty("activeElement")||re[g])return;if(n.isClass())return{type:n,typeStr:t.typeToString(n),reason:`is an instance of the "${n.symbol.name}" class, which is not serializable. Use a simple object literal instead`};let b=n.getProperty("prototype");if(b){let p=t.getTypeOfSymbolAtLocation(b,r);if(p.isClass())return{type:p,typeStr:t.typeToString(p),reason:"is a class constructor, which is not serializable"}}if(!g.startsWith("__")&&n.symbol.valueDeclaration)return{type:n,typeStr:t.typeToString(n),reason:`is an instance of the "${n.symbol.name}" class, which is not serializable`};for(let p of n.getProperties()){let f=ee(e,t,p,r,i,l+1,o);if(f){let T=f.location;return f.location=`${p.name}${T?`.${T}`:""}`,f}}}}function ee(e,t,n,r,i,l,o){let s=t.getTypeOfSymbolAtLocation(n,r);return E(e,t,s,r,i,l,o)}function te(e,t){return t.getElementTypeOfArrayType(e)}function ne(e,t){return t.isTupleType(e)?t.getTypeArguments(e):void 0}function F(e){return!!(e.flags&w.default.TypeFlags.Any)||!!e.getProperty("__brand__QRL__")}function _(e,t){if(e.declarations&&e.declarations.length>0){let n=e.declarations[0],r=t.slice(n.pos,n.end).replace(/^\s*$/gm,"");return $(r,2)}return""}var re={Promise:!0,URL:!0,RegExp:!0,Date:!0,FormData:!0,URLSearchParams:!0,Error:!0};var z={meta:{type:"problem",docs:{description:"Object destructuring is not recommended for component$",category:"Variables",recommended:!0,url:"https://github.com/BuilderIO/qwik"}},create(e){let t=[];return{ArrowFunctionExpression(){t.push({await:!1})},"ArrowFunctionExpression:exit"(){t.pop()},AwaitExpression(){let n=t[t.length-1];n&&(n.await=!0)},"CallExpression[callee.name=/^use[A-Z]/]"(n){let r=t[t.length-1];r&&r.await&&e.report({node:n,message:"Calling use* methods after await is not safe."})}}}};var U={meta:{type:"problem",docs:{description:"Detect declaration location of loader$",recommended:!0,url:"https://github.com/BuilderIO/qwik"},messages:{invalidLoaderLocation:'`{{fnName}}()` can only be declared in `layout.tsx`, `index.tsx` and `plugin.tsx` inside the `src/routes` directory, instead it was declared in "{{path}}".\nPlease check the docs: https://qwik.builder.io/qwikcity/loader',missingExport:"The return of `{{fnName}}()` needs to be exported in the same module, like this\n```\nexport const {{id}} = {{fnName}}(() => { ... });\n```",wrongName:"The named export of `{{fnName}}()` needs to follow the `use*` naming convention. It must start with `use`, like this:\n```\nexport const {{fixed}} = {{fnName}}(() => { ... });\n```\nInstead it was named:\n```\nexport const {{id}} = ...\n```",recommendedValue:"For `{{fnName}}()` it is recommended to inline the arrow function. Instead of:\n```\nexport const {{id}} = {{fnName}}({{arg}});\n```\nDo this:\n```\nexport const {{id}} = {{fnName}}(() => { ...logic here... });\n```\nThis will help the optimizer make sure that no server code is leaked to the client build."}},create(e){let t=oe(e.getFilename()),n=/\/layout(|!|-.+)\.tsx?$/.test(t),r=/\/index(|!|@.+)\.tsx?$/.test(t),l=/\/src\/routes\//.test(t)&&(r||n);return{CallExpression(o){if(o.callee.type!=="Identifier")return;let s=o.callee.name;if(s!=="loader$"&&s!=="action$")return;if(!l&&s==="loader$"){e.report({node:o.callee,messageId:"invalidLoaderLocation",data:{fnName:s,path:t}});return}let c=o.parent;if(c.type!=="VariableDeclarator"){e.report({node:o.callee,messageId:"missingExport",data:{fnName:s,id:"useStuff"}});return}if(c.id.type!=="Identifier"){e.report({node:o.callee,messageId:"missingExport",data:{fnName:s,id:"useStuff"}});return}if(!/^use/.test(c.id.name)){let h="use"+c.id.name[0].toUpperCase()+c.id.name.slice(1);e.report({node:c.id,messageId:"wrongName",data:{fnName:s,id:c.id.name,fixed:h}});return}if(c.parent.parent.type!=="ExportNamedDeclaration"){e.report({node:c.id,messageId:"missingExport",data:{fnName:s,id:c.id.name}});return}if(o.arguments.length>0&&o.arguments[0].type==="Identifier"){e.report({node:o.arguments[0],messageId:"recommendedValue",data:{fnName:s,id:c.id.name,arg:o.arguments[0].name}});return}}}}};function oe(e){let t=/^\\\\\?\\/.test(e),n=/[^\u0000-\u0080]+/.test(e);return t||n||(e=e.replace(/\\/g,"/"),e.endsWith("/")&&(e=e.slice(0,e.length-1))),e}var ie={"no-use-after-await":z,"valid-lexical-scope":P,"loader-location":U},se={recommended:{plugins:["qwik"],rules:{"qwik/no-use-after-await":"error","qwik/valid-lexical-scope":"error","qwik/loader-location":"warn"}},strict:{plugins:["qwik"],rules:{"qwik/valid-lexical-scope":"error","qwik/no-use-after-await":"error","qwik/loader-location":"error"}}};0&&(module.exports={configs,rules}); | ||
`}return{type:n,typeStr:t.typeToString(n),reason:p}}if(n.isUnion()){for(let u of n.types){let p=E(e,t,u,r,i,l+1,o);if(p)return p}return}if((n.flags&w.default.TypeFlags.Object)!==0){let u=ne(n,t);if(u)return E(e,t,u,r,i,l+1,o);let p=re(n,t);if(p){for(let d of p){let f=E(e,t,d,r,i,l+1,o);if(f)return f}return}let g=n.symbol.name;if(n.getProperty("nextElementSibling")||n.getProperty("activeElement")||oe[g])return;if(n.isClass())return{type:n,typeStr:t.typeToString(n),reason:`is an instance of the "${n.symbol.name}" class, which is not serializable. Use a simple object literal instead`};let b=n.getProperty("prototype");if(b){let d=t.getTypeOfSymbolAtLocation(b,r);if(d.isClass())return{type:d,typeStr:t.typeToString(d),reason:"is a class constructor, which is not serializable"}}if(!g.startsWith("__")&&n.symbol.valueDeclaration)return{type:n,typeStr:t.typeToString(n),reason:`is an instance of the "${n.symbol.name}" class, which is not serializable`};for(let d of n.getProperties()){let f=te(e,t,d,r,i,l+1,o);if(f){let T=f.location;return f.location=`${d.name}${T?`.${T}`:""}`,f}}}}function te(e,t,n,r,i,l,o){let s=t.getTypeOfSymbolAtLocation(n,r);return E(e,t,s,r,i,l,o)}function ne(e,t){return t.getElementTypeOfArrayType(e)}function re(e,t){return t.isTupleType(e)?t.getTypeArguments(e):void 0}function _(e){return!!(e.flags&w.default.TypeFlags.Any)||!!e.getProperty("__brand__QRL__")}function P(e,t){if(e.declarations&&e.declarations.length>0){let n=e.declarations[0],r=t.slice(n.pos,n.end).replace(/^\s*$/gm,"");return A(r,2)}return""}var oe={Promise:!0,URL:!0,RegExp:!0,Date:!0,FormData:!0,URLSearchParams:!0,Error:!0};var z={meta:{type:"problem",docs:{description:"Object destructuring is not recommended for component$",category:"Variables",recommended:!0,url:"https://github.com/BuilderIO/qwik"}},create(e){let t=[];return{ArrowFunctionExpression(){t.push({await:!1})},"ArrowFunctionExpression:exit"(){t.pop()},AwaitExpression(){let n=t[t.length-1];n&&(n.await=!0)},"CallExpression[callee.name=/^use[A-Z]/]"(n){let r=t[t.length-1];r&&r.await&&e.report({node:n,message:"Calling use* methods after await is not safe."})}}}};var U={loader$:!0,routeLoader$:!0,routeAction$:!0,routeHandler$:!0},ie={...U,action$:!0,globalAction$:!0},M={meta:{type:"problem",docs:{description:"Detect declaration location of loader$",recommended:!0,url:"https://github.com/BuilderIO/qwik"},messages:{invalidLoaderLocation:'`{{fnName}}()` can only be declared in `layout.tsx`, `index.tsx` and `plugin.tsx` inside the `src/routes` directory, instead it was declared in "{{path}}".\nPlease check the docs: https://qwik.builder.io/qwikcity/loader',missingExport:"The return of `{{fnName}}()` needs to be exported in the same module, like this\n```\nexport const {{id}} = {{fnName}}(() => { ... });\n```",wrongName:"The named export of `{{fnName}}()` needs to follow the `use*` naming convention. It must start with `use`, like this:\n```\nexport const {{fixed}} = {{fnName}}(() => { ... });\n```\nInstead it was named:\n```\nexport const {{id}} = ...\n```",recommendedValue:"For `{{fnName}}()` it is recommended to inline the arrow function. Instead of:\n```\nexport const {{id}} = {{fnName}}({{arg}});\n```\nDo this:\n```\nexport const {{id}} = {{fnName}}(() => { ...logic here... });\n```\nThis will help the optimizer make sure that no server code is leaked to the client build."}},create(e){let t=se(e.getFilename()),n=/\/layout(|!|-.+)\.tsx?$/.test(t),r=/\/index(|!|@.+)\.tsx?$/.test(t),l=/\/src\/routes\//.test(t)&&(r||n);return{CallExpression(o){if(o.callee.type!=="Identifier")return;let s=o.callee.name;if(!ie[s])return;if(!l&&U[s]){e.report({node:o.callee,messageId:"invalidLoaderLocation",data:{fnName:s,path:t}});return}let c=o.parent;if(c.type!=="VariableDeclarator"){e.report({node:o.callee,messageId:"missingExport",data:{fnName:s,id:"useStuff"}});return}if(c.id.type!=="Identifier"){e.report({node:o.callee,messageId:"missingExport",data:{fnName:s,id:"useStuff"}});return}if(!/^use/.test(c.id.name)){let h="use"+c.id.name[0].toUpperCase()+c.id.name.slice(1);e.report({node:c.id,messageId:"wrongName",data:{fnName:s,id:c.id.name,fixed:h}});return}if(c.parent.parent.type!=="ExportNamedDeclaration"){e.report({node:c.id,messageId:"missingExport",data:{fnName:s,id:c.id.name}});return}if(o.arguments.length>0&&o.arguments[0].type==="Identifier"){e.report({node:o.arguments[0],messageId:"recommendedValue",data:{fnName:s,id:c.id.name,arg:o.arguments[0].name}});return}}}}};function se(e){let t=/^\\\\\?\\/.test(e),n=/[^\u0000-\u0080]+/.test(e);return t||n||(e=e.replace(/\\/g,"/"),e.endsWith("/")&&(e=e.slice(0,e.length-1))),e}var ae={"no-use-after-await":z,"valid-lexical-scope":F,"loader-location":M},le={recommended:{plugins:["qwik"],rules:{"qwik/no-use-after-await":"error","qwik/valid-lexical-scope":"error","qwik/loader-location":"warn"}},strict:{plugins:["qwik"],rules:{"qwik/valid-lexical-scope":"error","qwik/no-use-after-await":"error","qwik/loader-location":"error"}}};0&&(module.exports={configs,rules}); |
{ | ||
"name": "eslint-plugin-qwik", | ||
"version": "0.19.2", | ||
"version": "0.20.0", | ||
"description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11925