ESLint:分析错误:意外的令牌instanceOf

在Node.JS项目中,我正在重构, 添加以下语句时出现奇怪的皮棉错误:

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

该项目正在使用eslint版本5.16.0,这是我的.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
yin3573389 回答:ESLint:分析错误:意外的令牌instanceOf

我找到了问题。

这是一个错字:instanceof而不是instanceOf

本文链接:https://www.f2er.com/2563264.html

大家都在问