Eslint坑(搭架子时,规范代码,代码严谨,选择了Eslint规范)
| 序号 | 报错 | 解释 | 备注 |
|---|---|---|---|
| 1. | Extra semicolon | 能不用分号就不用分号 | – |
| 2. | expected indentation of 2 spaces but found 4 indent | 首行缩进2个字符 | Vs Code 设置–>tabsize 2 |
| 3. | New line required at end of file but not found eol-last | </script>下一行要有空行 | </script>之后有且只有一个空白行 |
| 4. | error unexpected trailing comma comma-dangle | 每个对象最后一个不要加逗号 | – |
| 5. | – | – | Eslint代码注释 **//**后必须要有空格,不是不能注释 |
| 6. | Unexpected trailing comma comma -dangle | 去掉末尾逗号 | unexpected trailing comma和 comma-dangle是同一个意思,同下 |
| 7. | Trailing spaces not allowed no-trailing-spaces | 无尾随空间 | – |
| 8. | Expected ‘===’ and insted saw ‘==’ | 为代码严谨,做判断时,使用 ‘===’,而不是 ’==‘ | – |
| 9. | Extra space before … | 在…之前有额外的空间 | — |
| 10. | camel case | 驼峰风格 | |
| 11. | Unnecessary use of boolean literals in conditional expression | 在条件表达式中不必要使用布尔文字 | (no-unneeded-ternary) |
| 12. | Expected literal to be on the right side of == | 期望文字位于右侧 | 序号11,12一起出现 eg: |
| 13. | Do not use empty rulesets | 不要使用空规则集 | eg: style中,只写了类名,但是在{ }花括号内没有具体样式 |
| 14 | WARNING IN:Srcpages est.wpy [xmlclom warning] unclosed xml attribute. | – | <image src=’…/images/1.png’ /> 反斜杠一定要写 |
| 15. | Duplicate key ‘timetable’ | 重复创建了timetable字段 | 多次定义 |
| 16. | 暂时这些。。。。 |