Postcss与Eslint常见控制台警告

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Postcss与Eslint常见控制台警告相关的知识,希望对你有一定的参考价值。

参考技术A 解决方案:去除 display: box

解决方案:

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

return、throw后面的语句:

赋值了但没有引用

没有引用的import

注册了组件,但没有用到

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)

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

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

实例: 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>

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

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

case 前需要设置 break

以上是关于Postcss与Eslint常见控制台警告的主要内容,如果未能解决你的问题,请参考以下文章

如何通过 ESLint 控制开发人员对组件的属性输入?

带有 syntastic 和 eslint 的 vim:显示警告

解决PostCSS配置报警告问题

Xcode 在控制台输出中关闭与自动布局相关的警告

无法使用 eslint cli 启用无控制台

js-组成-dom-常见单词