LoginSignup
6
5

More than 1 year has passed since last update.

vue vscode eslint 勝手に補完

Last updated at Posted at 2019-02-03

解決策(settings.jsonに追記してください!)

.vscode/settings.json
{
"vetur.format.defaultFormatter.js": "vscode-typescript",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
}

実際の流れ

vue-cliで作成したプロジェクトをVSCodeで編集するときの設定

無限ループ発生

  • vueファイルを上書き保存
  • 行末に;が保管される
  • その;をeslintがエラーです。と怒る
  • その;を自分で消す

これを繰り返していました。
とりあえずこれに気付くのに、30分くらいかかった

直し方

結果的には、
.vscode/settings.jsonを編集したら治りました。

{

}
の中に、下記のように追加してください。
たぶん、人によっては既になにかしら書かれているかと思いますが、追記してください。上書いたら、何かしらの設定が消えると思いますので、追記でお願いします。
それでも治らなかったら、
https://github.com/vuejs/vetur/issues/476
https://qiita.com/skta/items/dbab3f669372f8623cd4
を参照してください。

追記してね。
{
"vetur.format.defaultFormatter.js": "vscode-typescript",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
}

以下、実際のエラー内容です

エラー内容全文
 WAIT  Compiling...                                                            17:12:09
 95% emitting

 WARNING  Compiled with 1 warnings                                             17:12:10

  ✘  http://eslint.org/docs/rules/quotes                       Strings must use singlequote
  src\components\HelloWorld.vue:11:19
  import axios from "axios";
                     ^

  ✘  http://eslint.org/docs/rules/semi                         Extra semicolon

  src\components\HelloWorld.vue:11:26
  import axios from "axios";
                            ^

  ✘  http://eslint.org/docs/rules/quotes                       Strings must use singlequote
  src\components\HelloWorld.vue:13:9
    name: "helloWorld",
           ^

  ✘  http://eslint.org/docs/rules/space-before-function-paren  Missing space before function parentheses
  src\components\HelloWorld.vue:14:7
    data() {
         ^

  ✘  http://eslint.org/docs/rules/quotes                       Strings must use singlequote
  src\components\HelloWorld.vue:16:12
        msg: "Welcome to Your Vue.js App"
              ^

  ✘  http://eslint.org/docs/rules/semi                         Extra semicolon

  src\components\HelloWorld.vue:17:6
      };
        ^

  ✘  http://eslint.org/docs/rules/space-before-function-paren  Missing space before function parentheses
  src\components\HelloWorld.vue:20:30
      apiPublic: async function() {
                                ^

  ✘  http://eslint.org/docs/rules/quotes                       Strings must use singlequote
  src\components\HelloWorld.vue:21:33
        let res = await axios.get("http://localhost:8080/public");
                                   ^

  ✘  http://eslint.org/docs/rules/semi                         Extra semicolon

  src\components\HelloWorld.vue:21:64
        let res = await axios.get("http://localhost:8080/public");
                                                                  ^

  ✘  http://eslint.org/docs/rules/semi                         Extra semicolon

  src\components\HelloWorld.vue:22:26
        this.msg = res.data;
                            ^

  ✘  http://eslint.org/docs/rules/space-before-function-paren  Missing space before function parentheses
  src\components\HelloWorld.vue:24:31
      apiPrivate: async function() {
                                 ^

  ✘  http://eslint.org/docs/rules/quotes                       Strings must use singlequote
  src\components\HelloWorld.vue:25:33
        let res = await axios.get("http://localhost:8080/private");
                                   ^

  ✘  http://eslint.org/docs/rules/semi                         Extra semicolon

  src\components\HelloWorld.vue:25:65
        let res = await axios.get("http://localhost:8080/private");
                                                                   ^

  ✘  http://eslint.org/docs/rules/semi                         Extra semicolon

  src\components\HelloWorld.vue:26:26
        this.msg = res.data;
                            ^

  ✘  http://eslint.org/docs/rules/semi                         Extra semicolon

  src\components\HelloWorld.vue:29:2
  };
    ^


✘ 15 problems (15 errors, 0 warnings)


Errors:
  7  http://eslint.org/docs/rules/semi
  5  http://eslint.org/docs/rules/quotes
  3  http://eslint.org/docs/rules/space-before-function-paren

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

Vue.js + Go言語 + Firebaseでなんか作れるっていうのをやりたかっただけなんだ!
https://qiita.com/po3rin/items/d3e016d01162e9d9de80

6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5