0

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

1 Answer 1

1

I have found the issue.

It was a typo: instanceof instead of instanceOf

Sign up to request clarification or add additional context in comments.

2 Comments

Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
it's complete answer @SurajKumar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.