[英]Linting react typescript project
I am trying to lint my react project with typescript template.我正在尝试使用 typescript 模板来整理我的反应项目。 I want to use the airbnb style guide, but when the ran the comm
npx eslint --init
I only get the standard option and the xo option.我想使用 airbnb 样式指南,但是当运行 comm
npx eslint --init
我只得到标准选项和 xo 选项。 Is there a reason for this?是否有一个原因?
As stated in the ESLint documentation , assuming you have a package.json
file, you can install and configure ESLint with:如ESLint 文档中所述,假设您有
package.json
文件,您可以安装和配置 ESLint:
npm init @eslint/config
Then, in the configuration, you should select To check syntax, find problems, and enforce code style
option as an answer to How would you like to use ESLint?
然后,在配置中,您应该 select
To check syntax, find problems, and enforce code style
选项作为How would you like to use ESLint?
. . For the styling question, you can choose
Use a popular style guide
and Airbnb
options, respectively.对于样式问题,您可以分别选择
Use a popular style guide
和Airbnb
选项。
Note: I also tried with npx eslint --init
command, and see the Airbnb
option.注意:我也尝试使用
npx eslint --init
命令,并查看Airbnb
选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.