【问题标题】:How can I fix eslint definition for rule 'sap-....' was not found?如何修复未找到规则“sap-....”的 eslint 定义?
【发布时间】:2017-06-19 03:49:16
【问题描述】:

我正在使用 SAP eslint 配置并拥有所有配置文件,但我仍然收到此错误:

有什么建议吗?

PS:我正在使用 WebStorm

配置:

{
  "env": {
    "browser": true
  },
  "globals": {
    "sap": true,
    "jQuery": true
  },
  "rules": {
    "sap-no-localhost": 2,
    "sap-no-ui5base-prop": 2,
    "sap-usage-basemastercontroller": 2,
    "sap-no-dom-access": 2,
    "sap-no-global-selection": 2,
    "sap-timeout-usage": 2,
    "sap-no-history-manipulation": 2,
    "sap-no-ui5-prop-warning": 2,
    "sap-no-proprietary-browser-api": 2,
    "no-use-before-define": 2,
    "no-redeclare": 2,
    "no-extra-boolean-cast": 2,
    "no-shadow": 2,
    "no-reserved-keys": 2,
    "no-unused-vars": [2, {"vars": "all", "args": "none"}],
    "no-extend-native": 2,
    "no-eq-null": 2,
    "eqeqeq": 2,

    "no-underscore-dangle": 0,
    "new-cap": 0,
    "quotes": 0,
    "camelcase": 0,
    "eol-last": 0
  }
}

【问题讨论】:

  • ESLint 没有内置此规则 (eslint.org/docs/rules),这就是它找不到它们的原因。如果可用,您可能应该安装一些额外的 ESLint 插件来添加这些规则。

标签: sapui5 webstorm eslint


【解决方案1】:

根据您提供的配置,SAP 规则使用过时的custom-rules 方法而不是插件。您必须下载所有 SAP 规则,将它们放在目录中并配置 WebStorm 以使用 --rulesdir 开关运行 ESLint。

【讨论】:

    猜你喜欢
    • 2020-03-23
    • 2021-05-08
    • 2021-10-22
    • 1970-01-01
    • 2019-02-09
    • 2021-06-08
    • 2020-09-26
    • 1970-01-01
    • 2021-02-20
    相关资源
    最近更新 更多