codesandbox / codesandbox/codesandbox-client
Editor does not understand typescript vue3 single file components
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13.6k
- Forks
- 2.4k
- Avg merge
- 6d 19h
- Merged PRs (30d)
- 2
Description
🐛 bug report
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project
adheres to. - I have searched the issue tracker for an issue that matches the one I want
to file, without success.
Description of the problem
CodeSandbox seems to think Vue single file components are JSX.
Open components/App.vue of my example and eslint complains about the template tag: adjacent elements must be wrapped in an enclosing tag
This is valid vue: https://vuejs.org/guide/scaling-up/sfc.html
How has this issue affected you? What are you trying to accomplish?
It's impossible to use CodeSandbox to demonstrate Vue typescript issues.
To Reproduce
There is no default Vue+typescript setup according to the recommended guide so we make your own:
Create a Node HTTP sandbox
cd ..
npm init vue@latest // leave everything standard except set typescript and eslint to yes
mv vue-project/* sandbox/
mv vue-project/eslintrc.cjs sandbox/
Restart it and add the following sandbox.config.json:
{
"infiniteLoopProtection": true,
"hardReloadOnChange": false,
"view": "browser",
"container": {
"node": "12",
"port": 3000,
"startScript": "custom"
}
}
Now open App.vue or HelloWorld.vue and admire the errors
Link to sandbox: https://codesandbox.io/s/vite-vue-3-0r2hgb
Your Environment
| Software | Name/Version |
|---|---|
| Сodesandbox | latest? |
| Browser | Chrome |
| Operating System | Windows 10 |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report using the linked sandbox, then open components/App.vue and HelloWorld.vue and inspect the reported template errors. Check how the editor identifies these files and compare the behavior with the Vue single-file component guidance linked in the issue. Done means valid Vue TypeScript templates are no longer treated as JSX and the reported ESLint errors are gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100