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

Fix: Handle multiline comments in parseWithComments #12845

Merged
merged 1 commit into from May 15, 2022

Commits on May 13, 2022

  1. Fix: Handle multiline comments in parseWithComments

    This problem was found while using prettier with pragmas enabled and I
    backtracked it to the `parseWithComments` function from jest-docblock.
    In this context it is especially problematic in cases were the top level
    comment is not formatted as a dock lock but a "multi-line comment" to
    disable an es-lint rule.
    
    /* eslint-disable @typescript-eslint/unbound-method */
    
    Especially given the fact that the `extract` function seems to handle
    this case correctly.
    
    Therefore this solution alters the commentStartRe to keep the second * as
    optional. This should ensure that all existing use cases work as expected
    with proper docblocks but also ensures that an "invalid" multiline comment
    works as well.
    
    Links:
    https://github.com/ullumullu/jest/blob/main/packages/jest-docblock/src/__tests__/index.test.ts#L29
    ssterb committed May 13, 2022
    Copy the full SHA
    749c24b View commit details
    Browse the repository at this point in the history