noUnusedLocals reporting warnings for properties used in <template>
See original GitHub issueInfo
- Platform: macOS
- Vetur version: 0.19.2
- VS Code version: 1.33.1 (1.33.1)
Problem
With noUnusedLocals
on, Vetur is report “declared but never read” errors for properties used in the <template>
in single file components. See how msg
is used in line 3 in the screenshot below:
Reproducible Case
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
tslint how to disable error "someVariable is declared but its ...
Use _myVariable instead of myvariable to remove this warning. ... First, turn off noUnusedLocals in tsconfig.json:
Read more >Documentation - tsc CLI Options - TypeScript
Flag Type Default
‑‑allowJs boolean false
‑‑allowUmdGlobalAccess boolean false
‑‑allowUnreachableCode boolean
Read more >How to get the most out of Angular configuration - Medium
noUnusedLocals. This flag allows a TypeScript to report an error if a declared variable is not used: // Error: 'OnInit' is declared but...
Read more >CodeBuild provisioning template bundle - AWS Proton
With CodeBuild provisioning, instead of using IaC templates to render IaC files and run them using an IaC provisioning engine, AWS Proton simply...
Read more >CodeMix problems view - Genuitec
In ts editor, there are also sometimes stale warnings like The 'use-output-property-decorator' rule threw an error in 'xx/app.module.ts': ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Let’s keep it open since template part should ideally be considered the same file as the SFC. Now we have a temporary workaround https://github.com/vuejs/vetur/pull/1243 but that’s not a good long-term solution.
Ah I didn’t realise it was the
private
keyword that was causing the issue. Just FYI the screenshot above (and the example repo) is what is generated by the Vue CLI (if you chose the TypeScript settings), which is why I didn’t think to change theprivate
keyword.I’ll mark this as closed, but I wonder if there’s a good place to document this as I imagine it’ll affect anyone creating a new app with Vue CLI running Vetur. To add to that, the reason I turned on
noUnusedLocals
was following the advice in #1063 so this might come up more as people move to a TS version that supports the flag.Thanks all for your help.