Skip to content

[jsdoc/require-jsdoc] : 'CallExpression:not(*)' == errors triggered on functions calls #614

@RichardFevrier

Description

@RichardFevrier

Expected behavior

When using the rule jsdoc/require-jsdoc with contexts with CallExpression:not(*) and MemberExpression, the plugin should not trigger an error on functions calls.

Actual behavior

Errors are triggered on functions calls.

ESLint config

module.exports = {
  root: true,
  globals: {
    'console': false
  },
  parser: 'babel-eslint',
  extends: ['plugin:jsdoc/recommended'],
  rules: {
    'jsdoc/require-jsdoc': ['error', {
      contexts: [
        'CallExpression:not(*)', // should prevent the next line (also tried `'CallExpression:not(*) > MemberExpression'` but wasn't sure about this one)
        'MemberExpression', // <- false positive
        'VariableDeclaration',
      ],
    }],
  },
};

ESLint sample

class Test {

  constructor() {
    this.memberExpression = 'member'; // good
    this.aFunc(); // wrong: should not be triggered
    const aVariable = 'variable'; // good
  }

  /**
   * @returns {void}
   */
  aFunc = () => {}
}

CLI sample

eslint myfile.js

Environment

  • Node version: 12.16.3
  • ESLint version: 6.8.0
  • eslint-plugin-jsdoc version: 30.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions