首页 > 其他 > 详细

eslint初始化配置

时间:2021-09-07 02:45:21      阅读:17      评论:0      收藏:0      [点我收藏+]

1、安装:npm install eslint --save-dev

2、./node_modules/.bin/eslint --init命令初始化eslint;

3、(1)How would you like to use ESLint?

To check syntax only // 只检查语法性错误
To check syntax and find problems // 检查语法错误并且发现问题代码
> To check syntax, find problems, and enforce code style // 检查语法错误,发现问题代码,校验代码风格

              选第三个,检查语法错误,发现问题代码,校验代码风格

      (2)What type of modules dos your project use?

JavaScript modules (import/export) // ESM:允许使用import/export
CommonJS (require/exports) // CommonJS:允许使用require/exports
> None of these // 没有用到任何模块化

选第一个,import/export

      (3)Which framework does you project use?

               React

               Vue.js

               > None of these

               选vue

      (4)Does your project use TypeScript? No / Yes

               输入yes

      (5)Where does you code run? // 多选

(*) Browser // 浏览器环境

(*) Node // node环境

选浏览器

      (6)How would you like to define a style for your project?

> Use a popular style guide // 使用一个市面上的主流风格
Answer questions about your style // 通过回答问题,形成一个风格
Inspect your JavaScript file(s) // 根据JS代码文件,推断代码风格

选第一个,市面主流风格

      (7)Which style guide do you want to follow?

Airbnb: https://github.com/airbnb/javascript
> Standard: https://github.com/standard/standard
Google: https://github.com/google/eslint-config-google

选第二个,开源

eslint初始化配置

原文:https://www.cnblogs.com/luchangzhu/p/15232513.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!