简体   繁体   English

Eslint Jsdoc 插件未执行

[英]Eslint Jsdoc Plugin is not exectued

I am trying to run the ESLint JSDoc plugin我正在尝试运行ESLint JSDoc 插件

When I run npx eslint .当我运行npx eslint . airbnb rules are enforced but not the jsdoc ones requiring to add JSDoc. airbnb 规则是强制执行的,但不需要添加 JSDoc 的 jsdoc 规则。 Am I missing something ?我错过了什么吗?

Here is a 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 };

You are missing the ESLint configuration file.您缺少 ESLint 配置文件。 Add .eslintrc.js to the root of your project..eslintrc.js添加到项目的根目录。 Then copy the following basic configuration:然后复制以下基本配置:

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

See Configuring ESLinf for more informaion.有关更多信息,请参阅配置 ESLinf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM