-
Notifications
You must be signed in to change notification settings - Fork 235
resolve linting error by migrating custom components to typescript #2188
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR migrates custom React components from JavaScript to TypeScript to resolve linting errors as part of issue #1646. The migration involves converting .js files to .tsx files, removing PropTypes in favor of TypeScript types, and updating function syntax to use function declarations.
Changes:
- Converted four JavaScript components to TypeScript with inline prop type definitions
- Updated two existing TypeScript components to use function declarations and ReactNode return types
- Replaced deprecated PropTypes with TypeScript type annotations
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/YouTube/index.tsx | New TypeScript YouTube embed component with inline prop types |
| src/components/YouTube.js | Deleted JavaScript version of YouTube component |
| src/components/RedirectPage.tsx | New TypeScript redirect component with inline prop types |
| src/components/RedirectPage.js | Deleted JavaScript version of RedirectPage component |
| src/components/CodeExample.tsx | New TypeScript code example component (needs prop types) |
| src/components/CodeExample.js | Deleted JavaScript version of CodeExample component |
| src/components/WrapperApiReference.tsx | Updated to function declaration with ReactNode return type (needs prop types) |
| src/components/EndpointsTable.tsx | Updated to function declaration with ReactNode return type (needs prop types) |
| src/components/AttributeTable/index.tsx | Updated with ReactNode return type (needs prop types) |
| src/components/AttributeTable/ListItem/index.js | Deleted JavaScript version of ListItem component |
Comments suppressed due to low confidence (5)
src/components/WrapperApiReference.tsx:14
- The function parameters 'children' and 'props' are missing type annotations. In TypeScript, all function parameters must have explicit types. Consider defining a proper interface for the component props.
src/components/EndpointsTable.tsx:13 - The function parameters 'children' and 'title' are missing type annotations. In TypeScript, all function parameters must have explicit types. Consider defining a proper interface for the component props, especially since 'title' has a default value.
src/components/EndpointsTable.tsx:17 - Inconsistent use of semicolon after the function declaration. The function uses a semicolon after the closing brace on line 17, which is inconsistent with JavaScript/TypeScript conventions for function declarations. Function declarations typically don't require trailing semicolons.
src/components/AttributeTable/index.tsx:6 - The 'children' parameter is missing a type annotation. In TypeScript, all function parameters must have explicit types. Consider defining a proper interface for the component props.
src/components/AttributeTable/index.tsx:15 - The map function is being used but its return value is not being used. This is a code smell - map should be used when you want to transform an array and use the result. Since the code is using map only for its side effect (pushing to renderArray), consider using forEach instead, which more clearly expresses the intent of iterating for side effects.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { CODE_LANGS } from "@site/config/constants"; | ||
| import Translate from '@docusaurus/Translate'; | ||
|
|
||
| export function CodeExample({ children }): ReactNode { |
Copilot
AI
Jan 20, 2026
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.
The function parameter 'children' is missing a type annotation. TypeScript requires explicit types for all function parameters. Consider adding a type annotation such as { children } or defining a proper interface for the props.
| export function CodeExample({ children }): ReactNode { | |
| export function CodeExample({ children }: { children: ReactNode }): ReactNode { |
|
Preview is available here: |
1 similar comment
|
Preview is available here: |
Fixes #1646