elicwhite / ESLint-Formatter

Sublime Text 3 Plugin to Autoformat with Eslint
MIT License
139 stars 20 forks source link

Vue SFC doesn't format missing commas #70

Closed geoidesic closed 4 years ago

geoidesic commented 5 years ago

Here's the SFC:

s<template>
  <q-page class="">
    <h1>Dev Comms</h1>
    <h2>Registration</h2>
    <q-btn @click="check()" rounded glossy color="purple" label="Check"></q-btn>
    <q-btn @click="add()" rounded glossy color="purple" label="Add"></q-btn>
    <q-btn @click="del()" rounded glossy color="purple" label="Delete"></q-btn>
  </q-page>
</template>
<style></style>
<script>
export default {
  name: "PageIndex",
  methods: {
    check() {
      alert("check");
    },
    check() {
      alert("add");

    }
    del() {
      alert("delete")
    },
  }
};
</script>

If I set debug: true then it shows that there's a syntax error with the missing comma:

  33:4  error  Parsing error: Unexpected token, expected ","

  14 |       
  15 |     }
> 16 |     del() {
     |     ^
  17 |       alert("delete")
  18 |     },
  19 |   }

... but it doesn't fix it

Formatting works if I add the missing comma, then it will clean up the extra spaces etc.

skeggse commented 4 years ago

This sounds like an eslint error - please report such errors to the eslint project directly!