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

Version v37.9.2 breaks ESLint when using jsdoc/no-restricted-syntax rule #842

Closed
macku opened this issue Feb 18, 2022 · 2 comments
Closed

Comments

@macku
Copy link

macku commented Feb 18, 2022

After trying to upgrade eslint-plugin-jsdoc to the latest version 37.9.2, our CI started failing with an ESLint error.
Change: https://bitbucket.org/atlassian/atlassian-browser-devtools/pull-requests/201

The failure is related to a custom check defined for jsdoc/no-restricted-syntax rule I think.

After removing the custom no-restricted-syntax rule from the eslintrc file, the ESLint is no longer breaking.

Expected behavior

The ESLint should work without an error.

Actual behavior

ESLint is throwing an error:

Oops! Something went wrong! :(
ESLint: 8.9.0
Error: Unexpected type: 'JsdocTypeVariadic'.
Occurred while linting /opt/atlassian/pipelines/agent/build/src/common/sentry/sentry.js:41
  Rule: "jsdoc/no-restricted-syntax"
    at Object.parseInfix (/opt/atlassian/pipelines/agent/build/node_modules/jsdoc-type-pratt-parser/dist/index.js:1098:31)
    at keyValueParslet (/opt/atlassian/pipelines/agent/build/node_modules/jsdoc-type-pratt-parser/dist/index.js:467:40)
    at Parser.tryParslets (/opt/atlassian/pipelines/agent/build/node_modules/jsdoc-type-pratt-parser/dist/index.js:368:32)
    at Parser.parseInfixIntermediateType (/opt/atlassian/pipelines/agent/build/node_modules/jsdoc-type-pratt-parser/dist/index.js:391:34)
    at Parser.parseIntermediateType (/opt/atlassian/pipelines/agent/build/node_modules/jsdoc-type-pratt-parser/dist/index.js:384:25)
    at Object.parsePrefix (/opt/atlassian/pipelines/agent/build/node_modules/jsdoc-type-pratt-parser/dist/index.js:530:35)
    at parenthesisParslet (/opt/atlassian/pipelines/agent/build/node_modules/jsdoc-type-pratt-parser/dist/index.js:460:40)
    at Parser.tryParslets (/opt/atlassian/pipelines/agent/build/node_modules/jsdoc-type-pratt-parser/dist/index.js:368:32)
    at Parser.parseIntermediateType (/opt/atlassian/pipelines/agent/build/node_modules/jsdoc-type-pratt-parser/dist/index.js:380:33)
    at Parser.parseType (/opt/atlassian/pipelines/agent/build/node_modules/jsdoc-type-pratt-parser/dist/index.js:361:42)

source: https://bitbucket.org/atlassian/atlassian-browser-devtools/addon/pipelines/home#!/results/876/steps/%7B97ecf3dc-a9d3-48c4-9e72-fdd5c2ffabb4%7D

ESLint Config

    'jsdoc/no-restricted-syntax': [
      'error',
      {
        contexts: [
          {
            comment: 'JsdocBlock:has(JsdocTag[tag="type"]:has([value=/FunctionComponent/]))',
            context: 'any',
            message: 'The `FunctionComponent` type is not allowed. Please use `FC` instead.',
          },
        ],
      },
    ],

source: https://bitbucket.org/atlassian/atlassian-browser-devtools/src/master/.eslintrc.js

ESLint sample

/**
 * @param {(...args: any[]) => any} fn
 * @returns {(...args: any[]) => any}
 */

source: https://bitbucket.org/atlassian/atlassian-browser-devtools/src/6260795c608bdf6f540b72d0f8de453b320d6fcd/src/common/sentry/sentry.js#lines-35:40

Environment

  • Node version: 16
  • ESLint version 8.9.0
  • eslint-plugin-jsdoc version: 37.9.2
@gajus
Copy link
Owner

gajus commented Feb 18, 2022

🎉 This issue has been resolved in version 37.9.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Feb 18, 2022
@brettz9
Copy link
Collaborator

brettz9 commented Feb 18, 2022

Thanks for the report. Thought we could avoid catching type parsing errors in jsdoccomment, but as a result of this, I'm reminded that we still have valid types which jsdoc-type-pratt-parser has yet to be able to parse (like the variadic in that context you supplied). Fixed.

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

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

---

### Release Notes

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

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

[Compare Source](gajus/eslint-plugin-jsdoc@v37.9.3...v37.9.4)

##### Bug Fixes

-   **`require-jsdoc`:** avoid class jsdoc blocks suppressing errors for `PropertyDefinition`; fixes [#&#8203;841](gajus/eslint-plugin-jsdoc#841) ([ef68427](gajus/eslint-plugin-jsdoc@ef68427))

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

[Compare Source](gajus/eslint-plugin-jsdoc@v37.9.2...v37.9.3)

##### Bug Fixes

-   **`no-restricted-syntax`, `no-missing-syntax`:** update jsdoccomment to avoid breaking on bad types (at least until jsdoc-type-pratt-parser may support all expected); fixes [#&#8203;842](gajus/eslint-plugin-jsdoc#842) ([06c3163](gajus/eslint-plugin-jsdoc@06c3163))

</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/1180
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