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

feat: export RegExpSyntaxError #144

Merged
merged 6 commits into from
Oct 25, 2023
Merged

feat: export RegExpSyntaxError #144

merged 6 commits into from
Oct 25, 2023

Conversation

ArnaudBarre
Copy link

@ArnaudBarre ArnaudBarre commented Sep 24, 2023

This allows to safely access the index of the error in a try catch

@RunDevelopment
Copy link

This would also export the public constructor of RegExpSyntaxError, which takes the internal type RegExpValidatorSourceContext. So this PR would also indirectly export RegExpValidatorSourceContext (e.g. via ConstructorParameters<typeof RegExpSyntaxError>[0]).

@ota-meshi
Copy link
Member

Yeah, I think we need to change the constructor to a factory method and not export the factory method from index.ts.

like:

export class RegExpSyntaxError extends SyntaxError {
    public index: number
}

export function newRegExpSyntaxError(
      srcCtx: RegExpValidatorSourceContext,
      flags: { unicode: boolean; unicodeSets: boolean },
      index: number,
      message: string,
  ): RegExpSyntaxError {
  // ...
}

@ota-meshi ota-meshi changed the title Export RegExpSyntaxError feat: export RegExpSyntaxError Sep 26, 2023
@MichaelDeBoey MichaelDeBoey changed the title feat: export RegExpSyntaxError feat: export RegExpSyntaxError Sep 26, 2023
@ArnaudBarre
Copy link
Author

Sorry the delay, I've updated the PR

src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

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

LGTM!

@MichaelDeBoey MichaelDeBoey merged commit 2e8f1af into eslint-community:main Oct 25, 2023
14 checks passed
@github-actions
Copy link

🎉 This PR is included in version 4.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants