查看“︁JSLint”︁的源代码
来自康健生活
←
JSLint
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== 作者 == [http://www.jslint.com/ JSLint] 是由 Douglas Crockford 开发的,可能是最早的 [https://github.com/douglascrockford/JSLint JavaScript Lint] 工具了吧,它的名字来源于著名的C语言工具Lint。 == 特征 == == 安装 == {{shc|<syntaxhighlight lang="bash"> npm install jshint -g</syntaxhighlight>}} == 配置 == == 插件 == {| class="wikitable" |- | SublimeText:[https://github.com/SublimeLinter/SublimeLinter SublimeLinter] || Vim:[https://github.com/Shutnik/jshint2.vim jshint2.vim] || Textmate:[https://github.com/bodnaristvan/JSHint.tmbundle JSHint.tmbundle] || Visual Studio:[https://github.com/jamietre/SharpLinter SharpLinter] |- | Brackets / Edge Code:[https://github.com/cfjedimaster/brackets-jshint/ Brackets JSHint] || Notepad++:[http://sourceforge.net/projects/jslintnpp/ jslintnpp] || gEdit:[https://github.com/Kilian/gedit-jshint gEdit JSHint] || |} == 规则 == JSHint常见的设置选项 强制选项 禁用位运算符,位运算符在 JavaScript 中使用较少,经常是把 && 错输成 & bitwise: true 循环或者条件语句必须使用花括号包围 curly: true 强制使用三等号 eqeqeq: true 兼容低级浏览器 IE 6/7/8/9 es3: true 禁止重写原生对象的原型,比如 Array , Date freeze: true 代码缩进 indent: true 禁止定义之前使用变量,忽略 function 函数声明 latedef: "nofunc" 构造器函数首字母大写 newcap: true 禁止使用 arguments.caller 和 arguments.callee ,未来会被弃用, ECMAScript 5 禁止使用 arguments.callee noarg:true 为 true 时,禁止单引号和双引号混用 "quotmark": false 变量未定义 "undef": true 变量未使用 "unused": true 严格模式 strict:true 最多参数个数 maxparams: 4 最大嵌套深度 maxdepth: 4 复杂度检测 maxcomplexity:true 最大行数 maxlen: 600 宽松选项 控制“缺少分号”的警告 "asi": true "boss": true 忽略 debugger "debug": true 控制 eval 使用警告 "evil": true 检查一行代码最后声明后面的分号是否遗漏 "lastsemic": true 检查不安全的折行,忽略逗号在最前面的编程风格 "laxcomma": true 检查循环内嵌套 function "loopfunc": true 检查多行字符串 "multistr": true 检查无效的 typeof 操作符值 "notypeof": true person['name'] vs. person.name "sub": true new function () { ... } 和 new Object ; "supernew": true 在非构造器函数中使用 this "validthis": true 环境 预定义全局变量 document , navigator , FileReader 等 "browser": true 定义用于调试的全局变量: console , alert "devel": true 定义全局变量 "jquery": true, "node": true == 示例 == == 技巧 == == 备注 ==
此页面嵌入的页面:
模板:Shc
(
查看源代码
)
模板:Shc/style.css
(
查看源代码
)
返回
JSLint
。
导航菜单
康健生活
搜索
user-page
通知
user-interface-preferences
个人工具
登录
五一
多读书,多运动,多到远处走走,再看看不一样的世界。