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

Docs-tools: Replace doctrine with jsdoc-type-pratt-parser #26305

Merged
merged 12 commits into from
Jun 10, 2024

Conversation

43081j
Copy link
Contributor

@43081j 43081j commented Mar 4, 2024

This removes doctrine and assert from the docs-tools package.

The type of a parsed JSDoc comment will now be a RootResult from the jsdoc-type-pratt-parser package rather than a doctrine Type.

Other than that, existing behaviour should remain.

@shilman is this what you had in mind in #26276?

A question for maintainers: this will of course change the type we expose on an ExtractedJsDocParam. There's not a lot we can do about that since it used to be doctrine's Type, and I don't think we should try map back to the old model (it isn't simple). Do you know what consumes that property? is it a breaking change?


Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

None yet, as I wasn't sure the best way to manually prove out the various possible JSDoc types.

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

This removes doctrine and `assert` from the docs-tools package.

The `type` of a parsed JSDoc comment will now be a `RootResult` from the
`jsdoc-type-pratt-parser` package rather than a doctrine `Type`.

Other than that, existing behaviour should remain.
@@ -101,20 +101,10 @@
"name": "case13",
"table": {
"defaultValue": null,
"jsDocTags": {
Copy link
Contributor Author

@43081j 43081j Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one has disappeared because the source has no name:

  /**
   * param with type
   * @param {SyntheticEvent}
   */
  case13: PropTypes.func,

in the old source, this code looks like it should've caught that and returned null:

  const paramName = tag.name;

  // When the @param doesn't have a name but have a type and a description, "null-null" is returned.
  if (paramName != null && paramName !== 'null-null') {

my guess is, at some point, doctrine stopped giving us null-null as a special value? so the branch has been passing?

the new source does the same check:

  if (!tag.name || tag.name === '-') {
    return null;
  }

so i'm not sure. the same "empty name" check now succeeds so we get null correctly

@shilman shilman added maintenance User-facing maintenance tasks addon: docs ci:normal labels Mar 7, 2024
@shilman
Copy link
Member

shilman commented Mar 7, 2024

This is amazing @43081j, thanks so much !!! We are just a few days from releasing 8.0, so we're going to punt this until 8.1. It's technically a breaking change, but it's an undocumented API so I discussed with the team and we'd rather take a little more time than risk delaying or borking 8.0. Will review properly and merge it into 8.1 as soon as the dust has settled.

@shilman shilman changed the title feat: remove doctrine Docs-tools: Replace doctrine with jsdoc-type-pratt-parser Mar 7, 2024
@43081j
Copy link
Contributor Author

43081j commented Mar 7, 2024

All good, that makes sense to me too

Let me know if you need any help once you get around to that 8.1 merge

@ndelangen ndelangen self-assigned this Mar 11, 2024
Copy link

nx-cloud bot commented Mar 11, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit e20977a. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@ndelangen ndelangen added ci:daily Run the CI jobs that normally run in the daily job. ci:normal and removed ci:normal labels Mar 12, 2024
@ndelangen ndelangen requested a review from shilman March 12, 2024 14:34
@ndelangen ndelangen assigned shilman and unassigned ndelangen Mar 26, 2024
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@43081j Looks like this wound up in my lap at some point but I missed it. Changes look great and I have approved. We're releasing 8.1 in the next day or two and then I will merge as soon as we get that out. Thanks for your patience on this!

@43081j
Copy link
Contributor Author

43081j commented May 13, 2024

no worries, thanks for taking a look

let me know if you need any help with anything 👍

@shilman shilman removed the ci:daily Run the CI jobs that normally run in the daily job. label Jun 10, 2024
@shilman shilman added ci:daily Run the CI jobs that normally run in the daily job. and removed ci:normal labels Jun 10, 2024
@shilman shilman merged commit 2cbf3a7 into storybookjs:next Jun 10, 2024
109 of 110 checks passed
@github-actions github-actions bot mentioned this pull request Jun 10, 2024
12 tasks
@43081j 43081j deleted the doctrineless branch June 10, 2024 10:04
@valentinpalkovic valentinpalkovic added the needs qa Indicates that this needs manual QA during the upcoming minor/major release label Jul 5, 2024
@ghengeveld ghengeveld added needs qa Indicates that this needs manual QA during the upcoming minor/major release and removed needs qa Indicates that this needs manual QA during the upcoming minor/major release labels Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: docs ci:daily Run the CI jobs that normally run in the daily job. maintenance User-facing maintenance tasks needs qa Indicates that this needs manual QA during the upcoming minor/major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants