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

jsdoc/require-jsdoc not always reporting on TypeAlias properties #852

Closed
SidduSomething opened this issue Mar 14, 2022 · 2 comments
Closed

Comments

@SidduSomething
Copy link

Expected behavior

When "TSPropertySignature" is added as one of the contexts for the jsdoc/require-jsdoc rule, it should always report missing JSDoc comments on properties inside Typescript TypeAlias definitions.

Actual behavior

The linter doesn't complain at property-level when the TypeAlias itself has JSDoc comments.

ESLint Config

Rule configuration:

    "jsdoc/require-jsdoc": [
      "warn",
      {
        "publicOnly": true,
        "require": {
          "ArrowFunctionExpression": true,
          "ClassDeclaration": true,
          "ClassExpression": true,
          "FunctionDeclaration": true,
          "FunctionExpression": true,
          "MethodDefinition": true
        },
        "contexts": [
          "TSTypeAliasDeclaration", // <-------
          "TSInterfaceDeclaration",
          "TSModuleDeclaration",
          "TSMethodSignature",
          "TSPropertySignature", // <-------
          "TSDeclareFunction",
          "TSEnumDeclaration",
          "ClassProperty[accessibility='public']",
          "ExportNamedDeclaration > VariableDeclaration"
        ]
      }
    ]

ESLint sample

Sample code where the missing JSDoc comment is not reported:

/** Alpha of all types */
export type Alpha = {
  one: string;
  two: number;
};

Screenshots with and without comment at the type-alias level, but NO comment at property level:

With comment Without comment
image image

Environment

  • Node version: v14.18.0
  • ESLint version: ^7.30.0
  • eslint-plugin-jsdoc version: ^37.9.6
@gajus
Copy link
Owner

gajus commented Mar 14, 2022

🎉 This issue has been resolved in version 38.0.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Mar 14, 2022
@SidduSomething
Copy link
Author

Thanks for the quick turn-around on this!

crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this issue Mar 18, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) | devDependencies | major | [`37.9.7` -> `38.0.4`](https://renovatebot.com/diffs/npm/eslint-plugin-jsdoc/37.9.7/38.0.4) |

---

### Release Notes

<details>
<summary>gajus/eslint-plugin-jsdoc</summary>

### [`v38.0.4`](https://github.com/gajus/eslint-plugin-jsdoc/releases/v38.0.4)

[Compare Source](gajus/eslint-plugin-jsdoc@v38.0.3...v38.0.4)

##### Bug Fixes

-   **`require-jsdoc`:** allow `TSTypeLiteral` and `TSTypeAliasDeclaration` to have `TSPropertySignature` checks pass through them toward public export for `publicOnly` checks; fixes [#&#8203;852](gajus/eslint-plugin-jsdoc#852) ([19e4f6f](gajus/eslint-plugin-jsdoc@19e4f6f))

### [`v38.0.3`](https://github.com/gajus/eslint-plugin-jsdoc/releases/v38.0.3)

[Compare Source](gajus/eslint-plugin-jsdoc@v38.0.2...v38.0.3)

##### Bug Fixes

-   **`valid-types`:** update `es-joy/jsdoccomment` ([5e8e0c7](gajus/eslint-plugin-jsdoc@5e8e0c7))

### [`v38.0.2`](https://github.com/gajus/eslint-plugin-jsdoc/releases/v38.0.2)

[Compare Source](gajus/eslint-plugin-jsdoc@v38.0.1...v38.0.2)

##### Bug Fixes

-   **`match-description`:** single empty line was not being reported ([ec34e66](gajus/eslint-plugin-jsdoc@ec34e66))

### [`v38.0.1`](https://github.com/gajus/eslint-plugin-jsdoc/releases/v38.0.1)

[Compare Source](gajus/eslint-plugin-jsdoc@v38.0.0...v38.0.1)

##### Bug Fixes

-   **`match-name`:** perform replacements for names appearing after multiline types ([a23168d](gajus/eslint-plugin-jsdoc@a23168d))

### [`v38.0.0`](https://github.com/gajus/eslint-plugin-jsdoc/releases/v38.0.0)

[Compare Source](gajus/eslint-plugin-jsdoc@v37.9.7...v38.0.0)

##### Bug Fixes

-   **`match-description`:** adjust default to allow for trailing whitespace but do check for such WS now ([a31a8fd](gajus/eslint-plugin-jsdoc@a31a8fd))

##### Features

-   **`tag-lines`:** add `dropEndLines` option; fixes [#&#8203;847](gajus/eslint-plugin-jsdoc#847) ([26c1c2c](gajus/eslint-plugin-jsdoc@26c1c2c))

##### BREAKING CHANGES

-   **`match-description`:** `match-description` regular expressions now need to take account for trailing whitespace

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1216
Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
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