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: comment stripping should remove multiline comments (#279) #280

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cjpearson
Copy link

Resolves #279

@pi0
Copy link
Member

pi0 commented Oct 6, 2024

Thanks for the PR dear @cjpearson

Removing multi-line comments without AST awareness can be unsafe this is why we don't it.

See #56 for some context.

Until #219 arrives, if we can find similar solution to #56 i am open to it otherwise i would wait.

Copy link

codecov bot commented Oct 6, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.08%. Comparing base (226a47b) to head (c4ab502).
Report is 62 commits behind head on main.

Files with missing lines Patch % Lines
src/syntax.ts 91.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #280      +/-   ##
==========================================
- Coverage   88.04%   84.08%   -3.96%     
==========================================
  Files           8        8              
  Lines        1062      823     -239     
  Branches      188      201      +13     
==========================================
- Hits          935      692     -243     
- Misses        127      131       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cjpearson
Copy link
Author

Oh I didn't realize acorn was already in this package. I think that would be a much better way to handle comments. I'll take a look at that approach.

@cjpearson
Copy link
Author

I've tweaked the approach to use acorn rather than regular expressions for the comment stripping. My understanding is #219 will cover replacing ESM_RE and CJS_RE, so I made it so the change just affects comment stripping portion. Once #219 is done I suppose the comment stripping will be entirely unnecessary

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

Successfully merging this pull request may close these issues.

Multiline comments are not stripped
2 participants