ET-CS
ET-CS

Reputation: 7160

ESLint: Parsing error: Unexpected token instanceOf

In a Node.JS project I'm refactoring, I am getting a wierd lint error when adding the following statement:

try {
   ...
} catch (e) {
   if (e instanceOf MyCustomError) {
      ...
   }
}
ESLint: Parsing error: Unexpected token instanceOf

The project is using eslint version 5.16.0 and this is my .eslintrc.json:

{
    "env": {
        "node": true,
        "commonjs": true,
        "es6": true,
        "mocha": true
    },
    "extends": [
        "eslint:recommended",
        "plugin:import/errors",
        "plugin:import/warnings"
    ],
    "parserOptions": {
        "ecmaVersion": 2018,
        "sourceType": "module"
    },
    "plugins": ["import"],
    "rules": {
        "max-len": 0,
        "switch-colon-spacing": 0,
        "no-tabs": 0,
        "linebreak-style": 0,
        "semi": 0,
        "new-cap": 0,
        "arrow-parens": 0,
        "indent": 0,
        "object-curly-spacing": 0,
        "comma-dangle": 0,
        "camelcase": 0,
        "import/named": 2,
        "import/namespace": 2,
        "import/default": 2,
        "import/export": 2,
        "import/no-unresolved": 0
    }
}

Can't find anything about that error in the internet.
Any help would be appreciated!

Thanks in advance

Upvotes: 0

Views: 423

Answers (1)

ET-CS
ET-CS

Reputation: 7160

I have found the issue.

It was a typo: instanceof instead of instanceOf

Upvotes: 1

Related Questions