0

I'm having trouble getting rid of an error on my the equals sign =. I'm using eslint recommended settings and tried using the experimentalobjectrestspread to rectify the issue from another answer on here.

The error still persists.

Here is my eslint file.

{
"extends": "eslint:recommended",
"parserOptions": {
    "sourceType": "module",
    "ecmaVersion": 6,
    "ecmaFeatures": {
        "jsx": true,
        "experimentalObjectRestSpread": true
    }
},
"env": {
    "node": true,
    "browser": true,
    "es6": true
},
"rules": {
    "no-console": "off",
    "no-unused-vars": "off"
}

}

Code with error (only on the first equals after onSubmit)

export class AddExp extends React.Component {
    onSubmit = (expense) => {
        this.props.addExpense(expense);
        this.props.history.push('/');
    };
cala
  • 767
  • 4
  • 11
  • 28
  • 1
    You're using a class property, this is not something that is yet in the language. – Axnyff Mar 03 '18 at 15:06
  • Hi @Axnyff how so? How do I rectify this issue, change the code? change the eslint file? – cala Mar 03 '18 at 15:08
  • 1
    Possible duplicate of [How do I configure ESLint to allow fat arrow class methods](https://stackoverflow.com/questions/34244888/how-do-i-configure-eslint-to-allow-fat-arrow-class-methods) – Axnyff Mar 03 '18 at 15:09
  • 1
    babel-eslint might help you to use that features – digit Mar 03 '18 at 15:11
  • @digit I'm install npm babel-eslint and I'll see if it takes away the issue and also babel-preset-stage-1 from Axnyff link – cala Mar 03 '18 at 15:17
  • Now I'm getting another error - [eslint] 'props' is not defined. But the = error is gone – cala Mar 03 '18 at 15:19
  • I'm now using airbnb eslint rules – cala Mar 03 '18 at 15:49

0 Answers0