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

Created on 21 Jul 2020  路  2Comments  路  Source: gajus/eslint-plugin-jsdoc

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
question

All 2 comments

It seems you want: *:not(CallExpression) > MemberExpression (and remove CallExpression:not(*) and MemberExpression).

Right @brettz9 thank you !
I'm sorry you can close this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hipstersmoothie picture hipstersmoothie  路  3Comments

rasenplanscher picture rasenplanscher  路  3Comments

lgaticaq picture lgaticaq  路  6Comments

michaelfarrell76 picture michaelfarrell76  路  4Comments

zhaparoff picture zhaparoff  路  3Comments