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: ConfigProvider support config warning level #44809

Merged
merged 4 commits into from Sep 13, 2023
Merged

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Sep 13, 2023

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

ref #44551

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English ConfigProvider support warning to config warning log level (like filter deprecated warning).
🇨🇳 Chinese ConfigProvider 支持 warning 属性以配置警告等级(如过滤掉废弃 API 警告)。

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

🤖 Generated by Copilot at e57eb6e

This pull request adds a new feature to the ConfigProvider component that allows users to control the warning level for deprecated or breaking changes in the ant-design components. It also updates the documentation, tests, and demos for the feature and modifies the warning type for the icon prop change in the Avatar component.

🔍 Walkthrough

🤖 Generated by Copilot at e57eb6e

  • Enable warning feature for ConfigProvider component to control the level of deprecation warnings (F0,F6,F7,F5)
    • Import resetWarned function from rc-util/lib/warning and rename it as rcResetWarned to avoid conflict with custom resetWarned function (link)
    • Change WarningContextProps interface to use strict instead of deprecated as property name (link)
    • Modify typeWarning function to aggregate deprecated warnings based on strict property from warning context and use global variable deprecatedWarnList to store and print deprecated warnings once (link)
    • Add warning property to ConfigProviderProps interface to allow users to pass warning level configuration (link)
    • Destructure warning property from props object and include it in memoedConfig object (link,link)
    • Uncomment code for creating and rendering WarningContext provider with memoedConfig.warning value (link,link)
    • Add warning property to API sections of English and Chinese documentation for ConfigProvider component and describe its type, default value and version (link,link)
    • Add code examples for warning feature to examples sections of English and Chinese documentation for ConfigProvider component and reference demo files (link,link)
  • Change type argument of typeWarning function call in Avatar component from deprecated to breaking to reflect severity of change in icon prop (link)
  • Import resetWarned function from ../_util/warning in test file for ConfigProvider component and reset global variable deprecatedWarnList before each test case (link)
  • Add test case for warning support for ConfigProvider component and mock and restore console.error and console.warn methods to spy on calls (link)
  • Change order of imports in usage sections of English and Chinese documentation for ConfigProvider component to follow convention of importing React first and then other modules (link,link)

@stackblitz
Copy link

stackblitz bot commented Sep 13, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 13, 2023

Copy link
Member

@MadCcc MadCcc left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
./dist/antd.min.js 393.67 KB (+44 B 🔺)
./dist/antd-with-locales.min.js 452.87 KB (+79 B 🔺)

@argos-ci
Copy link

argos-ci bot commented Sep 13, 2023

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 3 changes Sep 13, 2023, 3:18 AM

@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (3596c88) 100.00% compared to head (a9c2de2) 100.00%.
Report is 17 commits behind head on feature.

Additional details and impacted files
@@            Coverage Diff             @@
##           feature    #44809    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          680       681     +1     
  Lines        11427     11542   +115     
  Branches      3073      3111    +38     
==========================================
+ Hits         11427     11542   +115     
Files Changed Coverage Δ
components/_util/ActionButton.tsx 100.00% <ø> (ø)
components/checkbox/index.ts 100.00% <ø> (ø)
components/config-provider/context.ts 100.00% <ø> (ø)
components/descriptions/style/index.ts 100.00% <ø> (ø)
components/input/style/index.ts 100.00% <ø> (ø)
components/modal/components/NormalOkBtn.tsx 100.00% <ø> (ø)
components/popconfirm/PurePanel.tsx 100.00% <ø> (ø)
components/progress/utils.ts 100.00% <ø> (ø)
components/radio/index.ts 100.00% <ø> (ø)
components/table/style/selection.ts 100.00% <ø> (ø)
... and 71 more

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

@zombieJ zombieJ merged commit b3428c6 into feature Sep 13, 2023
87 checks passed
@zombieJ zombieJ deleted the warning-filter branch September 13, 2023 03:49
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.

None yet

2 participants