Webstorm下安装ESLint检测JS代码
2024-10-18 18:23:17
今天配置下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.
最新文章
- javascript 设置input框只读属性 获取disabled后的值并传给后台
- Babelfish(poj 2503)
- Java 常用排序算法/程序员必须掌握的 8大排序算法
- 登陆shell与交互式非登陆shell的区别
- SqlServer2005安装错误解决方法
- Android调试时, ";adb devices";命令提示 adb server is out of date. killing...
- JVM内存模型及垃圾收集策略解析
- cocos2dx mac下搭建android开发环境
- 智能提示含查询多列(html+JS+handler+ HttpRemoting)一、html示列 加 JS加 请求 Handler
- 【Android应用开发】Android Studio 简介 (Android Studio Overview)
- 利用android studio 生成 JNI需要的动态库so文件
- SpringBoot主程序注解@SpringBootApplication简单分析
- python爬虫-百度百科百名红通人员名单
- 原生JavaScript运动功能系列(三):多物体多值运动
- BizTalk Map 累积连接字符串
- HTML中body与html的关系
- day 25 udp, socketserver
- effective c++ 笔记 (26-29)
- Java动态代理机制研读
- MSTP故障处理手册
热门文章
- jQuery Mobile 所有class选项,开发全解+完美注释
- Spring3实战第二章第一小节 Spring bean的初始化和销毁三种方式及优先级
- Linux上的文件搜索
- 用FastDFS一步步搭建文件管理系统
- Spring批量更新batchUpdate提交和Hibernate批量更新executeUpdate
- SpringMVC + Spring + Mybatis+ Redis +shiro以及MyBatis学习
- 【NOIP2015提高组】Day2 T1 跳石头
- java字串加密
- HTTPS和HTTP有什么区别?如何将HTTP转化成HTTPS
- Xcode9 FFmpeg冲突问题