首页 技术 正文
技术 2022年11月12日
0 收藏 394 点赞 4,423 浏览 1348 个字

介绍ESLintESLint 是一个代码规范和错误检查工具,有以下几个特性

  1. 所有东西都是可以插拔的。你可以调用任意的rule api或者formatter api 去打包或者定义rule or formatter。
  2. 任意的rule 都是独立的
  3. 没有特定的coding style,你可以自己配置

 安装全局安装,适合你全部项目都需要eslint$ npm install -g eslint接下去安装配置文件$ eslint --init这个步骤会让你选择自己的风格1、向你询问你的style2、使用一些流行的style3、通过你的文件来配置 基础配置详细的配置查看http://eslint.org/docs/user-guide/configuringmodule.exports = {    “env”: {        “browser”: true,        “commonjs”: true,        “es6”: true    },    “extends”: “eslint:recommended”,//可以选择一些流行的style 比如google    “parserOptions”: {        “ecmaFeatures”: {            “experimentalObjectRestSpread”: true,            “jsx”: true        },        “ecmaVersion”: 7, 你的javascript 版本        “sourceType”: “module”    },    “plugins”: [        “react” //插件,支持react    ],    “rules”: {        “indent”: [ //缩进            “error”, //可选项为 off warn error 对应的数字 0 1 2            “space”        ],        “linebreak-style”: [//换行的style            “error”,            “unix”        ],        “quotes”: [//引号 是单的还是双的            “error”,            “single”        ],        “semi”: [            “error”,            “never”        ]    }};IDE的 插件Sublime Text3https://github.com/roadhump/SublimeLinter-eslint通过Package Control -> install Package -> SublimeLinter-eslintWebStorm ESLint 的正式使用感受

更多查看http://eslint.org/docs/user-guide/integrations常见问题1、在sublime text 中jsx 不能使用linter。     view->syntax->open all current extension as … -> javascript2、在webstorm 提示ESLint 的正式使用感受

提示Cannot find module ‘babel-eslint’Error: Cannot find module ‘babel-eslint’我猜测是有些rule的包 在全局变量中没有安装。所以报的错误用当前项目的eslint 就好了ESLint 的正式使用感受

3、怎样让webstorm 的错误提示更明显呢?哈哈,我也不知道答案 

相关推荐
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