-
Notifications
You must be signed in to change notification settings - Fork 72
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
Various small code fixes / type fixes #3313
Various small code fixes / type fixes #3313
Conversation
Thanks for the pull request, @bradenmacdonald! What's next?Please work through the following steps to get your changes ready for engineering review: 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:
When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
✅ Deploy Preview for paragon-openedx ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -145,7 +145,7 @@ You can use `Dropdown.Toggle` with [IconButton](/components/iconbutton) componen | |||
```jsx live | |||
<Dropdown.Deprecated> | |||
<Dropdown.Deprecated.Button> | |||
<Icon className="fa fa-user pr-3" alt="" /> | |||
<Icon className="fa fa-user pr-3" /> |
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.
<Icon>
does not accept an alt
prop. It accepts an optional screenReaderText
but it can be omitted for decorative icons, to emulate alt=""
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.
Good catch!
@@ -36,6 +36,8 @@ interface Props extends React.HTMLAttributes<HTMLButtonElement> { | |||
variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand'; | |||
/** size of button to render */ | |||
size?: 'sm' | 'md' | 'inline'; | |||
/** Used with `IconButtonToggle` */ | |||
value?: string; |
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.
As you can see in the docs, <IconButtonToggle>
requires its <IconButton>
children to accept a value
prop, but that wasn't defined in the prop types.
Fixed a type error:
Property 'value' does not exist on type 'IntrinsicAttributes & Pick<Pick<PropsWithTooltip, "variant" | "className" | "children" | "slot" | "style" | "title" | "size" | "defaultChecked" | ... 260 more ... | "tooltipContent"> & Pick<...> & Pick<...>, "tooltipContent"> & Partial<...> & Partial<...>'.
@@ -31,7 +31,7 @@ The standard `ModalDialog` composition. `StandardModal` passes all of its props | |||
footerNode={( | |||
<ActionRow> | |||
<p className="small"> | |||
<Hyperlink href="#">Get help</Hyperlink> | |||
<Hyperlink destination="#">Get help</Hyperlink> |
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.
Although this was working, the <Hyperlink>
component expects destination
as a prop, not href
.
@@ -36,7 +36,7 @@ export const isEveryPropDefined = (props, otherPropNames) => otherPropNames | |||
* Returns a PropType entry with the given propType that is required if otherPropName | |||
* is truthy. | |||
* @param {func} propType - target PropType | |||
* @param {string} otherPropName - string name for prop that, if true, marks the | |||
* @param {string | string[]} otherPropName - string name for prop that, if true, marks the |
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.
As you can see in the implementation below as well as how this function is used, this param accepts a string array.
@@ -105,7 +105,7 @@ class ListBoxWrapperForOnSelect extends React.Component { | |||
<span className="sr-only">none</span> | |||
) : ( | |||
<span | |||
arialabelledby={`list-box-option-${ | |||
aria-labelledby={`list-box-option-${ |
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.
Property 'arialabelledby' does not exist on type 'DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>'. Did you mean '"aria-labelledby"'?
isValid: false, | ||
validationMessage: 'Please make a selection.', | ||
}; | ||
} | ||
return feedback; | ||
return { isValid: true }; |
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.
This change (A) simplifies the validator function, making it a bit more clear, and (B) helps TypeScript avoid a type inference mistake: Object literal may only specify known properties, and 'validationMessage' does not exist in type '{ isValid: boolean; }'.
const [value, setValue] = useState(''); | ||
|
||
const handleChange = (e) => setValue(e.target.value); | ||
|
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.
Fixes: Block-scoped variable 'value' used before its declaration.
@@ -253,7 +253,7 @@ To enable proper selection behavior with backend pagination (i.e., when ``isSele | |||
</Component> | |||
); | |||
|
|||
const ClearAction = ({ as: Component, tableInstance, ...rest }) => ( | |||
const ClearAction = ({ as: Component, tableInstance }) => ( |
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 rest
parameter was unused.
Fixes: 'rest' is declared but its value is never read.
.slice(0, numParagraphs) | ||
.map(text => <p key={text}>{text}</p>); | ||
.map(text => <p key={text}>{text}</p>)}</>; |
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.
Fixes:
'HipsterIpsum' cannot be used as a JSX component.
Its return type 'Element[]' is not a valid JSX element.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3313 +/- ##
=======================================
Coverage 93.31% 93.31%
=======================================
Files 249 249
Lines 4441 4441
Branches 1014 1014
=======================================
Hits 4144 4144
Misses 294 294
Partials 3 3 ☔ View full report in Codecov by Sentry. |
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.
Overall this is looking great. I'm not sure what's going on with the linting errors in HipsterIpsum
(specifically why they're showing up as annotations on the diff but not failing the lint check)
Other than that this LGTM!
4567bd6
to
f940bd8
Compare
Weird. Yeah, I didn't even notice that check failure because of how it was showing up. Thanks for spotting it. I've rebased this and fixed the lint issues in |
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.
Thanks for clearing up the lint errors! This LGTM!
🎉 This PR is included in version 22.11.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 23.0.0-alpha.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
I created a script to run TypeScript type checking on all the MDX code examples in the docs, and it found these small issues. I will add inline comments to explain where helpful.
Deploy Preview
https://deploy-preview-3313--paragon-openedx.netlify.app/
Merge Checklist
n/a - no changes to how any of the Paragon components actually work or look.
Post-merge Checklist