Skip to content

Commit

Permalink
chore: Add debug info to JSX output (#12295)
Browse files Browse the repository at this point in the history
* chore: Add debug info to JSX output

* Pin React to `^16.14.0` instead of `^16.13.0`

* Remove redundant `React`s

* Add `@babel/preset-react` for Storybook

* Update babel.config.js
  • Loading branch information
Twixes authored Oct 17, 2022
1 parent 9f0602a commit 5c783c7
Show file tree
Hide file tree
Showing 642 changed files with 448 additions and 778 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = {
rules: {
'no-only-tests/no-only-tests': 'error',
'react/prop-types': [0],
'react/react-in-jsx-scope': [0],
'react/no-unescaped-entities': [0],
'react/jsx-no-target-blank': [0],
'react/self-closing-comp': [
Expand Down
2 changes: 1 addition & 1 deletion .storybook/kea-story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createMemoryHistory } from 'history'
import { initKea } from '~/initKea'
import { router } from 'kea-router'
import { getContext } from 'kea'
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { App } from 'scenes/App'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { worker } from '~/mocks/browser'
Expand Down
1 change: 0 additions & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import '~/styles'
import './storybook.scss'
import { worker } from '~/mocks/browser'
Expand Down
7 changes: 6 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
module.exports = {
plugins: [
'@babel/plugin-transform-runtime',
'@babel/plugin-transform-react-jsx',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-property-in-object',
],
Expand All @@ -14,6 +13,12 @@ module.exports = {
corejs: 3,
},
],
[
'@babel/preset-react',
{
runtime: 'automatic',
},
],
'@babel/typescript',
],
}
1 change: 0 additions & 1 deletion frontend/src/exporter/ExportedInsight/ExportedInsight.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ChartDisplayType, InsightLogicProps, InsightModel, InsightType } from '~/types'
import React from 'react'
import { BindLogic } from 'kea'
import { insightLogic } from 'scenes/insights/insightLogic'
import { InsightViz } from 'lib/components/Cards/InsightCard/InsightCard'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/exporter/Exporter.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react'
import { useEffect } from 'react'
import { ComponentMeta, ComponentStory } from '@storybook/react'
import { Exporter } from './Exporter'
import { insight, dashboard } from '~/exporter/__mocks__/Exporter.mocks'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/exporter/Exporter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '~/styles'
import './Exporter.scss'
import React, { useEffect } from 'react'
import { useEffect } from 'react'
import { ExportedData, ExportType } from '~/exporter/types'
import { DashboardPlacement } from '~/types'
import { ExportedInsight } from '~/exporter/ExportedInsight/ExportedInsight'
Expand Down
1 change: 0 additions & 1 deletion frontend/src/exporter/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import '~/styles'
import './Exporter.scss'
import React from 'react'
import ReactDOM from 'react-dom'
import { loadPostHogJS } from '~/loadPostHogJS'
import { initKea } from '~/initKea'
Expand Down
1 change: 0 additions & 1 deletion frontend/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import '~/styles'

import React from 'react'
import ReactDOM from 'react-dom'
import { getContext } from 'kea'

Expand Down
2 changes: 0 additions & 2 deletions frontend/src/layout/Error404.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

import { NotFound } from 'lib/components/NotFound'

export function Error404(): JSX.Element {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/ErrorBoundary/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ErrorBoundary as SentryErrorBoundary } from '@sentry/react'
import { HelpButton } from 'lib/components/HelpButton/HelpButton'
import { IconArrowDropDown } from 'lib/components/icons'
import { LemonButton } from 'lib/components/LemonButton'
import React from 'react'
import './ErrorBoundary.scss'

