vue eslint语法限制

 WARNING  Compiled with 1 warnings                                                                              19:02:33


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

  ✘  http://eslint.org/docs/rules/space-unary-ops              Unexpected space before unary operator '++'
  src\components\HelloWorld.vue:19:7
        this.num ++;
         ^

  ✘  http://eslint.org/docs/rules/semi                         Extra semicolon
  src\components\HelloWorld.vue:19:18
        this.num ++;
                    ^

  ✘  http://eslint.org/docs/rules/space-before-function-paren  Missing space before function parentheses
  src\components\HelloWorld.vue:23:20
      'num': function(val, oldVal) {
                      ^

  ✘  http://eslint.org/docs/rules/indent                       Expected indentation of 6 spaces but found 8
  src\components\HelloWorld.vue:24:1
          alert("val:" + val + "  oldVal:" + oldVal)
   ^

  ✘  http://eslint.org/docs/rules/quotes                       Strings must use singlequote
  src\components\HelloWorld.vue:24:15
          alert("val:" + val + "  oldVal:" + oldVal)
                 ^

  ✘  http://eslint.org/docs/rules/quotes                       Strings must use singlequote
  src\components\HelloWorld.vue:24:30
          alert("val:" + val + "  oldVal:" + oldVal)
                                ^

  ✘  http://eslint.org/docs/rules/comma-dangle                 Unexpected trailing comma
  src\components\HelloWorld.vue:26:4
    },
      ^


✘ 8 problems (8 errors, 0 warnings)


Errors:
  2  http://eslint.org/docs/rules/quotes
  2  http://eslint.org/docs/rules/space-before-function-paren
  1  http://eslint.org/docs/rules/comma-dangle
  1  http://eslint.org/docs/rules/indent
  1  http://eslint.org/docs/rules/semi
  1  http://eslint.org/docs/rules/space-unary-ops

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.

 WAIT  Compiling...                                                                                             19:02:44

 95% emitting

 WARNING  Compiled with 1 warnings                                                                              19:02:45


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

  ✘  http://eslint.org/docs/rules/space-unary-ops              Unexpected space before unary operator '++'
  src\components\HelloWorld.vue:19:7
        this.num ++;
         ^

  ✘  http://eslint.org/docs/rules/semi                         Extra semicolon
  src\components\HelloWorld.vue:19:18
        this.num ++;
                    ^

  ✘  http://eslint.org/docs/rules/space-before-function-paren  Missing space before function parentheses
  src\components\HelloWorld.vue:23:20
      'num': function(val, oldVal) {
                      ^

  ✘  http://eslint.org/docs/rules/indent                       Expected indentation of 6 spaces but found 8
  src\components\HelloWorld.vue:24:1
          alert("val:" + val + "  oldVal:" + oldVal)
   ^

  ✘  http://eslint.org/docs/rules/quotes                       Strings must use singlequote
  src\components\HelloWorld.vue:24:15
          alert("val:" + val + "  oldVal:" + oldVal)
                 ^

  ✘  http://eslint.org/docs/rules/quotes                       Strings must use singlequote
  src\components\HelloWorld.vue:24:30
          alert("val:" + val + "  oldVal:" + oldVal)
                                ^

  ✘  http://eslint.org/docs/rules/comma-dangle                 Unexpected trailing comma
  src\components\HelloWorld.vue:26:4
    },
      ^


✘ 8 problems (8 errors, 0 warnings)


Errors:
  2  http://eslint.org/docs/rules/quotes
  2  http://eslint.org/docs/rules/space-before-function-paren
  1  http://eslint.org/docs/rules/comma-dangle
  1  http://eslint.org/docs/rules/indent
  1  http://eslint.org/docs/rules/semi
  1  http://eslint.org/docs/rules/space-unary-ops

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.

因为eslint语法限制过于严格,可以在config中的 index.js 设置 useEslint为 false

在此记录下

Logo

前往低代码交流专区

更多推荐