1

Following the mobx documentation and creating the store class, I run into this eslint error. Fail in the first class property, but not in the rest...

import { makeAutoObservable } from 'mobx'

export default class DriverStore {
  firstGivesError = [] // ESLint: Parsing error: Unexpected token =
  noError = [] // no error
  rootStore = null

  constructor(rootStore) {
    makeAutoObservable(this, {rootStore: false})
    this.rootStore = rootStore
  }
}

My eslintrc.json

{
    "env": {
        "browser": true,
        "es2021": true
    },
    "extends": [
        "plugin:react/recommended",
        "airbnb"
    ],
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        },
        "ecmaVersion": 12,
        "sourceType": "module"
    },
    "plugins": [
        "react"
    ],
    "rules": {
    }
}

Does anyone have any idea why it happens?

Marces
  • 115
  • 4
  • 8
  • 2
    Does this answer your question? [Eslint does not allow static class properties](https://stackoverflow.com/questions/60046847/eslint-does-not-allow-static-class-properties) – evolutionxbox Jan 19 '21 at 14:47
  • 1
    @evolutionxbox Yes! I solved it using the newer package [@babel/eslint-parser](https://github.com/babel/babel/tree/main/eslint/babel-eslint-parser) – Marces Jan 19 '21 at 15:36

0 Answers0