原文:https://www.cnblogs.com/ljangle/p/11364788.html
1、報錯:ESLint: Unexpected string concatenation. (prefer-template)
原因ES6規則:表現符號錯誤,應該為Tab鍵上方的· ,修改如下:
2、報錯:ESLint: Expected property shorthand. (object-shorthand)
原因為:eslint:需要屬性速記。(對象速記),變量名重名,修改變量名,問題解決
3、報錯:ESLint: 'data' is never reassigned. Use 'const' instead. (prefer-const)
原因:data變量值未發生修改,應將修飾符改為const,第一個報錯消失
4、報錯:ESLint: Use object destructuring. (prefer-destructuring):eslint:使用對象銷毀。(寧願破壞)
原因:初步認為適合當前對象的key值重復了,修改以后,問題修復
5、報錯:ESLint: Strings must use singlequote. (quotes)
原因:在沒有參數傳遞在請求路徑時,選擇' 英文單引號來修飾路徑
eslint虐我千百遍,我帶eslint如初戀; fighting
6、報錯:ESLint: Line 4 exceeds the maximum line length of 100. (max-len):eslint:第4行超過了最大行長度100。(最大長度)
從中間換行即可
7、報錯:ESLint: Expected 1 empty line after import statement not followed by another import. (import/newline-after-import):eslint:import語句后應為1空行,后面不跟另一個import。(導入/導入后換行)
原因:依據說明,換行即可
8、報錯:ESLint: 'getEnterpriseInfo' is defined but never used. (no-unused-vars):eslint:“getEnterpriseInfo”已定義,但從未使用。(無未使用的變量)
原因:在js中使用該方法即可。
9、報錯:ESLint: Missing space before value for key 'domain'. (key-spacing):eslint:鍵“domain”的值前缺少空格。(鍵間距)
隔開即可:
10、報錯:ESLint: Missing trailing comma. (comma-dangle):eslint:缺少尾隨逗號。(逗號懸空)
原因: 缺少,
11、報錯:ESLint: Use object destructuring. (prefer-destructuring) : eslint:使用對象銷毀。(寧願破壞)
原因:轉換一下
12、報錯:Expected parentheses around arrow function argument having a body with curly braces
原因:帶花括號body的箭頭函數參數周圍,需要一個括號,參考官網:http://eslint.cn/docs/4.0.0/rules/arrow-parens