export function ErrorBoundary({ children }: { children: React.ReactElement }): JSX.Element {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/ErrorNetwork.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Button } from 'antd'
import { ReloadOutlined } from '@ant-design/icons'

Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/ErrorProjectUnavailable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { PageHeader } from 'lib/components/PageHeader'
import { useValues } from 'kea'
import { organizationLogic } from '../scenes/organizationLogic'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { sceneLogic } from 'scenes/sceneLogic'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { identifierToHuman, objectsEqual, stripHTTP } from 'lib/utils'
import { userLogic } from 'scenes/userLogic'
import React from 'react'
import { Lettermark } from 'lib/components/Lettermark/Lettermark'
import { ProfilePicture } from 'lib/components/ProfilePicture'
import { ProjectSwitcherOverlay } from '~/layout/navigation/ProjectSwitcher'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/layout/navigation/Navigation.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import { Meta } from '@storybook/react'
import { Layout } from 'antd'
import { TopBar } from './TopBar/TopBar'
import { SideBar } from './SideBar/SideBar'
import React from 'react'

export default {
title: 'Layout/Navigation',
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/navigation/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Layout } from 'antd'
import { useValues } from 'kea'
import React from 'react'
import { sceneLogic } from 'scenes/sceneLogic'
import { Scene } from 'scenes/sceneTypes'
import { Breadcrumbs } from './Breadcrumbs/Breadcrumbs'
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/navigation/OrganizationSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { LemonDivider } from 'lib/components/LemonDivider'
import { LemonTag } from 'lib/components/LemonTag/LemonTag'
import { Lettermark } from 'lib/components/Lettermark/Lettermark'
import { membershipLevelToName } from 'lib/utils/permissioning'
import React from 'react'
import { organizationLogic } from 'scenes/organizationLogic'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { sceneLogic } from 'scenes/sceneLogic'
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/navigation/ProjectNotice.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useActions, useValues } from 'kea'
import { Link } from 'lib/components/Link'
import { navigationLogic } from './navigationLogic'
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/navigation/ProjectSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { router } from 'kea-router'
import { IconPlus, IconSettings } from 'lib/components/icons'
import { LemonButton, LemonButtonWithSideAction } from 'lib/components/LemonButton'
import { LemonDivider } from 'lib/components/LemonDivider'
import React from 'react'
import { organizationLogic } from 'scenes/organizationLogic'
import { sceneLogic } from 'scenes/sceneLogic'
import { teamLogic } from 'scenes/teamLogic'
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/navigation/SideBar/PageButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Scene } from 'scenes/sceneTypes'
import { LemonButton, LemonButtonProps, LemonButtonWithSideAction, SideAction } from 'lib/components/LemonButton'
import { sceneConfigurations } from 'scenes/scenes'
import { LemonTag } from 'lib/components/LemonTag/LemonTag'
import React from 'react'

