Skip to content

Commit c5c48aa

Browse files
bradenmacdonaldbrian-smith-tcril
authored andcommitted
chore: minor example/typescript/eslint updates for React 18 bump
1 parent 0727de6 commit c5c48aa

File tree

8 files changed

+14
-6
lines changed

8 files changed

+14
-6
lines changed

example/.eslintrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
extends: [
3+
'@edx/eslint-config',
4+
],
5+
root: true, // Don't also import the paragon eslint config in the parent directory.
6+
};

example/src/MyComponent.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
22
import { Button, Form, Icon, Bubble, Stack, Container } from '@openedx/paragon'; // eslint-disable-line
33
import { FavoriteBorder } from '@openedx/paragon/icons'; // eslint-disable-line
44

5-
const MyComponent = () => {
5+
function MyComponent() {
66
const [value, setValue] = useState('');
77
const handleChange = (e) => setValue(e.target.value);
88
const handleClick = () => alert('Form is submitted!'); // eslint-disable-line no-alert
@@ -26,6 +26,6 @@ const MyComponent = () => {
2626
</Form>
2727
</Container>
2828
);
29-
};
29+
}
3030

3131
export default MyComponent;

example/src/index.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import 'core-js/stable';
2-
import 'regenerator-runtime/runtime';
3-
41
import React from 'react';
52
import ReactDOM from 'react-dom';
63
import {

src/Bubble/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const Bubble = React.forwardRef<HTMLDivElement, BubbleProps>(({
3838

3939
Bubble.propTypes = {
4040
/** Specifies contents of the component. */
41+
// @ts-ignore
4142
children: PropTypes.node,
4243
/** The `Bubble` style variant to use. */
4344
variant: PropTypes.oneOf(STYLE_VARIANTS),

src/Chip/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ const Chip = React.forwardRef(({
9494

9595
Chip.propTypes = {
9696
/** Specifies the content of the `Chip`. */
97+
// @ts-ignore
9798
children: PropTypes.node.isRequired,
9899
/** Specifies an additional `className` to add to the base element. */
99100
className: PropTypes.string,

src/Form/FormGroupContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function FormGroupContextProvider({
6060
const [labelledByIds, registerLabelerId] = useIdList(controlId);
6161
const [isControlGroup, useSetIsControlGroupEffect] = useStateEffect(false);
6262

63-
const getControlProps = useCallback((controlProps) => {
63+
const getControlProps = useCallback((controlProps: Record<string, any>) => {
6464
// labelledByIds from the list above should only be added to a control
6565
// if it the control is a group. We prefer adding a condition here because:
6666
// - Hooks cannot be called inside conditionals

src/Hyperlink/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Hyperlink.propTypes = {
114114
/** specifies the URL */
115115
destination: PropTypes.string.isRequired,
116116
/** Content of the hyperlink */
117+
// @ts-ignore
117118
children: PropTypes.node.isRequired,
118119
/** Custom class names for the hyperlink */
119120
className: PropTypes.string,

src/Modal/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ class Modal extends React.Component {
5050

5151
componentWillUnmount() {
5252
if (this.parentElement) {
53+
// TODO: update this to use the new createRoot() compatible APIs.
54+
// eslint-disable-next-line react/no-deprecated
5355
ReactDOM.unmountComponentAtNode(this.parentElement);
5456
}
5557
}

0 commit comments

Comments
 (0)