Skip to content

Commit c11bc67

Browse files
authored
refactor!: Migrate to new JSX transform (react-bootstrap#5695)
* refactor: Migrate to import * as React from 'react' * Bump deps Remove import * from docs * Fix yarn lock
1 parent 84737f3 commit c11bc67

File tree

215 files changed

+835
-757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+835
-757
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@types/classnames": "^2.2.10",
6868
"@types/invariant": "^2.2.33",
6969
"@types/prop-types": "^15.7.3",
70-
"@types/react": ">=16.9.35",
70+
"@types/react": ">=16.14.4",
7171
"@types/react-transition-group": "^4.4.1",
7272
"@types/warning": "^3.0.0",
7373
"classnames": "^2.2.6",
@@ -87,8 +87,8 @@
8787
"@babel/core": "^7.13.8",
8888
"@babel/preset-typescript": "^7.13.0",
8989
"@babel/register": "^7.13.8",
90-
"@react-bootstrap/babel-preset": "^1.2.0",
91-
"@react-bootstrap/eslint-config": "^1.3.2",
90+
"@react-bootstrap/babel-preset": "^2.0.0",
91+
"@react-bootstrap/eslint-config": "^2.0.0",
9292
"@typescript-eslint/eslint-plugin": "^4.16.1",
9393
"@typescript-eslint/parser": "^4.16.1",
9494
"babel-eslint": "^10.1.0",
@@ -141,8 +141,8 @@
141141
"webpack": "^5.24.3"
142142
},
143143
"peerDependencies": {
144-
"react": ">=16.8.0",
145-
"react-dom": ">=16.8.0"
144+
"react": ">=16.14.0",
145+
"react-dom": ">=16.14.0"
146146
},
147147
"publishConfig": {
148148
"directory": "lib"

src/AbstractNav.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import qsa from 'dom-helpers/querySelectorAll';
22
import PropTypes from 'prop-types';
3-
import React, { useContext, useEffect, useRef } from 'react';
3+
import * as React from 'react';
4+
import { useContext, useEffect, useRef } from 'react';
45
import useForceUpdate from '@restart/hooks/useForceUpdate';
56
import useMergedRefs from '@restart/hooks/useMergedRefs';
67
import NavContext from './NavContext';

src/AbstractNavItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React, { useContext } from 'react';
3+
import * as React from 'react';
4+
import { useContext } from 'react';
45
import useEventCallback from '@restart/hooks/useEventCallback';
56

67
import warning from 'warning';

src/Accordion.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import classNames from 'classnames';
2-
import React, { useMemo } from 'react';
2+
import * as React from 'react';
3+
import { useMemo } from 'react';
34
import PropTypes from 'prop-types';
45
import { useUncontrolled } from 'uncontrollable';
56
import { useBootstrapPrefix } from './ThemeProvider';

src/AccordionBody.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import classNames from 'classnames';
2-
import React, { useContext } from 'react';
2+
import * as React from 'react';
3+
import { useContext } from 'react';
34
import PropTypes from 'prop-types';
45
import { useBootstrapPrefix } from './ThemeProvider';
56
import AccordionCollapse from './AccordionCollapse';

src/AccordionButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { useContext } from 'react';
1+
import * as React from 'react';
2+
import { useContext } from 'react';
23
import classNames from 'classnames';
34
import PropTypes from 'prop-types';
45
import AccordionContext from './AccordionContext';

src/AccordionCollapse.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import classNames from 'classnames';
2-
import React, { useContext } from 'react';
2+
import * as React from 'react';
3+
import { useContext } from 'react';
34
import PropTypes from 'prop-types';
45
import { useBootstrapPrefix } from './ThemeProvider';
56
import Collapse, { CollapseProps } from './Collapse';

src/AccordionContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import * as React from 'react';
22
import { SelectCallback } from './helpers';
33

44
export interface AccordionContextValue {

src/AccordionHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33
import PropTypes from 'prop-types';
44
import { useBootstrapPrefix } from './ThemeProvider';
55
import AccordionButton from './AccordionButton';

src/AccordionItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import classNames from 'classnames';
2-
import React, { useMemo } from 'react';
2+
import * as React from 'react';
3+
import { useMemo } from 'react';
34
import PropTypes from 'prop-types';
45
import { useBootstrapPrefix } from './ThemeProvider';
56
import AccordionItemContext, {

src/AccordionItemContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import * as React from 'react';
22

33
export interface AccordionItemContextValue {
44
eventKey: string;

src/Alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33
import PropTypes from 'prop-types';
44
import { elementType } from 'prop-types-extra';
55
import { useUncontrolled } from 'uncontrollable';

src/Badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import PropTypes from 'prop-types';
22
import classNames from 'classnames';
3-
import React from 'react';
3+
import * as React from 'react';
44

55
import { useBootstrapPrefix } from './ThemeProvider';
66
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';

src/Breadcrumb.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33
import PropTypes from 'prop-types';
44

55
import { useBootstrapPrefix } from './ThemeProvider';

src/BreadcrumbItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33
import PropTypes from 'prop-types';
44

55
import SafeAnchor from './SafeAnchor';

src/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33
import PropTypes from 'prop-types';
44

55
import { useBootstrapPrefix } from './ThemeProvider';

src/ButtonGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33
import PropTypes from 'prop-types';
44

55
import { useBootstrapPrefix } from './ThemeProvider';

src/ButtonToolbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React from 'react';
3+
import * as React from 'react';
44

55
import { useBootstrapPrefix } from './ThemeProvider';
66

src/Card.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import classNames from 'classnames';
2-
import React, { useMemo } from 'react';
2+
import * as React from 'react';
3+
import { useMemo } from 'react';
34
import PropTypes from 'prop-types';
45

56
import { useBootstrapPrefix } from './ThemeProvider';

src/CardContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import * as React from 'react';
22

33
interface CardContextType {
44
cardHeaderBsPrefix: string;

src/CardImg.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33
import PropTypes from 'prop-types';
44

55
import { useBootstrapPrefix } from './ThemeProvider';

src/Carousel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import classNames from 'classnames';
66
import transitionEnd from 'dom-helpers/transitionEnd';
77
import Transition from 'react-transition-group/Transition';
88
import PropTypes from 'prop-types';
9-
import React, {
9+
import * as React from 'react';
10+
import {
1011
useCallback,
1112
useEffect,
1213
useImperativeHandle,

src/CarouselItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33
import PropTypes from 'prop-types';
44
import { useBootstrapPrefix } from './ThemeProvider';
55
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';

src/CloseButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import PropTypes from 'prop-types';
2-
import React from 'react';
2+
import * as React from 'react';
33
import classNames from 'classnames';
44

55
export type CloseButtonVariant = 'white';

src/Col.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33
import PropTypes from 'prop-types';
44

55
import { useBootstrapPrefix } from './ThemeProvider';

src/Collapse.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import classNames from 'classnames';
22
import css from 'dom-helpers/css';
33
import PropTypes from 'prop-types';
4-
import React, { useMemo } from 'react';
4+
import * as React from 'react';
5+
import { useMemo } from 'react';
56
import Transition, {
67
ENTERED,
78
ENTERING,

src/Container.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33
import PropTypes from 'prop-types';
44

55
import { useBootstrapPrefix } from './ThemeProvider';

src/Dropdown.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React, { useContext } from 'react';
3+
import * as React from 'react';
4+
import { useContext } from 'react';
45
import BaseDropdown from 'react-overlays/Dropdown';
56
import { DropDirection } from 'react-overlays/DropdownContext';
67
import { useUncontrolled } from 'uncontrollable';

src/DropdownButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import * as React from 'react';
22
import PropTypes from 'prop-types';
33

44
import Dropdown, { DropdownProps } from './Dropdown';

src/DropdownItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React, { useContext } from 'react';
3+
import * as React from 'react';
4+
import { useContext } from 'react';
45
import useEventCallback from '@restart/hooks/useEventCallback';
56

67
import SelectableContext, { makeEventKey } from './SelectableContext';

src/DropdownMenu.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React, { useContext } from 'react';
3+
import * as React from 'react';
4+
import { useContext } from 'react';
45
import {
56
useDropdownMenu,
67
UseDropdownMenuOptions,

src/DropdownToggle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
33
import isRequiredForA11y from 'prop-types-extra/lib/isRequiredForA11y';
4-
import React from 'react';
4+
import * as React from 'react';
55
import { useDropdownToggle } from 'react-overlays/DropdownToggle';
66
import useMergedRefs from '@restart/hooks/useMergedRefs';
77
import Button, { ButtonProps, CommonButtonProps } from './Button';

src/ElementChildren.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import * as React from 'react';
22

33
/**
44
* Iterates through children that are typically specified as `props.children`,

src/Fade.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React, { useCallback } from 'react';
3+
import * as React from 'react';
4+
import { useCallback } from 'react';
45
import Transition, {
56
ENTERED,
67
ENTERING,

src/Feedback.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33
import PropTypes from 'prop-types';
44
import { AsProp, BsPrefixRefForwardingComponent } from './helpers';
55

src/FigureImage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33

44
import Image, { ImageProps, propTypes as imagePropTypes } from './Image';
55

src/Form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React from 'react';
3+
import * as React from 'react';
44
import FormCheck from './FormCheck';
55
import FormControl from './FormControl';
66
import FormGroup from './FormGroup';

src/FormCheck.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React, { useContext, useMemo } from 'react';
3+
import * as React from 'react';
4+
import { useContext, useMemo } from 'react';
45
import Feedback from './Feedback';
56
import FormCheckInput from './FormCheckInput';
67
import FormCheckLabel from './FormCheckLabel';

src/FormCheckInput.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React, { useContext } from 'react';
3+
import * as React from 'react';
4+
import { useContext } from 'react';
45
import FormContext from './FormContext';
56
import { useBootstrapPrefix } from './ThemeProvider';
67
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';

src/FormCheckLabel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React, { useContext } from 'react';
3+
import * as React from 'react';
4+
import { useContext } from 'react';
45
import FormContext from './FormContext';
56
import { useBootstrapPrefix } from './ThemeProvider';
67

src/FormContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import * as React from 'react';
22

33
// TODO
44
interface FormContextType {

src/FormControl.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React, { useContext } from 'react';
3+
import * as React from 'react';
4+
import { useContext } from 'react';
45
import warning from 'warning';
56
import Feedback from './Feedback';
67
import FormContext from './FormContext';

src/FormGroup.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import PropTypes from 'prop-types';
2-
import React, { useMemo } from 'react';
2+
import * as React from 'react';
3+
import { useMemo } from 'react';
34

45
import FormContext from './FormContext';
56
import { AsProp, BsPrefixRefForwardingComponent } from './helpers';

src/FormLabel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React, { useContext } from 'react';
3+
import * as React from 'react';
4+
import { useContext } from 'react';
45
import warning from 'warning';
56

67
import Col, { ColProps } from './Col';

src/FormRange.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React from 'react';
3+
import * as React from 'react';
44
import { useBootstrapPrefix } from './ThemeProvider';
55
import { BsPrefixAndClassNameOnlyProps } from './helpers';
66

src/FormSelect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
3-
import React from 'react';
3+
import * as React from 'react';
44
import { useBootstrapPrefix } from './ThemeProvider';
55
import {
66
BsPrefixAndClassNameOnlyProps,

src/FormText.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import classNames from 'classnames';
22
import PropTypes from 'prop-types';
33

4-
import React from 'react';
4+
import * as React from 'react';
55

66
import { useBootstrapPrefix } from './ThemeProvider';
77

src/Image.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames';
2-
import React from 'react';
2+
import * as React from 'react';
33
import PropTypes from 'prop-types';
44

55
import { useBootstrapPrefix } from './ThemeProvider';

0 commit comments

Comments
 (0)