天天看點

jshint 報錯處理方式

1、pected an assignment or function call and instead saw an expression
    問題:表達式缺少指派,或者函數缺少調用,例如:三元運算符需要指派給變量

  Let variable = Object.keys(data).includes('DB') 
      self.controller.set("reportDB",'DB'):self.controller.set("reportDB", '');

    解決:1.可以直接指派

  2.也可以用jshint配置項,expr:true, 在目前元件中頂部使用
    /*jshint expr: true */  釋:不顯示指派或者函數調用的地方使用了表達式的警号

2、line 230, col 19, Missing semicolon
     問題:缺少分号;
     解決:根據行數,列數添加分号

3、Expected '===' and instead saw '=='
     問題:應為===,而不是==
     解決:根據行将==,換為===;

4、'get' is not defined
    問題:get未定義
    解決:在上面定義const = {get} = Ember
5、'import' is only available in ES6 (use 'esversion: 6')
    解決:在import 最上面添加 /*jshint esversion: 6 */

6、一些沒有使用的變量等,直接删除,這裡不一一贅述了。

分享一個常用的jshint的配置項清單
https://blog.csdn.net/ycq521131/article/details/80976718
           

繼續閱讀