我正试图在我的React项目中使用Airbnb的Javascript标准设置linting,它使用webpack.
根据评论更新了最新的软件包.
"babel-eslint": "^6.1.2",
"eslint": "^3.2.2",
"eslint-config-airbnb": "^10.0.0",
"eslint-plugin-import": "^1.12.0",
"eslint-plugin-jsx-a11y": "^2.0.1",
"eslint-plugin-react": "^6.0.0",
"jshint": "^2.9.2",
"jshint-loader": "^0.8.3",
"json-loader": "^0.5.4",
Run Code Online (Sandbox Code Playgroud)
我的webpack配置中也有一个预加载器设置
preLoaders: [
{
test: /\.jsx?$/,
loaders: ['eslint'],
// define an include so we check just the files we need
include: PATHS.app
}
],
Run Code Online (Sandbox Code Playgroud)
以下设置用于运行脚本
"lint": "eslint . --ext .js --ext .jsx --ignore-path .gitignore --cache",
Run Code Online (Sandbox Code Playgroud)
我还有一个.eslintrc文件,其中包含以下内容
{
"extends": "airbnb",
"env": {
"node": true,
"es6": true
}
}
Run Code Online (Sandbox Code Playgroud)
这给了我以下错误:
Configuration for rule "react/jsx-sort-props" is invalid:
Value "data["0"].shorthandLast" has additional …Run Code Online (Sandbox Code Playgroud) 我对打字稿做出了反应。
我正在尝试向我的项目添加一些 eslint,但在 yarn lint 期间出现此错误
(eslint src/** --ext .ts,.tsx")
我也在 css 上遇到了一些错误
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/logo.svg.
The extension for the file (.svg) is non-standard. You should add "parserOptions.extraFileExtensions" to your config
Run Code Online (Sandbox Code Playgroud)
.css 也一样
我的 eslint 基于这篇文章 https://gist.github.com/1natsu172/a65a4b45faed2bd3fa74b24163e4256e