【问题标题】:How to configure WebStorm to work with nx lint instead of ESLint?如何配置 WebStorm 以使用 nx lint 而不是 ESLint?
【发布时间】:2022-02-05 16:31:24
【问题描述】:

在使用 WebStorm(可能还​​有其他 JetBrains IDE)处理 nx 项目时,我不断收到此错误:

错误:加载规则“@typescript-eslint/await-thenable”时出错:您使用了需要生成 parserServices 的规则。因此,您必须为 @typescript-eslint/parser 的“parserOptions.project”属性提供一个值。

我确实在libs/mylibrary/.eslintrs.json 中定义了parserOptions.project

{
  "extends": ["../../.eslintrc"],
  "parserOptions": {
    "project": "./tsconfig.*?.json",
    "tsconfigRootDir": "./libs/mylibrary"
  },
  ...

当我通过npx eslint ./libs/mylibrary 或通过 nx (nx lint mylibrary) 手动运行 ESLint 时,该错误不会重现。

知道如何配置 WebStorm 以与 nx lint 一起工作吗?

【问题讨论】:

    标签: eslint webstorm jetbrains-ide nx.dev


    【解决方案1】:

    可能是运行 linter 的工作文件夹错误的问题。使用 Automatic 配置,ESlint 工作文件夹设置为最近的 .eslintrceslintignore 所在的文件夹(如在https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration 中描述) 如果自动检测到的工作目录与您的项目配置不匹配,您需要手动指定工作目录(目录):在Settings |语言和框架 | JavaScript |代码质量工具 | ESLint,将配置更改为 Manual 并指定您在终端中运行 eslint --fix 的目录(项目根文件夹?)作为工作目录 - 这应该可以解决问题

    【讨论】:

    • 太棒了!谢谢,现在似乎可以正常工作了
    猜你喜欢
    • 2017-11-27
    • 2020-07-01
    • 1970-01-01
    • 2018-04-11
    • 2017-06-22
    • 2021-10-09
    • 2019-12-28
    • 2018-03-20
    • 2017-07-31
    相关资源
    最近更新 更多