Skip to content
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

APP-3274 - Update React imports to use standard style. #68

Merged
merged 5 commits into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import addons from '@storybook/addons';
import { addParameters } from '@storybook/react';
import { themes } from '@storybook/theming';
Expand Down
2 changes: 1 addition & 1 deletion spec/components/button/Button.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { shallow } from 'enzyme';

import Button from '../../../src/components/button/Button';
Expand Down
2 changes: 1 addition & 1 deletion spec/components/crop-content/CropContent.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { shallow } from 'enzyme';

import CropContent from '../../../src/components/crop-content/CropContent';
Expand Down
2 changes: 1 addition & 1 deletion spec/components/date-picker/DatePicker.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { mount, shallow } from 'enzyme';
import { act } from 'react-dom/test-utils';

Expand Down
2 changes: 1 addition & 1 deletion spec/components/date-picker/Header.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { shallow } from 'enzyme';

import Header from '../../../src/components/date-picker/Header';
Expand Down
4 changes: 2 additions & 2 deletions spec/components/date-picker/keyUtils.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { shallow } from 'enzyme';

import {
Expand Down Expand Up @@ -47,7 +47,7 @@ describe('Key Utils', () => {
it(`should handle ${test.key} shift=${test.shiftKey} on cell`, () => {
const event = createEvent({ key: test.key, shiftKey: test.shiftKey });
const wrapper = shallow(
<div onKeyDown={(e) => handleKeyDownCell(new Date(), e, setMethod, setMethod2, {})} />
<div onKeyDown={(e) => handleKeyDownCell(new Date(), e, setMethod, setMethod2, ()=>{}, {})} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a mistake? :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. handleKeyDownCell takes 6 params, but this test was only supplying 5, and the 5th one was wrong. I simply added an empty function for focusDiv. Perhaps some of the types are supposed to be optional. The locale isn't typed at all.

export function handleKeyDownCell(
  date: Date,
  e: React.KeyboardEvent,
  setNavigationDate: (date) => any,
  setDivToFocus: (date) => any,
  focusDiv: (date) => any,
  locale
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted this change, as it isn't technically within the scope of this PR, but it should be fixed.

The error I was attempting to fix was a missing parameter. If any of the parameters are optional, they should be labelled as such, and the locale param should have a type. @AliciaSymphony

);
wrapper.simulate('keyDown', event);
expect(setMethod).toHaveBeenCalledTimes(test.called);
Expand Down
2 changes: 1 addition & 1 deletion spec/components/expandable-card/ExpandableCard.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import { ExpandableCard } from '../../../src/components';

/**
Expand Down
2 changes: 1 addition & 1 deletion spec/components/icon/icon.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import Icon from '../../../src/components/icon';

describe('Icon Component', () => {
Expand Down
2 changes: 1 addition & 1 deletion spec/components/input/TextArea.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import { TextArea } from '../../../src/components';
import { TextComponent, Types } from '../../../src/components/input/TextComponent';

Expand Down
2 changes: 1 addition & 1 deletion spec/components/input/TextComponent.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import { TextComponent, Types } from '../../../src/components/input/TextComponent';

import Icon from '../../../src/components/icon/Icon';
Expand Down
2 changes: 1 addition & 1 deletion spec/components/input/TextField.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import { TextField } from '../../../src/components';
import { TextComponent, Types } from '../../../src/components/input/TextComponent';

Expand Down
2 changes: 1 addition & 1 deletion spec/components/selection/Checkbox.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mount, shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import { Checkbox } from '../../../src/components';
import SelectionTypes from '../../../src/components/selection/SelectionTypes';
import { SelectionInput } from '../../../src/components/selection/SelectionInput';
Expand Down
2 changes: 1 addition & 1 deletion spec/components/selection/Radio.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mount, shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import { Radio } from '../../../src/components';
import SelectionTypes from '../../../src/components/selection/SelectionTypes';
import { SelectionInput } from '../../../src/components/selection/SelectionInput';
Expand Down
2 changes: 1 addition & 1 deletion spec/components/selection/SelectionInput.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import SelectionTypes from '../../../src/components/selection/SelectionTypes';

import { SelectionInput } from '../../../src/components/selection/SelectionInput';
Expand Down
2 changes: 1 addition & 1 deletion spec/components/tooltip/Tooltip.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import Tooltip from '../../../src/components/tooltip';

describe('Tooltip Component', () => {
Expand Down
2 changes: 1 addition & 1 deletion spec/components/typography/Typography.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import Typography from '../../../src/components/typography';

describe('Typography Component', () => {
Expand Down
2 changes: 1 addition & 1 deletion spec/components/validation/Validation.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import { TextField, Validation } from '../../../src/components';
import { Validators } from '../../../src/core/validators/validators';

Expand Down
2 changes: 1 addition & 1 deletion spec/core/hoc/ResizeDetectDiv.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-empty-function */

import { shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import { ResizeDetectDivInternal } from '../../../src/core/hoc/ResizeDetectDiv';

describe('ResizeDetectDiv Component', () => {
Expand Down
2 changes: 1 addition & 1 deletion spec/core/hoc/Scale.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { shallow } from 'enzyme';
import React from 'react';
import * as React from 'react';
import Scale from '../../../src/core/hoc/Scale';

describe('Scale Component', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/components/date-picker/DatePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PropTypes from 'prop-types';
import React, { FunctionComponent, useEffect, useRef, useState } from 'react';
import * as React from 'react';
import { FunctionComponent, useEffect, useRef, useState } from 'react';
import classNames from 'classnames';

import { usePopper } from 'react-popper';
Expand Down
2 changes: 1 addition & 1 deletion src/components/date-picker/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import * as React from 'react';

import Icon from '../icon/Icon';
import { addMonths, addYears } from 'date-fns';
Expand Down
3 changes: 2 additions & 1 deletion src/components/icon/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import PropTypes from 'prop-types';
import * as React from 'react';
import { FunctionComponent } from 'react';
import classnames from 'classnames';
import React, { FunctionComponent } from 'react';

export type IconProps = {
className?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/input/TextArea.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { TextComponentPropTypes, TextComponent, TextComponentProps, Types } from './TextComponent';

const TextArea:React.FC<TextComponentProps> = (props) => {
Expand Down
3 changes: 2 additions & 1 deletion src/components/input/TextComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useCallback, useMemo, useState } from 'react';
import * as React from 'react';
import { useCallback, useMemo, useState } from 'react';
import classNames from 'classnames';
import shortid from 'shortid';
import styled from 'styled-components';
Expand Down
2 changes: 1 addition & 1 deletion src/components/input/TextField.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { TextComponentPropTypes, TextComponentProps, TextComponent, Types } from './TextComponent';

const TextField:React.FC<TextComponentProps> = (props) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/selection/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import SelectionTypes from './SelectionTypes';
import { SelectionInput, SelectionInputPropTypes } from './SelectionInput';

Expand Down
2 changes: 1 addition & 1 deletion src/components/selection/Radio.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import SelectionTypes from './SelectionTypes';
import { SelectionInput, SelectionInputPropTypes } from './SelectionInput';

Expand Down
3 changes: 2 additions & 1 deletion src/components/selection/SelectionInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useEffect, useMemo, useState } from 'react';
import * as React from 'react';
import { useEffect, useMemo, useState } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import shortid from 'shortid';
Expand Down
3 changes: 2 additions & 1 deletion src/components/tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
import * as React from 'react';
import { useState } from 'react';
import PropTypes from 'prop-types';
import { usePopper } from 'react-popper';
import { CSSTransition } from 'react-transition-group';
Expand Down
2 changes: 1 addition & 1 deletion src/components/validation/Validation.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import PropTypes from 'prop-types';
import { isEmpty } from 'lodash';
import classNames from 'classnames';
Expand Down
2 changes: 1 addition & 1 deletion stories/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { Button } from '../src/components';
import Icon from '../src/components/icon/Icon';
import './stories.scss';
Expand Down
2 changes: 1 addition & 1 deletion stories/Checkbox.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { Checkbox } from '../src/components';
import LabelPlacements from '../src/components/selection/LabelPlacements';
import SelectionStatus from '../src/components/selection/SelectionStatus';
Expand Down
2 changes: 1 addition & 1 deletion stories/CropContent.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { withKnobs, number } from '@storybook/addon-knobs';
import React from 'react';
import * as React from 'react';
import { CropContent } from '../src/components';

export const CropContentContainer: React.SFC = () => {
Expand Down
2 changes: 1 addition & 1 deletion stories/DatePicker.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { DatePicker, TextField } from '../src/components';

const Template = (args) => {
Expand Down
2 changes: 1 addition & 1 deletion stories/Docs.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import GettingStartedDoc from '../docs/getting-started.md';

import ReactHtmlParser from 'html-react-parser';
Expand Down
2 changes: 1 addition & 1 deletion stories/ExpandableCard.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { ExpandableCard, Button, CropContent } from '../src/components';

export const ExpandableCardContainer: React.SFC = () => {
Expand Down
2 changes: 1 addition & 1 deletion stories/Icons.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import Icon from '../src/components/icon/Icon';

export const Icons: React.SFC = () => (
Expand Down
2 changes: 1 addition & 1 deletion stories/Modal.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { Button, Icon, Modal, Typography } from '../src/components';
import { ModalBody, ModalFooter, ModalHeader, ModalTitle } from '../src/components';

Expand Down
2 changes: 1 addition & 1 deletion stories/Radio.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { Radio } from '../src/components';
import LabelPlacements from '../src/components/selection/LabelPlacements';
import { action } from '@storybook/addon-actions';
Expand Down
2 changes: 1 addition & 1 deletion stories/Scale.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import { Button, Checkbox, Radio } from '../src/components';
import Icon from '../src/components/icon/Icon';
import './stories.scss';
Expand Down
2 changes: 1 addition & 1 deletion stories/TextArea.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { withKnobs, boolean, button, text } from '@storybook/addon-knobs';
import React from 'react';
import * as React from 'react';
import { TextArea } from '../src/components';
import { Validators } from '../src/core/validators/validators';

Expand Down
3 changes: 2 additions & 1 deletion stories/TextField.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { boolean, button, text, withKnobs } from '@storybook/addon-knobs';
import React, { useState } from 'react';
import * as React from 'react';
import { useState } from 'react';
import { TextField, Icon } from '../src/components';

import { Validators } from '../src/core/validators/validators';
Expand Down
3 changes: 2 additions & 1 deletion stories/Tooltip.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
import * as React from 'react';
import { useState } from 'react';
import { Tooltip } from '../src/components';
import Icon from '../src/components/icon';

Expand Down
2 changes: 1 addition & 1 deletion stories/Typography.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';
import Typography from '../src/components/typography';


Expand Down
2 changes: 1 addition & 1 deletion stories/Validation.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { withKnobs } from '@storybook/addon-knobs';
import React from 'react';
import * as React from 'react';
import { DatePicker, TextArea, TextField, Validation } from '../src/components';
import { Validators } from '../src/core/validators/validators';

Expand Down