language-tools: š BUG: astro check reports incorrect errors on HTMLAttributes
Describe the Bug
While this worked as expected in Astro 4.0.4, astro check now reports entirely valid JSX attributes as invalid HTMLAttributes.
Iāve created a tiny reproduction here: https://stackblitz.com/edit/github-ckecs3?file=package.json.
Running npm run check will show that both onClick and className are invalid, even though both are in fact valid JSX props.
Steps to Reproduce
- Run
npm create astro@latest -- --template framework-preact - Add
"check": "astro check:"to thescriptssection - Run
npm run check - The valid
onClickattributes are considered errors. Now, changing one of theclassattributes toclassName(which is valid) will also show that as an error.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 20
- Comments: 17 (8 by maintainers)
Just released a hotfix (
0.3.4) that disable checking JSX and TSX files in the meantime. Sorry again for the inconvenience, Iām still working on it and will hopefully find a solution š«”You might need to override the language-server version manually, unfortunately. Hoping to have a fix out today, sorry for the delay.
I have the same problem with React component.
Okay, this is proving to be much harder than anticipated due to bugs in TypeScript itself. Itāll take more time to figure out, so in the meantime Iāll revert the
astro checkfix to what it did before (where it skipped over .js(x) files).Sorry for the inconvenience, TypeScript really wasnāt made to have multiple JSX typings in the same project.
Unfortunately, downgrading to
0.3.2didnāt fix it for meIāll take a look once Iām back to work next week (if someone doesnāt before me). Apologies for the inconvenience.
In the meantime, pinning
@astrojs/checkto0.3.2would at least make it not fail (but would go back to the behavior where it didnāt check certain files)Iām seeing the same error with my solidjs components.
Hmm, seems like itās not taking into account the
tsconfig.jsoncorrectly, for some reason. To be clear, this also didnāt work in the past, itās just that I recently fixed a bug where it ignored errors completely inside certain files.Make sure to update to the latest version of
@astrojs/checkfor a temporary workaround!Indeed, though this worked for me in the past (prior to noticing this issue just the other day):
tsconfig.json:src/components/preact/tsconfig.json:src/components/react/tsconfig.json:src/components/solid/tsconfig.json:astro.config.mjs: