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: should inspect reserved_words after preset_env #1367

Merged
merged 2 commits into from
Jul 10, 2024

Conversation

Jinbao1001
Copy link
Member

@Jinbao1001 Jinbao1001 commented Jul 3, 2024

在 preset_env 后执行了 swc 的保留字检查

Summary by CodeRabbit

  • 新功能
    • 在应用程序中添加了一个新的对象 a,它包含一个默认类定义。
  • 测试
    • 添加了检查,确保内容不包含字符串“function default”。

Copy link
Contributor

coderabbitai bot commented Jul 3, 2024

Walkthrough

这些变更主要涉及三个方面:在 mako crate 中的 transform.rs 文件中,增加了一个新的导入,并在 Transform 实现中使用了 reserved_words; 在 e2e 文件夹中的两处文件,增加了对 config.targets 的新的期望检测和新的对象创建。

Changes

文件路径 变更摘要
crates/mako/src/build/transform.rs 新增 import swc_core::ecma::transforms::compat::reserved_words 并在 Transform 实现中添加了 folders.push(Box::new(reserved_words::reserved_words()));
e2e/fixtures/config.targets/expect.js 增加了一项检查以确保内容不包含字符串 "function default"
e2e/fixtures/config.targets/src/index.tsx 新增了一个包含默认类定义的对象 a

Poem

代码变化如春风,
新功能在此诞生。
期望检测如星明,
对象创建成体系。
共庆代码日日新,
百尺竿头步步升。 🌟

Tip

AI model upgrade

gpt-4o model for reviews and chat is now live

OpenAI claims that this model is better at understanding and generating code than the previous models. Please join our Discord Community to provide any feedback or to report any issues.


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 06b1b5e and 79e161b.

Files selected for processing (3)
  • crates/mako/src/build/transform.rs (2 hunks)
  • e2e/fixtures/config.targets/expect.js (1 hunks)
  • e2e/fixtures/config.targets/src/index.tsx (1 hunks)
Additional comments not posted (5)
e2e/fixtures/config.targets/src/index.tsx (2)

3-3: LGTM!

空行没有问题。


5-9: 请确保新对象 a 的用途明确

对象 a 的初始化看起来是正确的,但从上下文中不清楚其用途。请确保在代码的其他部分有明确的用途说明。

e2e/fixtures/config.targets/expect.js (1)

12-16: 请确保正则表达式模式正确

新的断言似乎放置正确,但请确保正则表达式模式 function default\\( 是准确的。

crates/mako/src/build/transform.rs (2)

13-13: 请确保 reserved_words 函数的使用是正确的

导入语句看起来是正确的,但请确保 reserved_words 函数在代码中的使用是正确的。


181-181: 请确保添加 reserved_words 不会引入问题

reserved_words 函数添加到 folders 集合中的用法看起来是正确的,但请确保此更改不会引入任何问题。

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 79e161b and 365f63f.

Files selected for processing (2)
  • e2e/fixtures/config.targets/expect.js (2 hunks)
  • e2e/fixtures/config.targets/src/index.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • e2e/fixtures/config.targets/expect.js
  • e2e/fixtures/config.targets/src/index.tsx

@sorrycc
Copy link
Member

sorrycc commented Jul 3, 2024

只解 let a = { default : class {}} 的问题吗?还是还有其他啥场景?建议多补几个。

@Jinbao1001 Jinbao1001 merged commit ea2376b into master Jul 10, 2024
8 checks passed
@afc163 afc163 deleted the fix/reserved_words branch July 10, 2024 10:29
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.

3 participants