export interface PageButtonProps extends Pick<LemonButtonProps, 'icon' | 'onClick' | 'to'> {
/** Used for highlighting the active scene. `identifier` of type number means dashboard ID instead of scene. */
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/layout/navigation/SideBar/SideBar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
import { Link } from 'lib/components/Link'
import React, { useState } from 'react'
import { useState } from 'react'
import { ProjectSwitcherOverlay } from '~/layout/navigation/ProjectSwitcher'
import {
IconApps,
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/navigation/SideBar/SideBarApps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Scene } from 'scenes/sceneTypes'
import { canInstallPlugins } from 'scenes/plugins/access'
import { LemonButton } from 'lib/components/LemonButton'
import { PluginSource } from 'scenes/plugins/source/PluginSource'
import React from 'react'
import { useActions, useValues } from 'kea'
import { organizationLogic } from 'scenes/organizationLogic'
import { navigationLogic } from '~/layout/navigation/navigationLogic'
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/navigation/TopBar/Announcement.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import ReactMarkdown from 'react-markdown'
import clsx from 'clsx'
import { CloseOutlined } from '@ant-design/icons'
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/navigation/TopBar/NotificationBell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { IconArrowDropDown, IconInfo, IconNotification, IconWithCount } from 'lib/components/icons'
import { notificationsLogic } from '~/layout/navigation/TopBar/notificationsLogic'
import { useActions, useValues } from 'kea'
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/navigation/TopBar/SitePopover.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useActions, useMountedLogic, useValues } from 'kea'
import { userLogic } from '../../../scenes/userLogic'
import { ProfilePicture } from '../../../lib/components/ProfilePicture'
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/navigation/TopBar/TopBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useActions, useValues } from 'kea'
import React from 'react'
import { FriendlyLogo } from '~/toolbar/assets/FriendlyLogo'
import { SitePopover } from './SitePopover'
import { Announcement } from './Announcement'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import {
featureFlagsActivityResponseJson,
insightsActivityResponseJson,
Expand Down
1 change: 0 additions & 1 deletion frontend/src/lib/components/ActivityLog/ActivityLog.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { ProfilePicture } from 'lib/components/ProfilePicture'
import { TZLabel } from 'lib/components/TimezoneAware'
import { useValues } from 'kea'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { ComponentMeta, ComponentStory } from '@storybook/react'
import { SentenceList, SentenceListProps } from './SentenceList'

Expand Down
1 change: 0 additions & 1 deletion frontend/src/lib/components/ActivityLog/SentenceList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import './SentenceList.scss'

export interface SentenceListProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ActivityScope } from 'lib/components/ActivityLog/humanizeActivity'
import { render } from '@testing-library/react'
import '@testing-library/jest-dom'
import React from 'react'
import { MOCK_TEAM_ID } from 'lib/api.mock'
import { makeTestSetup } from './activityLogLogic.test.setup'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ActivityScope } from 'lib/components/ActivityLog/humanizeActivity'
import { render } from '@testing-library/react'
import '@testing-library/jest-dom'
import React from 'react'
import { MOCK_TEAM_ID } from 'lib/api.mock'
import { makeTestSetup } from 'lib/components/ActivityLog/activityLogLogic.test.setup'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ActivityScope } from 'lib/components/ActivityLog/humanizeActivity'
import { render } from '@testing-library/react'
import '@testing-library/jest-dom'
import React from 'react'
import { makeTestSetup } from 'lib/components/ActivityLog/activityLogLogic.test.setup'
import { MOCK_TEAM_ID } from 'lib/api.mock'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ActivityScope } from 'lib/components/ActivityLog/humanizeActivity'
import { render } from '@testing-library/react'
import '@testing-library/jest-dom'
import React from 'react'
import { makeTestSetup } from 'lib/components/ActivityLog/activityLogLogic.test.setup'

describe('the activity log logic', () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/AdHocInsight/AdHocInsight.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FilterType, InsightLogicProps } from '~/types'
import React, { useMemo } from 'react'
import { useMemo } from 'react'
import { BindLogic } from 'kea'
import { insightLogic } from 'scenes/insights/insightLogic'
import { useValues } from 'kea'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react'
import { useState } from 'react'
import { AddToDashboardModal } from './AddToDashboardModal'
import { InsightModel } from '~/types'
import { dashboardsModel } from '~/models/dashboardsModel'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Tooltip } from 'lib/components/Tooltip'
import { useActions, useValues } from 'kea'
import { addToDashboardModalLogic } from 'lib/components/AddToDashboard/addToDashboardModalLogic'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { ComponentMeta, ComponentStory } from '@storybook/react'
import { AlertMessage, AlertMessageProps } from './AlertMessage'

Expand Down
1 change: 0 additions & 1 deletion frontend/src/lib/components/AlertMessage/AlertMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import './AlertMessage.scss'
import { IconClose, IconInfo, IconWarning } from '../icons'
import clsx from 'clsx'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/AnimatedCollapsible.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from 'react'
import { useEffect, useRef, useState } from 'react'

