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

chore: replace local prettier plugin with npm package #2603

Merged
merged 5 commits into from
Sep 20, 2024

Conversation

Alex-huxiyang
Copy link
Collaborator

@Alex-huxiyang Alex-huxiyang commented Sep 19, 2024

将workspace的format插件发布npm,去掉本地相关冗余代码。

Summary by CodeRabbit

  • 新特性
    • 更新了Markdown表格的格式化支持,替换了旧的插件。
  • 变更
    • 从依赖中移除了@nutui/prettier-plugin,添加了prettier-markdown-table
    • 更新了lint-staged配置,Markdown文件不再进行ESLint检查。

Copy link

coderabbitai bot commented Sep 19, 2024

Walkthrough

此次更改主要涉及对项目的格式化和 linting 配置的调整。在 .prettierrc 文件中,移除了 @nutui/prettier-plugin 插件,并添加了 prettier-markdown-table 插件,以增强对 Markdown 表格的处理能力。同时,package.json 文件的 lint-staged 配置已更新,以排除 Markdown 文件的 ESLint 检查,专注于 TypeScript 和 JavaScript 文件。这些更改还包括删除与 @nutui/prettier-plugin 相关的多个文件。

Changes

文件路径 更改摘要
.prettierrc 移除 @nutui/prettier-plugin,添加 prettier-markdown-table
package.json 更新 lint-staged 配置以排除 Markdown 文件,移除 @nutui/prettier-plugin,添加 prettier-markdown-table 依赖。
packages/nutui-prettier-plugin/index.js 删除自定义 Markdown 表格格式化实现,包括语言、解析器和打印器的导出。
packages/nutui-prettier-plugin/package.json 删除 @nutui/prettier-plugin 的包配置文件。
plugins/table-format.mjs 删除自定义 Markdown 表格打印实现,包括语言、解析器和打印器的导出。

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Prettier
    participant MarkdownTablePlugin

    User->>Prettier: Format Markdown
    Prettier->>MarkdownTablePlugin: Use new table formatting
    MarkdownTablePlugin-->>Prettier: Return formatted table
    Prettier-->>User: Display formatted Markdown
Loading

Suggested labels

size/XS

Poem

🐰 在草地上跳跃欢快的兔,
新插件来临,格式更美丽。
Markdown 表格,整齐如新,
Linting 轻松,代码更清晰。
让我们一起庆祝这变化,
快乐的兔子,舞动不停息! 🎉


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6b87265 and d5c2e35.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (5)
  • .prettierrc (1 hunks)
  • package.json (2 hunks)
  • packages/nutui-prettier-plugin/index.js (0 hunks)
  • packages/nutui-prettier-plugin/package.json (0 hunks)
  • plugins/table-format.mjs (0 hunks)
Files not reviewed due to no reviewable changes (3)
  • packages/nutui-prettier-plugin/index.js
  • packages/nutui-prettier-plugin/package.json
  • plugins/table-format.mjs
Additional comments not posted (3)
.prettierrc (1)

9-9: 确认新插件满足项目需求

@nutui/prettier-plugin 替换为 prettier-markdown-table 可能会影响项目的代码格式化规则。请确保新插件能够完全覆盖原插件的功能,特别是与项目代码风格相关的部分,以避免格式化风格的不一致。

运行以下脚本以验证代码库中是否仍然引用了 @nutui/prettier-plugin

Verification successful

插件更改已正确实施,无需进一步操作

经过详细验证,我们可以确认:

  • 'prettier-markdown-table' 插件已成功添加到项目中。
  • '@nutui/prettier-plugin' 已被完全移除,没有遗留引用。
  • 项目中的其他 Prettier 相关配置未受到这次更改的影响。

这个更改看起来是正确的,并且不会对现有的代码格式化规则产生负面影响。新插件已经正确集成到项目中,可以放心使用。

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:检查代码库中是否仍然引用了 `@nutui/prettier-plugin`

# 测试:搜索 `@nutui/prettier-plugin` 的引用。预期:没有找到匹配结果。

rg '@nutui/prettier-plugin'

Length of output: 27


Script:

#!/bin/bash
# 描述:全面检查Prettier插件的更改

# 1. 搜索 'prettier-markdown-table' 的引用
echo "搜索 'prettier-markdown-table' 的引用:"
rg 'prettier-markdown-table'

# 2. 使用不区分大小写的搜索再次检查 '@nutui/prettier-plugin' 的引用
echo -e "\n使用不区分大小写的搜索检查 '@nutui/prettier-plugin' 的引用:"
rg -i '@nutui/prettier-plugin'

# 3. 查找其他与Prettier相关的配置
echo -e "\n查找其他与Prettier相关的配置:"
rg 'prettier' --type json --type js

Length of output: 1165

package.json (2)

94-94: 确认 Markdown 文件的 Lint 需求

lint-staged 配置中,已将 Markdown 文件从 ESLint 检查中移除。如果您的项目中 Markdown 文件包含嵌入的代码块,建议确认是否需要对这些代码进行 Lint 检查,以保持代码质量。


121-121: 添加 prettier-markdown-table 依赖

成功添加了 prettier-markdown-table 依赖,用于优化 Markdown 表格的格式化处理。这将提升 Markdown 文档的可读性与一致性。请确保在 Prettier 配置中正确引用该插件。


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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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

codecov bot commented Sep 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.11%. Comparing base (6b87265) to head (d5c2e35).
Report is 3 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #2603   +/-   ##
=======================================
  Coverage   83.11%   83.11%           
=======================================
  Files         218      218           
  Lines       17817    17817           
  Branches     2545     2545           
=======================================
  Hits        14809    14809           
  Misses       3003     3003           
  Partials        5        5           

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

@oasis-cloud oasis-cloud merged commit 464f2cc into jdf2e:next Sep 20, 2024
5 checks passed
@Alex-huxiyang Alex-huxiyang deleted the hxy/removePackage/919 branch November 19, 2024 10:44
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.

2 participants