【问题标题】:Eslint Jsdoc Plugin is not exectuedEslint Jsdoc 插件未执行
【发布时间】:2020-04-05 23:43:45
【问题描述】:

我正在尝试运行ESLint JSDoc plugin

当我运行npx eslint . 时,airbnb 规则被强制执行,而不是 jsdoc 需要添加 JSDoc 的规则。 我错过了什么吗?

这是test repo

package.json

{
  "name": "eslint-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "eslint": "^6.7.2",
    "eslint-config-airbnb-base": "^14.0.0",
    "eslint-plugin-import": "^2.19.1",
    "eslint-plugin-jsdoc": "^18.4.3"
  }
}
index.js

const fn = (a) => {
  console.log('a :', a);
  return a;
};

module.exports = { fn };

【问题讨论】:

    标签: javascript eslint jsdoc


    【解决方案1】:

    您缺少 ESLint 配置文件。将.eslintrc.js 添加到项目的根目录。然后复制以下基本配置:

    module.exports = {
        root: true,
        plugins: ['jsdoc', 'import'],
        extends: [
            'eslint:recommended',
            'plugin:jsdoc/recommended',
            'plugin:import/errors',
            'plugin:import/warnings',
             'airbnb-base'
        ]
    }
    

    请参阅Configuring ESLinf 了解更多信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-21
      • 2021-09-13
      • 2021-02-06
      • 2019-07-30
      • 2018-03-28
      • 1970-01-01
      • 2016-08-06
      • 1970-01-01
      相关资源
      最近更新 更多