sublimeLinter-jshint 配置

这几天知道sublime3有可以对javascript进行语法检查的文件,折腾了一上午,搞定了.

记录一下步骤:

1.先安装nodejs.

2.npm install jshint -g

3.通过sublime3 的packagecontrol 安装 sublimeLinter 这个插件

4.通过sublime3的packagecontrol 安装 sublimeLinter-jshint这个插件

5.在项目文件夹中建立一个 .jshintrc文件

6.文件中配置如下:

{
    "es3": true,  //ES3标准
    "browser": true,//浏览器环境,这样语法检查就认识 document,location等这些浏览器环境下的全局变量
    "devel": true,//这样语法检查就认识 console,alert等这些全局方法
    "jquery": true,//让jshint认识jquery的全局变量
    "strict": true,//每次写js必须开启严格模式,也就是如果你没加"use strict";这句话,就报错
    "latedef":true,//如果你使用一个未声明的变量,报错
    "globals":{  //定义一些全局变量,因为我使用seajs,所以告诉jshint下面这些变量是我的框架中有定义的,不要报错
        "seajs": true,
        "module": true,
        "define": true,
        "exports": true,
        "gulp": true,
        "require": true
    }
}
原文地址:https://www.cnblogs.com/zhangfengyang/p/5062803.html