You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying out a few things with Qwik, and I didn't bother to use TypeScript, so my routes are just .jsx source files. Because of this, Vite is printing warnings about routeLoader$ not being located in the correct place, even though it's located in src/routes/index.jsx which seems like it should be allowed.
[vite] warning: 'routeLoader$() are typically declared in route boundary files such as layout.tsx, index.tsx and plugin.tsx inside the src/routes directory
(docs: https://qwik.dev/docs/route-loader/).
This routeLoader$() is declared outside of the route boundaries. This may be useful when you want to create reusable logic or a library. In such a case, it is essential that this function is re-exported from within the router boundary otherwise it will not run.
(docs: https://qwik.dev/docs/cookbook/re-exporting-loaders/).
If you understand this, you can disable this warning with:
// eslint-disable-next-line qwik/loader-location
Plugin: vite-plugin-qwik
File: C:/Users/loris/Desktop/qwik-bug/src/routes/index.jsx:4:30
2 | import { routeLoader$ } from "@builder.io/qwik-city"
3 |
4 | export const useLoremIpsum = routeLoader$(async () => {
| ^
5 | const response = await fetch("https://loripsum.net/api")
6 | return await response.text()
The text was updated successfully, but these errors were encountered:
loriswit
changed the title
[🐞] ESLint: invalidLoaderLocation should not triggered if filename extension is JSX
[🐞] ESLint: invalidLoaderLocation should not be triggered if filename extension is JSX
May 23, 2024
Which component is affected?
Qwik Rollup / Vite plugin
Describe the bug
I've been trying out a few things with Qwik, and I didn't bother to use TypeScript, so my routes are just
.jsx
source files. Because of this, Vite is printing warnings aboutrouteLoader$
not being located in the correct place, even though it's located insrc/routes/index.jsx
which seems like it should be allowed.I suppose this happens because of these regexes:
qwik/packages/eslint-plugin-qwik/src/loaderLocation.ts
Lines 59 to 61 in cae4e5b
Is there any reason why
.jsx
files would be considered invalid locations? If not, this should be an easy fix.Reproduction
https://github.com/loriswit/eslint-plugin-qwik-bug
Steps to reproduce
Clone the repo, then run
npm install
andnpm start
(ornpm run preview
).System Info
Additional Information
Full console output:
The text was updated successfully, but these errors were encountered: