今天配置下Webstorm下面的Eslint。

1,先看下本地安装的Node,NPM版本,2017-11-23日这个节点最新版本。

>node -v
v8.9.1
>npm -v
5.5.

2,使用Webstorm快捷键Alt + F12,进入Terminal窗口,如下图

3,执行全局安装eslint

     npm install -g eslint

4,执行 eslint --init

初始化eslint配置文件,每一步根据自己需要选择YES or NO,

C:\Users\XXXXXXX\WebstormProjects\es6tutorial>eslint --init
? How would you like to configure ESLint? Answer questions about your style
? Are you using ECMAScript features? Yes
? Are you using ES6 modules? Yes
? Where will your code run? Browser
? Do you use CommonJS? No
? Do you use JSX? No
? What style of indentation do you use? Tabs
? What quotes do you use for strings? Single
? What line endings do you use? Unix
? Do you require semicolons? Yes
? What format do you want your config file to be in? JavaScript

最后将会生成一份.eslintrc.js 文件,

5,在自己项目里,执行 eslint learning/chap02-let.js,

eslint将会根据配置的规则进行JS验证并在控制台打印出提示消息

PS:我在安装测试过程中,发生如下错误,大概意思是:要确保ESLint全局安装。

Oops! Something went wrong! :(

ESLint: 4.11..
ESLint couldn't find the plugin "eslint-plugin-jsx-a11y". This can happen for a couple different reasons: . If ESLint is installed globally, then make sure eslint-plugin-jsx-a11y is also installed globally. A globally-installed ESLint cannot find a
locally-installed plugin. . If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following: npm i eslint-plugin-jsx-a11y@latest --save-dev If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

Webstorm下安装ESLint检测JS代码的更多相关文章

  1. vscode安装eslint插件,代码统一自动修复

    ESlint:是用来统一JavaScript代码风格的工具,不包含css.html等. 方法和步骤: 通常情况下vue项目都会添加eslint组件,我们可以查看webpack的配置文件package. ...

  2. ESLint检测JavaScript代码

    1.安装 有2中安装方式:全局安装和局部安装. 局部安装方式为: (1)cnpm install -g eslint (2)打开项目目录.配置eslint文件 eslint --init (3)执行e ...

  3. ubuntu下安装 openssl&&编译运行测试代码

    检查是否已安装 openssl: sudo apt-get install openssl 如果已安装执行以下操作:sudo apt-get install libssl-devsudo apt-ge ...

  4. 检测js代码是否已加载的判断代码

    该方法不局限于jQuery的检测,对与任何Javascript变量或函数都是通用的. 当前网页加载jQuery后,jQuery()或$()函数将会被定义,所以检测jQuery是否已经加载存在以下2种方 ...

  5. Linux系统下安装 rpm 软件和源代码 软件包

    RPM 安装方式 RPM是一个包安装管理软件,我们可以使用这个工具安装 .rpm 类型的软件.Linux的rpm包很多都能在光盘的Packages 包中找得到.首先挂载一下光盘,查看Packages中 ...

  6. CentOS下安装实时检测网络带宽的小工具bmon

    首先下载rpmforge-release扩展的rpm包 32位操作系统:wget http://www.sudu.us/Tools/bmon/rpmforge-release-0.3.6-1.el5. ...

  7. 浏览器检测JS代码(兼容目前各大主流浏览器)

    var BrowserMatch = { init: function () { this.browser = this.getBrowser().browser || "An Unknow ...

  8. Linux环境下安装配置Node.js

    1.在官网查看版本,LTS代表长期支持的版本 2.进入服务器 3.输入命令:·wget https://npm.taobao.org/mirrors/node/v8.9.3/node-v8.9.3-l ...

  9. TODO:Ubuntu下安装Node

    TODO:Ubuntu下安装Node Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境.Node.js 使用了一个事件驱动.非阻塞式 I/O 的模型,使其轻量又高 ...

随机推荐

  1. springboot mybatis优雅的添加多数据源

    springboot的原则是简化配置,本文试图不通过xml配置,使用configuration配置数据源,并进行简单的数据访问. 并且配置了多数据源,在开发过程中这种场景很容易遇到. 1.依赖 spr ...

  2. scala中的Type使用

    trait Base { val name: String } case class S( name: String, age: Int ) extends Base case class F( na ...

  3. bind、apply与call

    bind.apply与call 先说观点:不论是bind.apply还是call,最大的好处就是代码复用. bind 在开发中,我们只有复用代码时,才会出现this指向需要改动的情况. 纵观bind的 ...

  4. 使用acs-engine在Azure中国区部署kubernetes集群详解

    转载请注明出处:http://www.cnblogs.com/wayneiscoming/p/7649642.html 1. acs-engine简介 ACS是微软在2015年12月推出的一项基于容器 ...

  5. sharepoint 创建个人网站

    One of the SharePoint 2013 puzzle pieces which got some major improvements are My Sites, User Profil ...

  6. Django——模板层(template)(模板语法、自定义模板过滤器及标签、模板继承)

    前言:当我们想在页面上给客户端返回一个当前时间,一些初学者可能会很自然的想到用占位符,字符串拼接来达到我们想要的效果,但是这样做会有一个问题,HTML被直接硬编码在 Python代码之中. 1 2 3 ...

  7. mysql 外键的几种约束

    restrict方式 同no action, 都是立即检查外键约束    --限制,指的是如果字表引用父表的某个字段的值,那么不允许直接删除父表的该值: cascade方式 在父表上update/de ...

  8. 数据帧CRC32校验算法实现

    本文设计思想采用明德扬至简设计法.由于本人项目需要进行光纤数据传输,为了保证通信质量要对数据进行校验.在校验算法中,最简单最成熟的非CRC校验莫属了. 得出一个数的CRC校验码还是比较简单的: 选定一 ...

  9. Oracle:sqlplus前缀显示当前用户

    第一步:进入SQLPLUS的按照目录,cd $ORACLE_HOME/sqlplus/admin 第二步:查找ll     vi  glogin.sql 第三步:插入 命令行模式,Go, set sq ...

  10. LeetCode 235. Lowest Common Ancestor of a Binary Search Tree (二叉搜索树最近的共同祖先)

    Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS ...