Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiline object types with indentation are not detected properly #686

Closed
simonseyock opened this issue Jan 31, 2021 · 3 comments
Closed

Comments

@simonseyock
Copy link
Contributor

simonseyock commented Jan 31, 2021

Initially filed in jsdoctypeparser/jsdoctypeparser#132

Expected behavior

Multiline object types should get recognized if they use indentation.

Actual behavior

require-param-description does give an error because the type is not parsed correctly

ESLint Config

{
  env: {
    es6: true
  },
  plugins: ['jsdoc'],
  rules: {
    "jsdoc/check-indentation": 'off',
    "jsdoc/require-param-description": 'error'
  }
}

ESLint sample

  /**
   * Checks if the XML document sort of equals another XML document.
   * @param {Object} obj The other object.
   * @param {{includeWhiteSpace: (boolean|undefined),
   *    ignoreElementOrder: (boolean|undefined)}} [options] The options.
   * @return {expect.Assertion} The assertion.
   */
  expect.Assertion.prototype.xmleql = function (obj, options) {
    if (obj && obj.nodeType == 9) {
      obj = obj.documentElement;
    }
    if (this.obj && this.obj.nodeType == 9) {
      this.obj = this.obj.documentElement;
    }
    const errors = [];
    assertElementNodesEqual(obj, this.obj, options, errors);
    const result = errors.length === 0;
    this.assert(
      !!result,
      function () {
        return (
          'expected ' +
          expect.stringify(this.obj) +
          ' to sort of equal ' +
          expect.stringify(obj) +
          '\n' +
          errors.join('\n')
        );
      },
      function () {
        return (
          'expected ' +
          expect.stringify(this.obj) +
          ' to sort of not equal ' +
          expect.stringify(obj) +
          '\n' +
          errors.join('\n')
        );
      }
    );
    return this;
  };

Environment

  • Node version: v14.15.4
  • ESLint version: v6.14.10
  • eslint-plugin-jsdoc version: v31.6.0
@simonseyock
Copy link
Contributor Author

About the eslint version there is something a little strange maybe:
npm bin/eslint -v returns 6.14.10
node_modules/.bin/eslint -v returns v7.18.0

@brettz9
Copy link
Collaborator

brettz9 commented Feb 1, 2021

Seems this is, at least in part, due to syavorsky/comment-parser#121 , so we're blocking on that for now. This may impact other issues as well (as we've applied the latest update to that parser which gives us other advantages such as being able to preserve whitespace while doing fixing).

@gajus
Copy link
Owner

gajus commented Feb 7, 2021

🎉 This issue has been resolved in version 31.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants