未找到规则“jsdoc/newline-after-description”的定义 jsdoc/newline-after-description

Ton*_*ark 12 javascript wordpress eslint eslint-plugin-jsdoc

我在检查我正在使用以下配置的 JS 文件时遇到此错误。我正在按照 WordPress 标准进行 linting。因此我使用了一些 WordPress 插件。

{
  "extends": [
    "plugin:@wordpress/eslint-plugin/recommended"
  ],
  "plugins": [
    "jsdoc"
  ],
  "parserOptions": {
    "ecmaVersion": 6,
    "ecmaFeatures": {
      "jsx": true,
      "arrowFunctions": true,
      "blockBindings": true,
      "classes": true,
      "defaultParams": true,
      "modules": true
    },
    "sourceType": "module"
  },
  "globals": {
    "wp": false,
    "hm": false,
    "_": false
  },
  "env": {
    "es6": true,
    "browser": true,
    "node": true,
    "commonjs": true,
    "jquery": true
  },
  "rules": {
    "camelcase": [1],
    "space-in-parens": [1, "always"],
    "no-trailing-spaces": [1],
    "spaced-comment": [0],
    "padded-blocks": [0],
    "prefer-template": [0],
    "max-len": [0],
    "no-else-return": [0],
    "func-names": [0],
    "object-shorthand": [0],
    "indent": ["error", "tab"],
    "space-before-function-paren": 0,
    "no-tabs": 0,
    "prefer-destructuring": 0,
    "no-param-reassign": 0,
    "curly": "error",
    "no-empty-function": "error",
    "no-global-assign": "error",
    "yoda": [ "error", "always" ],
    "no-undefined":"error",
    "comma-spacing": ["error", { "before": false, "after": true }],
    "lines-between-class-members": ["error", "always"],
    "arrow-spacing": "error",
    "jsdoc/check-alignment": 1,
    "jsdoc/check-param-names": 1,
    "jsdoc/check-tag-names": 1,
    "jsdoc/check-types": 0,
    "jsdoc/implements-on-classes": 1,
    "jsdoc/newline-after-description": 1,
    "jsdoc/no-undefined-types": 0,
    "jsdoc/require-jsdoc": 1,
    "jsdoc/require-param": 1,
    "jsdoc/require-param-description": 1,
    "jsdoc/require-param-name": 1,
    "jsdoc/require-param-type": 1,
    "jsdoc/require-returns": 1,
    "jsdoc/require-returns-check": 1,
    "jsdoc/require-returns-description": 1,
    "jsdoc/require-returns-type": 1,
    "jsdoc/valid-types": 1,
    "no-mixed-spaces-and-tabs": "off",
    "require-jsdoc": ["error", {
      "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true,
        "ArrowFunctionExpression": true,
        "FunctionExpression": true
      }
    }]
  },
  "settings": {
    "jsdoc": {
      "tagNamePreference" : {
        "param": "param",
        "returns": "return"
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我从 WordPress 教程中获得了此配置,但遇到了给定的错误。

错误:找不到规则“jsdoc/newline-after-description”的定义 jsdoc/newline-after-description

ruf*_*fin 15

看起来该规则已被删除/已过时。

这是 eslint jsdoc 插件 github 站点上的一个问题

该规则已被删除。您是否依赖使用它的配置?

我会删除该规则,尽管关闭它也可能有效。

为了通过 linting,我必须在 eslintrc.json 中关闭规则:"jsdoc/newline-after-description": "off",

所以交换

"jsdoc/newline-after-description": 1,

"jsdoc/newline-after-description": "off",

或者

"jsdoc/newline-after-description": 0,


顺便说一句,这看起来像是一个 eslint 问题(更具体地说,是一个针对 jsdoc 问题的 eslint 插件),而不是jslint问题。JSLint 是完全不同的工具:http://jslint.com我已经适当地编辑了您的问题的标签。