首页 技术 正文
技术 2022年11月9日
0 收藏 414 点赞 4,886 浏览 2467 个字

1

Sublime Text 3 配置react语法校验

原文地址:https://segmentfault.com/a/1190000004369542?_ea=585496

终端安装

npm install -g eslint
npm install -g eslint-plugin-react

sbulime 插件

SublimeLinter
SublimeLinter-contrib-eslint

{
"plugins": [
"html",
"react"
],
"env": {
"node": true,
"jquery": true,
"es6": true,
"browser": true
},
"parser": "babel-eslint",
"ecmaFeatures": {
"jsx": true
},
"rules": {
//官方文档 http://eslint.org/docs/rules/
//参数:0 关闭,1 警告,2 错误 // "quotes": [0, "single"], //建议使用单引号
// "no-inner-declarations": [0, "both"], //不建议在{}代码块内部声明变量或函数
"no-extra-boolean-cast": , //多余的感叹号转布尔型
"no-extra-semi": , //多余的分号
"no-extra-parens": , //多余的括号
"no-empty": , //空代码块
"no-use-before-define": [, "nofunc"], //使用前未定义
"complexity": [, ], //圈复杂度大于10 警告 //常见错误
"comma-dangle": [, "never"], //定义数组或对象最后多余的逗号
"no-debugger": , //debugger 调试代码未删除
"no-console": , //console 未删除
"no-constant-condition": , //常量作为条件
"no-dupe-args": , //参数重复
"no-dupe-keys": , //对象属性重复
"no-duplicate-case": , //case重复
"no-empty-character-class": , //正则无法匹配任何值
"no-invalid-regexp": , //无效的正则
"no-func-assign": , //函数被赋值
"valid-typeof": , //无效的类型判断
"no-unreachable": , //不可能执行到的代码
"no-unexpected-multiline": , //行尾缺少分号可能导致一些意外情况
"no-sparse-arrays": , //数组中多出逗号
"no-shadow-restricted-names": , //关键词与命名冲突
"no-undef": , //变量未定义
"no-unused-vars": , //变量定义后未使用
"no-cond-assign": , //条件语句中禁止赋值操作
"no-native-reassign": , //禁止覆盖原生对象
"no-mixed-spaces-and-tabs": , //代码风格优化
"no-irregular-whitespace": ,
"no-else-return": , //在else代码块中return,else是多余的
"no-multi-spaces": , //不允许多个空格
"key-spacing": [, {
"beforeColon": false,
"afterColon": true
}], //object直接量建议写法 : 后一个空格前面不留空格
"block-scoped-var": , //变量应在外部上下文中声明,不应在{}代码块中
"consistent-return": , //函数返回值可能是不同类型
"accessor-pairs": , //object getter/setter方法需要成对出现
"dot-location": [, "property"], //换行调用对象方法 点操作符应写在行首
"no-lone-blocks": , //多余的{}嵌套
"no-labels": , //无用的标记
"no-extend-native": , //禁止扩展原生对象
"no-floating-decimal": , //浮点型需要写全 禁止.1 或 2.写法
"no-loop-func": , //禁止在循环体中定义函数
"no-new-func": , //禁止new Function(...) 写法
"no-self-compare": , //不允与自己比较作为条件
"no-sequences": , //禁止可能导致结果不明确的逗号操作符
"no-throw-literal": , //禁止抛出一个直接量 应是Error对象
"no-return-assign": [, "always"], //不允return时有赋值操作
"no-redeclare": [, {
"builtinGlobals": true
}], //不允许重复声明
"no-unused-expressions": [, {
"allowShortCircuit": true,
"allowTernary": true
}], //不执行的表达式
"no-useless-call": , //无意义的函数call或apply
"no-useless-concat": , //无意义的string concat
"no-void": , //禁用void
"no-with": , //禁用with
"space-infix-ops": , //操作符前后空格
"valid-jsdoc": [, {
"requireParamDescription": true,
"requireReturnDescription": true
}], //jsdoc
"no-warning-comments": [, {
"terms": ["todo", "fixme", "any other term"],
"location": "anywhere"
}], //标记未写注释
"curly": //if、else、while、for代码块用{}包围
}
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,492
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,907
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,740
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,494
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,132
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,295