0

I'm quite new to react and webpack but have used eslint and javascript for years but this is really driving me insane.

I've created my project and have a actions.js file in my redux folder and in that file all I currently have is

export default UPDATE_IS_LOGGED_IN = 'UPDATE_IS_LOGGED_IN';

I've installed airbnb eslinter and setup the webpack task like so

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

and in my .eslintrc file I have

{
"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"]
}

But when I run webpack I get the following eslinting errors for the action.js file.

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

This isn't the only file its happening on its nearly every js file in my project.

Tom Maton
  • 1,564
  • 3
  • 23
  • 41

1 Answers1

1

I'm guessing it is linting the files that webpack has already built. Try adding your build file to excludes.

Tyler
  • 1,705
  • 2
  • 18
  • 26