gajus / eslint-plugin-jsdoc

JSDoc specific linting rules for ESLint.
Other
1.07k stars 155 forks source link

jsdoc/valid-types for "is" property #1221

Closed dysphasia closed 3 months ago

dysphasia commented 3 months ago

Expected behavior

Defining a property or param named is should be allowed.

Actual behavior

When defining a param or property named is, the linter reports an error for the rule jsdoc/valid-types.

ESLint Config

{
  "env": {
    "es2021": true
  },
  "extends": [
    "eslint:recommended"
  ],
  "plugins": [
    "jsdoc"
  ],
  "parserOptions": {
    "sourceType": "module",
    "ecmaVersion": "latest"
  },
  "rules": {
    "jsdoc/valid-types": 2
  }
}

ESLint sample

/**
 * @param {string} is
 * @param {string} foo
 * 
 * @returns {string}
 */
export default function (is, foo) {
    return is + foo;
}

I've also created a project that reproduces the issue on codesandbox.io:

https://codesandbox.io/p/devbox/festive-sun-g23dhw-y3vs47

Screenshot 2024-04-04 at 12 47 57 PM

Environment

github-actions[bot] commented 3 months ago

:tada: This issue has been resolved in version 48.2.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

brettz9 commented 3 months ago

The fix in #1222 doesn't handle nested use of the keyword. For that, one has to escape with quotation marks.