我正在尝试将eslint添加到我的打字稿create-react-app
应用程序中。
我正在使用Visual Studio代码。
我做到了:
- 以可视代码下载Eslint软件包
- 下载Eslint软件包
- 我安装了3个eslint插件
"eslint:recommended","plugin:@typescript-eslint/recommended","plugin:react/recommended"
- 在应用程序的根文件夹中创建一个
.eslintrc
文件,如下所示:
{
"plugins": [
"react"
],"extends": [
"eslint:recommended","plugin:react/recommended"
],"parserOptions": {
"ecmaVersion": 7,"sourceType": "module","ecmaFeatures": {
"jsx": true
}
},"env": {
"browser": true,"node": true,"es6": true
},"settings": {
"import/resolver": {
"node": {},"babel-module": {
"root": ["./src"]
}
}
}
}
- 启动eslint并重新启动vs代码
现在,我尝试做一些掉线的问题,例如尾随空格或不使用pascalCase,但是我从没有收到Eslint的警告,我只看到打字稿错误,但是从来没有看到过类似掉线的问题。
是否需要进行一些其他配置才能使其在我的工作空间中正常工作?