Browse Source

ref(js): Avoid import * as React in simple Components (#34267)

Evan Purkhiser 2 years ago
parent
commit
b543bf4637

+ 2 - 2
static/app/components/acl/access.tsx

@@ -1,4 +1,4 @@
-import * as React from 'react';
+import {Component} from 'react';
 
 import Alert from 'sentry/components/alert';
 import {t} from 'sentry/locale';
@@ -71,7 +71,7 @@ type Props = {
 /**
  * Component to handle access restrictions.
  */
-class Access extends React.Component<Props> {
+class Access extends Component<Props> {
   static defaultProps = defaultProps;
 
   render() {

+ 2 - 2
static/app/components/acl/feature.tsx

@@ -1,4 +1,4 @@
-import * as React from 'react';
+import {Component} from 'react';
 
 import HookStore from 'sentry/stores/hookStore';
 import {Config, Organization, Project} from 'sentry/types';
@@ -102,7 +102,7 @@ type AllFeatures = {
 /**
  * Component to handle feature flags.
  */
-class Feature extends React.Component<Props> {
+class Feature extends Component<Props> {
   static defaultProps = {
     renderDisabled: false,
     requireAll: true,

+ 2 - 2
static/app/components/actions/resolve.tsx

@@ -1,4 +1,4 @@
-import * as React from 'react';
+import {Component} from 'react';
 import styled from '@emotion/styled';
 
 import {openModal} from 'sentry/actionCreators/modal';
@@ -41,7 +41,7 @@ type Props = {
   shouldConfirm?: boolean;
 } & Partial<typeof defaultProps>;
 
-class ResolveActions extends React.Component<Props> {
+class ResolveActions extends Component<Props> {
   static defaultProps = defaultProps;
 
   handleAnotherExistingReleaseResolution(statusDetails: ResolutionStatusDetails) {

+ 3 - 3
static/app/components/activity/note/input.tsx

@@ -1,4 +1,4 @@
-import * as React from 'react';
+import {Component} from 'react';
 import {Mention, MentionsInput, MentionsInputProps} from 'react-mentions';
 import {withTheme} from '@emotion/react';
 import styled from '@emotion/styled';
@@ -52,7 +52,7 @@ type State = {
   value: string;
 };
 
-class NoteInputComponent extends React.Component<Props, State> {
+class NoteInputComponent extends Component<Props, State> {
   state: State = {
     preview: false,
     value: this.props.text || '',
@@ -264,7 +264,7 @@ type MentionablesChildFunc = Parameters<
   React.ComponentProps<typeof Mentionables>['children']
 >[0];
 
-class NoteInputContainer extends React.Component<NoteInputContainerProps> {
+class NoteInputContainer extends Component<NoteInputContainerProps> {
   static defaultProps = defaultProps;
 
   renderInput = ({members, teams}: MentionablesChildFunc) => {

+ 2 - 2
static/app/components/activity/note/inputWithStorage.tsx

@@ -1,4 +1,4 @@
-import * as React from 'react';
+import {Component} from 'react';
 import * as Sentry from '@sentry/react';
 import debounce from 'lodash/debounce';
 
@@ -24,7 +24,7 @@ type Props = {
 } & InputProps &
   typeof defaultProps;
 
-class NoteInputWithStorage extends React.Component<Props> {
+class NoteInputWithStorage extends Component<Props> {
   static defaultProps = defaultProps;
 
   fetchFromStorage() {

+ 2 - 2
static/app/components/assigneeSelector.tsx

@@ -1,4 +1,4 @@
-import * as React from 'react';
+import {Component} from 'react';
 import styled from '@emotion/styled';
 
 import {assignToActor, assignToUser, clearAssignment} from 'sentry/actionCreators/group';
@@ -58,7 +58,7 @@ type State = {
   suggestedOwners?: SuggestedOwner[] | null;
 };
 
-class AssigneeSelector extends React.Component<Props, State> {
+class AssigneeSelector extends Component<Props, State> {
   static defaultProps = {
     size: 20,
   };

+ 2 - 2
static/app/components/asyncComponentSearchInput.tsx

@@ -1,4 +1,4 @@
-import * as React from 'react';
+import {Component} from 'react';
 import {withRouter, WithRouterProps} from 'react-router';
 import styled from '@emotion/styled';
 import debounce from 'lodash/debounce';
@@ -59,7 +59,7 @@ type State = {
  *
  * It probably doesn't make too much sense outside of an AsyncComponent atm.
  */
-class AsyncComponentSearchInput extends React.Component<Props, State> {
+class AsyncComponentSearchInput extends Component<Props, State> {
   static defaultProps: DefaultProps = {
     placeholder: t('Search...'),
     debounceWait: 200,

+ 2 - 2
static/app/components/avatar/actorAvatar.tsx

@@ -1,4 +1,4 @@
-import * as React from 'react';
+import {Component} from 'react';
 import * as Sentry from '@sentry/react';
 
 import TeamAvatar from 'sentry/components/avatar/teamAvatar';
@@ -26,7 +26,7 @@ type Props = DefaultProps & {
   tooltipOptions?: Omit<React.ComponentProps<typeof Tooltip>, 'children' | 'title'>;
 };
 
-class ActorAvatar extends React.Component<Props> {
+class ActorAvatar extends Component<Props> {
   static defaultProps: DefaultProps = {
     size: 24,
     hasTooltip: true,

+ 2 - 2
static/app/components/avatar/baseAvatar.tsx

@@ -1,4 +1,4 @@
-import * as React from 'react';
+import {Component} from 'react';
 import styled from '@emotion/styled';
 import classNames from 'classnames';
 import * as qs from 'query-string';
@@ -111,7 +111,7 @@ type State = {
   showBackupAvatar: boolean;
 };
 
-class BaseAvatar extends React.Component<Props, State> {
+class BaseAvatar extends Component<Props, State> {
   static defaultProps = defaultProps;
 
   constructor(props: Props) {

+ 2 - 2
static/app/components/avatar/userAvatar.tsx

@@ -1,4 +1,4 @@
-import * as React from 'react';
+import {Component} from 'react';
 
 import BaseAvatar from 'sentry/components/avatar/baseAvatar';
 import {Actor, AvatarUser} from 'sentry/types';
@@ -25,7 +25,7 @@ function isActor(maybe: AvatarUser | Actor): maybe is Actor {
   return typeof (maybe as AvatarUser).email === 'undefined';
 }
 
-class UserAvatar extends React.Component<Props> {
+class UserAvatar extends Component<Props> {
   static defaultProps = defaultProps;
 
   getType = (user: AvatarUser | Actor, gravatar: boolean | undefined) => {

Some files were not shown because too many files changed in this diff