How to suppress “{variable} is better written in dot notation.”

后端 未结 3 1079
死守一世寂寞
死守一世寂寞 2021-02-01 00:41

Is there an option to and/or how do I suppress errors like the following?

175,14:[\'tracker\'] is better written in dot notation.

3条回答
  •  长发绾君心
    2021-02-01 01:08

    If it's a feature and not a bug, place this at the top of your file.

    /*jshint sub:true*/
    

    If it's a bug, you should refactor your code

    foo['tracker'] = bar // from this...
    foo.tracker = bar;   // to this!
    

    Good post on the reasons here: https://stackoverflow.com/a/2001410/94668

提交回复
热议问题