refactor: improve code quality with component extraction and type safety#11453
refactor: improve code quality with component extraction and type safety#11453meetp90 wants to merge 3 commits into
Conversation
This commit includes four refactoring improvements to enhance code maintainability and type safety: 1. Extract TabListItem component - Moved inline list item JSX to separate TabListItem component - Improves code organization and testability - File: packages/docusaurus-theme-classic/src/theme/Tabs/TabListItem.tsx 2. Make TOC highlight selectors configurable - Added headingAnchorClassName and navbarSelector to TOCHighlightConfig - Removes hardcoded class dependencies for better theme customization - File: packages/docusaurus-theme-common/src/hooks/useTOCHighlight.ts 3. Improve NavbarItem types with discriminated unions - Replaced loose type definition with proper discriminated unions - Better type safety, autocomplete, and compile-time error detection - File: packages/docusaurus-theme-common/src/utils/useThemeConfig.ts 4. Use path.posix.relative() in sidebar generator - Replaced manual string manipulation with Node.js built-in utility - Better maintainability and correctness - File: packages/docusaurus-plugin-content-docs/src/sidebars/generator.ts All changes are backward compatible and all existing tests pass.
|
Hi @meetp90! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
This commit includes four refactoring improvements to enhance code maintainability and type safety: 1. Extract TabListItem component - Moved inline list item JSX to separate TabListItem component - Improves code organization and testability - File: packages/docusaurus-theme-classic/src/theme/Tabs/TabListItem.tsx 2. Make TOC highlight selectors configurable - Added headingAnchorClassName and navbarSelector to TOCHighlightConfig - Removes hardcoded class dependencies for better theme customization - File: packages/docusaurus-theme-common/src/hooks/useTOCHighlight.ts 3. Improve NavbarItem types with discriminated unions - Replaced loose type definition with proper discriminated unions - Better type safety, autocomplete, and compile-time error detection - File: packages/docusaurus-theme-common/src/utils/useThemeConfig.ts 4. Use path.posix.relative() in sidebar generator - Replaced manual string manipulation with Node.js built-in utility - Better maintainability and correctness - File: packages/docusaurus-plugin-content-docs/src/sidebars/generator.ts All changes are backward compatible and all existing tests pass.
…om/meetp90/docusaurus into refactor/code-quality-improvements
c0fa1d7 to
135f6ff
Compare
slorber
left a comment
There was a problem hiding this comment.
You say it improves but I don't see any clear improvement.
If you want to start contributing, submit one change at a time, exlains in depth how it improves things exactly, don't use AI, and don't do this just for Hacktoberfest but because you actually use the project and encounter a limitation within it.
This commit includes four refactoring improvements to enhance code maintainability and type safety:
Extract TabListItem component
Make TOC highlight selectors configurable
Improve NavbarItem types with discriminated unions
Use path.posix.relative() in sidebar generator
All changes are backward compatible and all existing tests pass.
Pre-flight checklist
Motivation
Test Plan
Test links
Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/
Related issues/PRs