Skip to content

Fails to detect missing JSDoc for static class methods. #1203

@Pik-9

Description

@Pik-9

Expected behavior

ESLint should report a "Missing JSDoc comment" rule violation for the first function as well as for the static class function.

Actual behavior

It only reports the the first missing JSDoc, but not the undocumented static class function.

ESLint Config

Pretty much the standard configuration with the AirBnB style:

module.exports = {
  env: {
    browser: true,
    es2021: true,
    node: true,
  },
  extends: [
    'airbnb-base',
    'plugin:jsdoc/recommended-error',
  ],
  overrides: [
    {
      env: {
        node: true,
      },
      files: [
        '.eslintrc.{js,cjs}',
      ],
      parserOptions: {
        sourceType: 'script',
      },
    },
  ],
  parserOptions: {
    ecmaVersion: 'latest',
    sourceType: 'module',
  },
  plugins: [
    'jsdoc',
  ],
  rules: {
  },
};

ESLint sample

function undocumentedFunction() {
  // This undocumented function will be reported.
  return 42;
}

class MyClass {
  static undocumentedStaticClassFunction() {
    // This one won't.
    return 'What does this function do? No one knows.';
  }
}

export { undocumentedFunction, MyClass };

Environment

  • Node version: v18.18.2
  • ESLint version v8.56.0
  • eslint-plugin-jsdoc version: 48.1.0
  • eslint-config-airbnb-base version: 15.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions