ReactJS在不存在的行上设置抛出错误

时间:2018-06-06 21:08:03

标签: javascript reactjs webpack eslint-config-airbnb

我很反应和webpack,但多年来一直使用eslint和javascript,但这真的让我疯了。

我已经创建了我的项目,并在我的actions.js文件夹中有一个redux文件,而且我目前拥有的文件是

export default UPDATE_IS_LOGGED_IN = 'UPDATE_IS_LOGGED_IN';

我已经安装了airbnb eslinter并设置了这样的webpack任务

{
  test: /\.js$/,
  exclude: ['/node_modules/'],
  use: ['eslint-loader', 'babel-loader']
}

并在我的.eslintrc文件中

{
"parser": "babel-eslint",
"rules": {
    "comma-dangle" : 0,
    "no-undef": "off",
    "max-len": [1, 120, 2, {"ignoreComments": true}],
    "no-compare-neg-zero": "error",
    "no-unused-vars": "off",
    "class-methods-use-this": ["error", {
        "exceptMethods": [
            "render",
            "getInitialState",
            "getDefaultProps",
            "componentWillMount",
            "componentDidMount",
            "componentWillReceiveProps",
            "shouldComponentUpdate",
            "componentWillUpdate",
            "componentDidUpdate",
            "componentWillUnmount"
        ]
    }]
},
"extends": ["airbnb-base"]
}

但是当我运行webpack时,action.js文件会出现以下eslinting错误。

1:1   error  'use strict' is unnecessary inside of modules  strict
3:32  error  Strings must use singlequote                   quotes
6:19  error  Unexpected chained assignment                  no-multi-assign
6:63  error  Newline required at end of file but not found  eol-last

这不是它在我项目中几乎每个js文件中发生的唯一文件。

1 个答案:

答案 0 :(得分:1)

我猜它是lint webpack已经构建的文件。尝试添加您的构建文件以排除。

相关问题