Skip to content
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

Wrong: Missing semicolon (semicolon) warning #15

Open
DerAlbertCom opened this issue Apr 30, 2018 · 11 comments
Open

Wrong: Missing semicolon (semicolon) warning #15

DerAlbertCom opened this issue Apr 30, 2018 · 11 comments

Comments

@DerAlbertCom
Copy link

When a .vue template is missing the <script type=ts></script> the ts-line-vue has false positive warnings

grafik

expected behavior is no warnings in that case, like here

grafik

@DerAlbertCom DerAlbertCom changed the title Wrong: Missing semicolon (semicolon) message Wrong: Missing semicolon (semicolon) warning Apr 30, 2018
@jgalentine007
Copy link

jgalentine007 commented Jun 28, 2018

I noticed the same thing when I just spun up a template project with vue-cli 3.0. Which I guess is just a requirement (as listed on the quickstart.)

@ffxsam
Copy link

ffxsam commented Jul 25, 2018

I'm experiencing this too, and it's driving me mad. I think I need to remove the extension.

@justindeng0405
Copy link

I noticed the same thing too. If I disable the extension, I can't find another one to lint Vue SFC.

@ffxsam
Copy link

ffxsam commented Jul 25, 2018

Fixed it.

Turns out I had some bad code. Make sure that:

  1. all your SFCs are <script lang="ts">. I had mixed script blocks, some just plain JS. This was causing issues. And BTW, this is not a bug with this extension, but rather VS Code's parser, it seems.
  2. you don't have any type errors anywhere else. Sometimes it seems like there's a domino effect and it wreaks havoc in the project.

@Nfinished
Copy link

Nfinished commented Jul 25, 2018

Happens even in an SFC without script tags.

ex

@ffxsam
Copy link

ffxsam commented Jul 25, 2018

@Nfinished Right. There's nothing wrong with this file, obviously, but it's other files affecting this one. (see my post above yours)

@Nfinished
Copy link

𝓬𝓻𝓲𝓹𝓮𝓼

@ffxsam
Copy link

ffxsam commented Jul 25, 2018

I know, tell me about it. I spent hours trying to figure out what was wrong. I still don't understand why having some components use JS and some use TS is a problem. But it was causing issues in VS Code, as Prettier wouldn't work either.

@ffxsam
Copy link

ffxsam commented Jul 29, 2018

I will say this, though: it's not possible to have a .vue file without a <script> block. I have to add <script lang="ts"></script> just to shut up the "missing semicolon" bug.

@prograhammer Is this something you could address?

@ffxsam
Copy link

ffxsam commented Jul 29, 2018

Woops. Actually, all this code was needed:

<script lang="ts">
import Vue from 'vue';
export default Vue.extend();
</script>

Otherwise, main.ts was yelling at me because it didn't like App.vue being imported.

@romansp
Copy link

romansp commented Nov 1, 2018

I use this extension together with eslint-plugin-vue and eslint to get template linting in .vue files. I have vue/html-self-closing enabled.

It works fine most of the time, but as soon as you have a component with self-closing <textarea /> or <iframe /> (maybe some other tags) it will start reporting [tslint] Missing semicolon (semicolon). Auto-fixing further will break syntax.

Before:

<template>
  <textarea />
</template>

<script lang="ts">
import Vue from "vue";
export default Vue.extend({});
</script>

After:

<template>
  <te"vue"a />
</template>

<;script lang="ts">
import Vue from "vue";
export default Vue.extend({});
</script>

After it becomes very annoying I temporarily disable auto-fixing, or execute VSCode's save without formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants