Skip to content

Commit

Permalink
refactor: remove import-react
Browse files Browse the repository at this point in the history
  • Loading branch information
Orcus2021 committed Jun 6, 2024
1 parent e9d1905 commit 18e2c6f
Show file tree
Hide file tree
Showing 230 changed files with 57 additions and 352 deletions.
1 change: 0 additions & 1 deletion packages/core/src/Avatar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/BasicRow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';

import FlexCell from './FlexCell';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Button.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';

Check warning on line 1 in packages/core/src/Button.js

View workflow job for this annotation

GitHub Actions / Lint and test

Filename 'Button' must match the exported name 'RowCompButton'
import classNames from 'classnames';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Checkbox.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import prefixClass from './utils/prefixClass';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/ColumnView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import './styles/ColumnView.scss';
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/EditableBasicRow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useRef, useEffect } from 'react';
import { memo, useState, useRef, useEffect } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import './styles/EditableBasicRow.scss';
Expand Down Expand Up @@ -57,7 +57,7 @@ export const ROW_INPUT_TAGS = {
* ```
*/

const EditableBasicRow = React.memo(
const EditableBasicRow = memo(
({
inputTag: InputTag,
// <input> props
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/EditableText.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';

import withStatus, { withStatusPropTypes, STATUS_CODE } from './mixins/withStatus';
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/EditableTextLabel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { memo, useState, useEffect, useCallback, useRef } from 'react';
import PropTypes from 'prop-types';
import keycode from 'keycode';

Expand Down Expand Up @@ -32,7 +32,7 @@ const TOUCH_TIMEOUT_MS = 250;
* It does not offer direct control to the `<input>` inside.
*/

const EditableTextLabel = React.memo(
const EditableTextLabel = memo(
({
inEdit: inEditProp, // not used here
onDblClick, // also not used here
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/FlexCell.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';

import icBEM from './utils/icBEM';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/HeaderRow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import './styles/HeaderRow.scss';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Icon.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/IconButton.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/IconCheckbox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import IconLayout from './IconLayout';
import Checkbox, { CHECKBOX_BUTTON } from './Checkbox';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/IconLayout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';

import withStatus, { withStatusPropTypes } from './mixins/withStatus';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/InfiniteScroll.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent, isValidElement } from 'react';
import { PureComponent, isValidElement } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import documentOffset from 'document-offset';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/List.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import './styles/List.scss';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/ListRow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Modal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import memoize from 'memoize-one';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Overlay.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import classNames from 'classnames';

import icBEM from './utils/icBEM';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Popover.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Popup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { isValidElement } from 'react';
import { isValidElement } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/PopupButton.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classNames from 'classnames';

import prefixClass from './utils/prefixClass';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Radio.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/SearchInput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react';
import { createRef, Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down Expand Up @@ -63,7 +63,7 @@ class SearchInput extends Component {
innerValue: this.props.defaultValue,
};

inputRef = React.createRef();
inputRef = createRef();

cachedValue = null;

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Section.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/SplitView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classNames from 'classnames';

import icBEM from './utils/icBEM';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/SplitViewColumn.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/StatusIcon.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useRef, useCallback, useEffect } from 'react';
import { memo, useState, useRef, useCallback, useEffect } from 'react';
import PropTypes from 'prop-types';

import icBEM from './utils/icBEM';
Expand All @@ -21,7 +21,7 @@ const ROOT_BEM = icBEM(COMPONENT_NAME);

const ICON_HIDE_TIMEOUT = 2 * 1000;

const StatusIcon = React.memo(({ status, position, autohide, ...wrapperProps }) => {
const StatusIcon = memo(({ status, position, autohide, ...wrapperProps }) => {
const [hideIcon, setHideIcon] = useState(false);
const hideIconTimeout = useRef(null);

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Switch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/SwitchIcon.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Tag.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classNames from 'classnames';
import './styles/Tag.scss';

Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* └╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘
*/

import React, { PureComponent } from 'react';
import { isValidElement, cloneElement, PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down Expand Up @@ -90,9 +90,9 @@ class Text extends PureComponent {
className: classNames(BEM.row.toString(), BEM.basic.toString()),
};

if (basicRow && React.isValidElement(basicRow)) {
if (basicRow && isValidElement(basicRow)) {
// Inject { basic, tag, statusIcon } to default or custom row.
return React.cloneElement(basicRow, basicRowProps);
return cloneElement(basicRow, basicRowProps);
}

return null;
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/TextEllipsis.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import icBEM from './utils/icBEM';
import prefixClass from './utils/prefixClass';
import './styles/TextEllipsis.scss';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/TextInput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/TextLabel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classNames from 'classnames';
import prefixClass from './utils/prefixClass';
import rowComp from './mixins/rowComp';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Tooltip.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import classNames from 'classnames';

import icBEM from './utils/icBEM';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Checkbox.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow, mount } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/ColumnView.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/EditableBasicRow.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import EditableBasicRow, { ROW_INPUT_TAGS } from '../EditableBasicRow';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/EditableText.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/EditableTextLabel.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { screen, render, waitFor, fireEvent } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import EditableTextLabel from '../EditableTextLabel';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/FlexCell.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import FlexCell from '../FlexCell';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/HeaderRow.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Icon.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import Icon from '../Icon';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/IconButton.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/IconCheckbox.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/IconLayout.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/InfiniteScroll.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow, mount } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/List.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow, mount } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/ListRow.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Modal.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { shallow } from 'enzyme';

import { BEM, PureModal, DefaultHeader } from '../Modal';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Overlay.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { mount } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Popover.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Popup.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/PopupButton.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Radio.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/SearchInput.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { PureSearchInput as SearchInput } from '../SearchInput';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Section.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/SplitView.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/SplitViewColumn.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/StatusIcon.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render, act, cleanup, waitFor, screen } from '@testing-library/react';
import StatusIcon, { STATUS_CODE } from '../StatusIcon';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Switch.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/SwitchIcon.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import { shallow } from 'enzyme';
import SwitchIcon from '../SwitchIcon';
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/__tests__/Tag.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { render } from '@testing-library/react';
import Tag from '../Tag';

Expand Down
Loading

0 comments on commit 18e2c6f

Please sign in to comment.