加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

sublime下安装jshint插件

发布时间:2020-12-14 23:50:09 所属栏目:资源 来源:网络整理
导读:我们每个人写代码时,都有自己的个人习惯,为了更好地合作开发,团队的编码习惯还是要有的,那么jshint将是一个不错的可编辑代码约束规范和风格的代码检测工具。 一、sublime下插件安装 通过package control安装Sublimelinter(我只找到Sublimelint)和Subli

我们每个人写代码时,都有自己的个人习惯,为了更好地合作开发,团队的编码习惯还是要有的,那么jshint将是一个不错的可编辑代码约束规范和风格的代码检测工具。

一、sublime下插件安装

通过package control安装Sublimelinter(我只找到Sublimelint)和SublimeLinter-jshint插件。

接下来的需要Node支持了。

二、npm包安装

去Node官网下载个Node,其中自带了npm包管理工具。

去控制台,输入:

install -g jshint

等安装完成后,重启sublime,检测功能就可以使用了。

三、jshint配置

在Node的安装目录下搜到一个.jshintrc的文件,打开这个JSON文件,编辑其中的内容,指定选项的打开或关闭。

目前刚开始,暂时弄这些,后期根据实际情况再更新。

{
    "curly": true,// true: Require {} for every new block or scope
    "eqeqeq": false,// 设置为true,禁止使用这个选项 ==和 !=,强制使用 ===和 !==
    "immed": false,// true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
    "latedef": false,// true: Require variables/functions to be defined before being used
    "noarg": true,// true: 禁止使用这个选项 arguments.caller和 arguments.callee
    "sub": true,// true: Prohibit use of empty blocks
    "undef": true,// true: Require all non-global variables to be declared (prevents global leaks)
    "unused": true,// 变量定义未使用
    "eqnull": true,// true: Requires all functions run in ES5 Strict Mode
    "es3": true,// {int} Max number of formal params allowed per function
    "freeze": true,// 这个选项禁止重写原生对象的原型列如 Array,Date等等。
    "funcscope": true,// 禁止从外部访问内部声明的变量
    "latedef": true,// 禁止定义之前使用变量。
    "bitwise": false,// 是否禁用位运算符
    "maxstatements": 7,// 这个选项允许您设置语句允许的最大声明数
    "nocomma": true,// 这个选项禁止使用逗号操作符。
    "predef": true,// 扩展的隐式全局变量
    "asi": true,// 禁止缺少分号警告
    "browser": true,// 暴露浏览器属性的全局变量,列如 window,document; 注意:这个选项不暴露变量 alert或 console。
    "devel": true,"laxcomma": true,"es5": true,"esversion: 6": true,"node": true,"strict": false,// {int} Max depth of nested blocks (within functions)
    "-W117": true // {int} Max number statements per function
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读