eslint-plugin-qwik 1.5.5 → 1.5.7

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.
Files changed (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -160,7 +160,7 @@ This {{fnName}}() is declared outside of the route boundaries. This may be usefu
160
160
 
161
161
  If you understand this, you can disable this warning with:
162
162
  // eslint-disable-next-line qwik/loader-location
163
- `,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(r){var l,m;let e=((m=(l=r.options)==null?void 0:l[0])==null?void 0:m.routesDir)??"src/routes",t=vv(r.getFilename()),n=/\/layout(|!|-.+)\.tsx?$/.test(t),o=/\/index(|!|@.+)\.tsx?$/.test(t),i=/\/plugin(|@.+)\.tsx?$/.test(t),u=new RegExp(`/${e}/`).test(t)&&(o||n||i);return{CallExpression(y){if(y.callee.type!=="Identifier")return;let d=y.callee.name;if(!gv[d])return;if(!u&&fl[d]){r.report({node:y.callee,messageId:"invalidLoaderLocation",data:{routesDir:e,fnName:d,path:t}});return}let p=y.parent;if(p.type!=="VariableDeclarator"){r.report({node:y.callee,messageId:"missingExport",data:{fnName:d,id:"useStuff"}});return}if(p.id.type!=="Identifier"){r.report({node:y.callee,messageId:"missingExport",data:{fnName:d,id:"useStuff"}});return}if(!/^use/.test(p.id.name)){let g="use"+p.id.name[0].toUpperCase()+p.id.name.slice(1);r.report({node:p.id,messageId:"wrongName",data:{fnName:d,id:p.id.name,fixed:g}});return}if(!hv(p)){r.report({node:p.id,messageId:"missingExport",data:{fnName:d,id:p.id.name}});return}if(y.arguments.length>0&&y.arguments[0].type==="Identifier"){r.report({node:y.arguments[0],messageId:"recommendedValue",data:{fnName:d,id:p.id.name,arg:y.arguments[0].name}});return}}}}};function vv(r){let e=/^\\\\\?\\/.test(r),t=/[^\u0000-\u0080]+/.test(r);return e||t||(r=r.replace(/\\/g,"/"),r.endsWith("/")&&(r=r.slice(0,r.length-1))),r}var Cx=`
163
+ `,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(r){var l,m;let e=((m=(l=r.options)==null?void 0:l[0])==null?void 0:m.routesDir)??"src/routes",t=vv(r.getFilename()),n=/\/layout(|!|-.+)\.(j|t)sx?$/.test(t),o=/\/index(|!|@.+)\.(j|t)sx?$/.test(t),i=/\/plugin(|@.+)\.(j|t)sx?$/.test(t),u=new RegExp(`/${e}/`).test(t)&&(o||n||i);return{CallExpression(y){if(y.callee.type!=="Identifier")return;let d=y.callee.name;if(!gv[d])return;if(!u&&fl[d]){r.report({node:y.callee,messageId:"invalidLoaderLocation",data:{routesDir:e,fnName:d,path:t}});return}let p=y.parent;if(p.type!=="VariableDeclarator"){r.report({node:y.callee,messageId:"missingExport",data:{fnName:d,id:"useStuff"}});return}if(p.id.type!=="Identifier"){r.report({node:y.callee,messageId:"missingExport",data:{fnName:d,id:"useStuff"}});return}if(!/^use/.test(p.id.name)){let g="use"+p.id.name[0].toUpperCase()+p.id.name.slice(1);r.report({node:p.id,messageId:"wrongName",data:{fnName:d,id:p.id.name,fixed:g}});return}if(!hv(p)){r.report({node:p.id,messageId:"missingExport",data:{fnName:d,id:p.id.name}});return}if(y.arguments.length>0&&y.arguments[0].type==="Identifier"){r.report({node:y.arguments[0],messageId:"recommendedValue",data:{fnName:d,id:p.id.name,arg:y.arguments[0].name}});return}}}}};function vv(r){let e=/^\\\\\?\\/.test(r),t=/[^\u0000-\u0080]+/.test(r);return e||t||(r=r.replace(/\\/g,"/"),r.endsWith("/")&&(r=r.slice(0,r.length-1))),r}var Cx=`
164
164
  import { routeLoader$ } from '@builder.io/qwik-city';
165
165
 
166
166
  export const useProductDetails = routeLoader$(async (requestEvent) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-qwik",
3
3
  "description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.",
4
- "version": "1.5.5",
4
+ "version": "1.5.7",
5
5
  "author": "Builder Team",
6
6
  "bugs": "https://github.com/QwikDev/qwik/issues",
7
7
  "dependencies": {