gajus / eslint-plugin-jsdoc

JSDoc specific linting rules for ESLint.
Other
1.09k stars 157 forks source link

`jsdoc/require-returns` does not recognize synonymous tags or preferences #1129

Closed scottmmjackson closed 1 year ago

scottmmjackson commented 1 year ago

https://jsdoc.app/tags-returns.html

Expected behavior

@return should either be acceptable or configurable as a preferred form of @returns. Some IDEs (notably IDEA) will autocomplete @return, and some Java teams will prefer this as well.

Actual behavior

/**
 * My function.
 *
 * @return {string} Hello.
 */
function myFunction() { return "hello"; }

produces a jsdoc/require-returns error.

ESLint Config

{
  "extends": [
    "plugin:jsdoc/recommended"
  ],
}

ESLint sample

See above

Environment

brettz9 commented 1 year ago

This is possible via settings:

      settings: {
        jsdoc: {
          tagNamePreference: {
            returns: 'return',
          },
        },
      },

Closing as that should resolve, though feel free to comment further as needed.