SublimeText插件eslint : 语法检测

参考: http://www.tuicool.com/articles/faANRvj

 

安装之后的效果:

误用了 = ,在文件保存时就会被提示,直接顺手改掉就行了,方便的不行

 

 

  • 步骤2:安装ESLint: npm i -g eslint

 

  • 步骤3::配置eslint,最好把 官方教程 看看,配置出适合自己编程习惯的配置文件再好不过了,我的配置文件内容如下:

    文件: .eslintrc.json

    内容: 

{

"env": {
  "browser": true,
  "es6": true,
  "node": true
},
"parserOptions": {
  "sourceType": "module"
},
"rules": {

"no-cond-assign": [2, "always"], //if, while等条件中不允许使用“=”
"no-constant-condition": 2,
"no-debugger": 2, // 程序中不能出现debugger
"no-dupe-args": 2, // 函数的参数名称不能重复
"no-dupe-keys": 2, // 对象的属性名称不能重复
"no-duplicate-case": 2, // switch的case不能重复
"no-func-assign": 2,
"no-obj-calls": 2,
"no-regex-spaces": 2,
"no-sparse-arrays": 2,
"no-unexpected-multiline": 2,
"no-unreachable": 2,
"use-isnan": 2,
"valid-typeof": 2,
"eqeqeq": [2, "always"],
"no-caller": 2,
"no-eval": 2,
"no-redeclare": 2,
"no-undef": 2,
"no-unused-vars": 1,
"no-use-before-define": 2,
"comma-dangle": [1, "never"],
"no-const-assign": 2,
"no-dupe-class-members": 2

}

}

  • 最后,把配置好的文件放在你项目的根目录中就可以了,项目中所有的子文件也会自动使用该配置文件。

 

转载于:https://www.cnblogs.com/vs1435/p/7047237.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值