-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add @vue/eslint-plugin-typescript when adding @vue/cli-plugin-typescript to an existing project (that uses eslint) #970
Comments
The reproduction link isn't working and your instructions about reproducing it with a frsh project are lacking as you don't mention which answers to choose. I would guess you didn't choose to use vue-class-component. |
Sorry @LinusBorg for the missing information. I used this steps while creating the projects:
If I change the second answer (class-style component syntax) to No, the hello world project is working (the @component annotations are obviously missing). The repository was set to private. It is now public and you should be able to access it. |
I see, these seem to be eslint errors. Since you initially created the project with defaults, https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-plugin-eslint/generator.js#L38-L43 SolutionWe should probably enable the opposite way:
Immediate Fix
Add that preset to your eslint config in
|
Thank you @LinusBorg I tried you immediate fix and getting the following errors: error: 'Component' is defined but never used (no-unused-vars) at src\App.vue:9:10:
error: 'HelloWorld' is defined but never used (no-unused-vars) at src\App.vue:10:8:
2 errors found. error: 'Component' is defined but never used (no-unused-vars) at src\components\HelloWorld.vue:32:10:
error: 'msg' is not defined (no-undef) at src\components\HelloWorld.vue:36:19:
2 errors found. If I understand you correctly, there's a way to create a project with initial TypeScript support? So I do not need to install the plugin afterwards? |
Yes. Just don't do a default install, choose the options manually. Then you can choose typescript. |
About these errors - can you try with the typescript eslint preset at the end of the preset array: "eslintConfig": {
"root": true,
"extends": [
"plugin:vue/essential",
"eslint:recommended",
"@vue/typescript"
]
}, This seems necessary so the typescript eslint preset can deactivate that rule: https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/eslint-config-typescript/index.js#L9 |
@LinusBorg Many thanks! I solved my problem choosing the options by myself. But I tried your suggestion as well: Changing the order of the extends is also working! So, the problem is solvable in both ways. |
Thanks for the feedback! |
Version
3.0.0-beta.6
Reproduction link
https://github.com/fdeitelhoff/brickobotik.codes
Steps to reproduce
What is expected?
The freshly created project should compile.
What is actually happening?
Two error messages:
WARNING Compiled with 2 warnings
error: Parsing error: Unexpected character '@' at src\App.vue:
10 | import HelloWorld from './components/HelloWorld.vue';
11 |
1 error found.
error: Parsing error: Unexpected character '@' at src\components\HelloWorld.vue:
32 | import { Component, Prop, Vue } from 'vue-property-decorator';
33 |
1 error found.
The text was updated successfully, but these errors were encountered: