美文网首页
Postcss与Eslint常见控制台警告

Postcss与Eslint常见控制台警告

作者: 南场41号 | 来源:发表于2020-04-05 08:32 被阅读0次

    Postcss warning:

    1、You should write display: flex by final spec instead of display: box

    解决方案:去除display: box

    2、Second Autoprefixer control comment was ignored. Autoprefixer applies control comment to whole block, not to next rules.

    解决方案:

    /* autoprefixer: off*/····/* autoprefixer: on*/换成 /*! autoprefixer: ignore next */

    Eslint error

    1、error: Unreachable code (no-unreachable)

    return、throw后面的语句:

    2、'xxx' is assigned a value but never used (no-unused-vars)

    赋值了但没有引用

    3、'xxx' is defined but never used (no-unused-vars)

    没有引用的import

    4、The "xxx" component has been registered but not used (vue/no-unused-components)

    注册了组件,但没有用到

    5、Duplicate key 'xxx' (no-dupe-keys)

    data重复声明

    6、Identifier 'xx_x' is not in camel case (camelcase)

    js里变量没有使用驼峰

    7、'xxx' is not defined (no-undef)

    引用了未定义的变量等

    8、Irregular whitespace not allowed (no-irregular-whitespace)

    空格问题

    9、Mixed spaces and tabs (no-mixed-spaces-and-tabs)

    tab与空格混用

    10、Unnecessary escape character (no-useless-escape) :\h :/

    多余的转义字符

    11、 Expected the Promise rejection reason to be an Error (prefer-promise-reject-errors) :reject()

    promise的reject需要指定error

    12、Expected to return a value in "xxx" computed property (vue/return-in-computed-property)

    计算属性存在没有返回的场景

    13、Type of the default value for 'xxx' prop must be a function (vue/require-valid-default-prop)

    props对象的默认值必须使用工厂方法声明

    14、'xxx' was used before it was defined (no-use-before-define)

    实例: let v = (v = this.memberId ? '^' + 'Y' : '^' + 'N')

    15、Expected error to be handled (handle-callback-err)

    异常没有处理

    16、Parsing error: control-character-in-input-stream (vue/no-parsing-error)

    单行注释//位置不对

    17、Expected an assignment or function call and instead saw an expression (no-unused-expressions)

    期望一个赋值或函数调用,却看到一个表达式

    18、 Closing curly brace does not appear on the same line as the subsequent block (brace-style)

    右大括号与下一个块不在同一行

    19、 Unexpected literal in error position of callback (standard/no-callback-literal)

    callback(true/false/1)在ES6里是不被允许的,https://github.com/standard/standard/issues/623

    20、 'xxx' is already defined (no-redeclare)

    var 变量引起的

    21、 Unexpected trailing comma (comma-dangle)

    多了一个逗号

    22、 Parsing error: x-invalid-end-tag (vue/no-parsing-error)

    自闭合标签用了end标签,例:</img>

    23、 Elements in iteration expect to have 'v-bind:key' directives (vue/require-v-for-key)

    使用v-for时,没有设置key

    24、Expected a 'break' statement before 'case' (no-fallthrough)

    case前需要设置break

    相关文章

      网友评论

          本文标题:Postcss与Eslint常见控制台警告

          本文链接:https://www.haomeiwen.com/subject/rteyphtx.html