【问题标题】:how disable eslint no-promise-executor-return?如何禁用 eslint no-promise-executor-return?
【发布时间】:2022-10-12 23:54:00
【问题描述】:

是否可以禁用 eslint no-promise-executor-return ?

我的文件 .eslintrc

{
  "env": {
    "es6": true,
    "node": true
  },
  "extends": [
    "airbnb-base"
  ],
  "globals": {
    "describe": true,
    "it": true,
    "expect": true,
    "beforeEach": true
  },
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 2018,
    "sourceType": "module",
    "project": "./tsconfig.json",
    "tsconfigRootDir": "./"
  },
  "plugins": [
    "@typescript-eslint",
    "import"
  ],
  "rules": {
    "import/extensions": [
      "error",
      "ignorePackages",
      {
        "ts": "never"
      }
    ],
    "import/no-duplicates": "off",
    "import/no-promise-executor-return": "off",
    "@typescript/max-classes-per-file": "off",
    "max-classes-per-file": "off",
    "@typescript-eslint/camelcase": "off",
    "@typescript-eslint/no-explicit-any": "off",
    "no-underscore-dangle": "off",
    "import/prefer-default-export": "off",
    "no-plusplus": "off",
    "class-methods-use-this": "off",
    "no-unused-vars": "off",
    "max-len": "off",
    "no-lone-blocks": "off",
    "@typescript-eslint/no-non-null-assertion": "off",
    "no-restricted-syntax": "off",
    "@typescript-eslint/explicit-function-return-type": "off",
    "camelcase": "off",
    "no-undef": "off",
    "no-use-before-define": "off",
    "no-shadow": "off"
  },
  "settings": {
    "import/resolver": {
      "node":{
        "extensions": [".js", ".jsx", ".ts", ".tsx",".d.ts"],
        "moduleDirectory": ["src", "node_modules"]
      },
      "typescript": {}
    }
  }
}

我的错误 lint

【问题讨论】:

标签: typescript eslint yarnpkg eslintrc typescript-eslint


【解决方案1】:

看起来您正在禁用规则 import/no-promise-executor-return,这将是来自 eslint-plugin-import 集的规则。根据 eslint 的输出,您似乎只想禁用 no-promise-executor-return,根据文档,这只是一个基本的 eslint 规则 (https://eslint.org/docs/latest/rules/no-promise-executor-return)。

如果你更换

"import/no-promise-executor-return": "off",

和

 "no-promise-executor-return": "off",

那应该禁用规则。

【讨论】:

    猜你喜欢
    • 2021-01-08
    • 2019-10-30
    • 2022-01-22
    • 2018-05-23
    • 2020-01-25
    • 2020-06-04
    • 2021-09-05
    • 2019-01-20
    • 2019-11-16
    相关资源
    最近更新 更多