相关疑难解决方法(0)

使用React和Webpack设置Airbnb ESLint

我正试图在我的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)

reactjs eslint webpack airbnb-js-styleguide

13
推荐指数
1
解决办法
1万
查看次数

标签 统计

airbnb-js-styleguide ×1

eslint ×1

reactjs ×1

webpack ×1