-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add newline after hash comment in cache #354
base: main
Are you sure you want to change the base?
Conversation
Deployment failed with the following error:
|
WalkthroughThe pull request introduces modifications to the comment handling in the Changes
Assessment against linked issues
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
packages/unplugin-typia/tests/cache.spec.ts (2)
17-17
: The regex change looks correct but needs documentation.The modification to handle optional newlines after block comments is appropriate. However, this complex regex would benefit from documentation explaining its components.
Consider adding a comment explaining the regex:
+ // Removes both block comments (/* ... */) with optional newline and line comments (// ...): + // - \/\*[\s\S]*?\*\/\n? matches block comments with optional trailing newline + // - ([^\\:]|^)\/\/.* matches line comments not preceded by backslash or colon return data.replace(/\/\*[\s\S]*?\*\/\n?|([^\\:]|^)\/\/.*$/gm, '');
Line range hint
20-69
: Add test cases for newline handling.The current test suite doesn't explicitly verify the newline handling behaviour after comments. Consider adding specific test cases.
Here's a suggested test case:
it('handles newlines after block comments correctly', async () => { const input = wrap<Data>('/* comment */\nconst x = 1;'); const expected = wrap<Data>('\nconst x = 1;'); expect(removeComments(input)).toBe(expected); }); it('handles newlines after line comments correctly', async () => { const input = wrap<Data>('// comment\nconst x = 1;'); const expected = wrap<Data>('\nconst x = 1;'); expect(removeComments(input)).toBe(expected); });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/unplugin-typia/src/core/cache.ts
(1 hunks)packages/unplugin-typia/tests/cache.spec.ts
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/unplugin-typia/src/core/cache.ts
Fixes #353.
This change fixes my issue. Sorry for I can't provide reproduction. Feel free to close, but really helpful for me if you could merge this. Thank you.
Summary by CodeRabbit
Bug Fixes
Tests