export function AnimatedCollapsible({
collapsed,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import { AnimationType } from 'lib/animations/animations'
import { ComponentStory, Meta } from '@storybook/react'
import { Animation } from 'lib/components/Animation/Animation'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/Animation/Animation.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './Animation.scss'
import { Player } from '@lottiefiles/react-lottie-player'
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import clsx from 'clsx'
import { AnimationType, getAnimationSource, animations } from 'lib/animations/animations'
import { Spinner } from 'lib/components/Spinner/Spinner'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react'
import { useState } from 'react'
import { useValues } from 'kea'
import { teamLogic } from 'scenes/teamLogic'
import { Modal, Button } from 'antd'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
import { LemonTag } from 'lib/components/LemonTag/LemonTag'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/BillingAlerts.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { ComponentMeta } from '@storybook/react'
import { BillingType, Realm } from '~/types'
import preflightJson from '~/mocks/fixtures/_preflight.json'
Expand Down
1 change: 0 additions & 1 deletion frontend/src/lib/components/BillingAlerts.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useValues } from 'kea'
import { billingLogic, BillingAlertType } from 'scenes/billing/billingLogic'
import { Link } from 'lib/components/Link'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/BridgePage/BridgePage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import clsx from 'clsx'
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { WelcomeLogo } from 'scenes/authentication/WelcomeLogo'
import { CSSTransition } from 'react-transition-group'
import './BridgePage.scss'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Meta, Story } from '@storybook/react'
import React, { useState } from 'react'
import { useState } from 'react'
import { ChartDisplayType, FunnelVizType, InsightColor, InsightModel, InsightShortId, InsightType } from '~/types'
import { InsightCard as InsightCardComponent } from './index'
import { DashboardPrivilegeLevel, DashboardRestrictionLevel } from 'lib/constants'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useValues } from 'kea'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { allOperatorsMapping, alphabet, convertPropertyGroupToProperties, formatPropertyLabel } from 'lib/utils'
import React from 'react'
import { LocalFilter, toLocalFilters } from 'scenes/insights/filters/ActionFilter/entityFilterLogic'
import { BreakdownFilter } from 'scenes/insights/filters/BreakdownFilter'
import { humanizePathsEventTypes } from 'scenes/insights/utils'
Expand All @@ -19,6 +18,7 @@ import { keyMapping, PropertyKeyInfo } from '../../PropertyKeyInfo'
import { TZLabel } from '../../TimezoneAware'
import { propertyDefinitionsModel } from '~/models/propertyDefinitionsModel'
import { cohortsModel } from '~/models/cohortsModel'
import React from 'react'

function CompactPropertyFiltersDisplay({
properties,
Expand Down
1 change: 0 additions & 1 deletion frontend/src/lib/components/Cards/InsightCard/handles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import clsx from 'clsx'

/** A one-dimensional (either horizontal or vertical) resize handle. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Meta, Story } from '@storybook/react'
import React from 'react'
import { DashboardTile, InsightColor } from '~/types'
import { TextCard } from './TextCard'

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/Cards/TextCard/TextCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Resizeable } from 'lib/components/Cards/InsightCard/InsightCard'
import './TextCard.scss'
import { Textfit } from 'react-textfit'
Expand All @@ -13,6 +12,7 @@ import { urls } from 'scenes/urls'
import ReactMarkdown from 'react-markdown'
import { UserActivityIndicator } from 'lib/components/UserActivityIndicator/UserActivityIndicator'
import { dashboardsModel } from '~/models/dashboardsModel'
import React from 'react'

interface TextCardProps extends React.HTMLAttributes<HTMLDivElement>, Resizeable {
dashboardId?: string | number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { LemonModal } from 'lib/components/LemonModal'
import { LemonButton } from 'lib/components/LemonButton'
import { Field, Form } from 'kea-forms'
import { LemonTextMarkdown } from 'lib/components/LemonTextArea/LemonTextArea'
import React from 'react'

export function TextCardModal({
isOpen,
Expand Down
1 change: 0 additions & 1 deletion frontend/src/lib/components/ChartFilter/ChartFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useActions, useValues } from 'kea'
import { chartFilterLogic } from './chartFilterLogic'
import {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/lib/components/CloseButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CloseOutlined } from '@ant-design/icons'
import React from 'react'

export function CloseButton(props: Record<string, any>): JSX.Element {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { SearchOutlined, EditOutlined } from '@ant-design/icons'
import { useValues, useActions } from 'kea'
import { commandPaletteLogic } from './commandPaletteLogic'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef } from 'react'
import { useEffect, useRef } from 'react'
import { CommandResultDisplayable } from './commandPaletteLogic'
import { useEventListener } from 'lib/hooks/useEventListener'
import { useActions, useMountedLogic, useValues } from 'kea'
Expand Down
Loading

0 comments on commit 5c783c7

Please sign in to comment.