如何解决此错误消息“初始化错误(Eslint)。意外的标识符”?

亚姆卡斯特利

我有EslintJSCS设置格式化一些代码库的Airbnb爵士风格指南WebStorm在过去的两天里,我一直在有效使用此设置,但是突然,WebStorm开始引发此错误...

ESLint重新格式化的问题:index.js:初始化错误(ESLint)。意外的识别码

在此处输入图片说明

I thought maybe I had some error in my .eslintrc but then I had used the same config to successfully refactor about 150 files before this sudden error. Prior to this, the JSCS compiler was occasionally throwing "less than a minute timeout" exceptions, but then I would fix this with closing and reopening the file. The eslint though seems not to be falling for this trick.

This is my .eslintrc config

{
  "extends": "airbnb",
  "env": {
    "browser": true,
    "node": true
  },
  "globals": {
    "document": false
  },
  "rules": {
    "validateIndentation": 4,
    "func-names": [
      "error",
      "never"
    ],
    "react/jsx-filename-extension": [
      1,
      {
        "extensions": [
          ".js",
          ".jsx"
        ]
      }
    ],
    "jsx-a11y/label-has-for": [
      2,
      {
        "components": [
          "Label"
        ],
        "required": {
          "some": [
            "nesting",
            "id"
          ]
        },
        "allowChildren": false
      }
    ],
    "jsx-a11y/anchor-is-valid": [
      "error",
      {
        "components": [
          "Link"
        ],
        "specialLink": [
          "to",
          "hrefLeft",
          "hrefRight"
        ],
        "aspects": [
          "noHref",
          "invalidHref",
          "preferButton"
        ]
      }
    ]
  }
}

Some part of package.json

{
    "eslint": "^4.14.0",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-loader": "^1.9.0",
    "eslint-plugin-flowtype": "^2.40.1",
    "eslint-plugin-import": "^2.8.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-react": "^7.5.1",
    "extract-text-webpack-plugin": "^3.0.2",
    "prop-types": "^15.6.0",
    "react": "^16.2.0",
    "react-dev-utils": "^4.2.1",
    "react-dom": "^16.2.0",
    "react-redux": "^5.0.6",
    "react-router-dom": "^4.2.2",
  },
  "babel": {
    "presets": [
      "react-app",
      "flow"
    ]
  },
  "eslintConfig": {
    "extends": "react-app"
  }
}

Can some one throw me some pointers on how I can go about fixing this. I suspect it might be more of a WebStorm error than Eslint.

PS: Forgive me if this question might be better suited at superuser. I just thought it's most likely someone here might have faced the same issue.

iamcastelli

Solved by a yarn upgrade


My attempts at recreating the issue with a fresh project failed, with the same configs, both eslint and jscs were running successfully.

However on using the WebStorm context menu command Apply ESlint Code Style Rules on non js files(tested on .eslintrc itself), i got a much more detailed error.

Error on attempt to find parent and base ESLint configuration files of '.eslintrc': [projectpath]\node_modules\lodash\lodash.js:386 '\u0149': ''n', '\u017f': 's',

I double checked lodash package node_modules and package.json, tripple checked the settings configs(Eslint & JSCS) and was sure I had identical setup to the test projects that were linting without errors.

跑步yarn upgrade lodash救了我的头发。由于我已经在运行最新的lodash,因此我认为yarn的Resolveing和Rebuild软件包可以解决问题。

希望有人可能会对此有所帮助。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

初始化Selenium WebDriver时如何解决python-Selenium错误“连接被拒绝”?

如何解决别名中的此SQL查询标识符错误?

语法错误:意外的标识符

Shopware安装错误:标识符DB尚未初始化

如何解决Hyperledger Composer运动场上的此错误(t:标识符不能从超级类型扩展)?

实际上我可以访问该标识符时,如何解决错误“使用未解决的标识符”

如何解决意外令牌“ /”的ESLint解析错误?

如何解决“正确初始化log4j系统”错误?

AudioKit:在集成Audiobus时如何解决错误“使用未解析的标识符'ABAudioSenderPort'”?

如何解决错误:SQL中无法绑定多部分标识符“ p.ra”

我该如何解决此错误后续属性声明必须具有相同的类型和重复的标识符。角度9

如何解决抖动中的预期标识符和':'预期错误?

如何解决“未绑定标识符错误:球拍”

语法错误:意外的标识符

如何解决无法初始化设备hci0。错误?

C ++错误:IntilliSense标识符“ track”未定义-“可能未初始化的本地指针变量“ track””

BootBox-意外的标识符错误

如何解决预期的标识符错误?

错误:语法错误:ESLint(语法解析):意外的标识符javascript

if / else if / else错误-意外的标识符

JavaScript错误:意外标识符

jQuery 意外标识符错误

如何解决未初始化的常量搜索::错误

如何解决代码中的“未声明标识符”错误?

如何解决错误标识符已被声明?

无法放置意外的标识符错误

我如何解决此错误无法在初始化程序中访问实例“小部件”

我如何解决这个“语法错误:意外的标识符”请帮帮我

尝试初始化数组列表时如何解决此错误?