Browse Source

deps: remove moment (#74234)

`moment` is a dependency of `moment-timezone` and does not need to be
separately installed or imported (it is also confusing that we use these
interchangeably when they point to the same underlying module)

Apologies for the ping everyone, the change just touched on a lot of
files.
Jonas 7 months ago
parent
commit
f352de0321

+ 0 - 1
package.json

@@ -136,7 +136,6 @@
     "mobx": "^6.8.0",
     "mobx": "^6.8.0",
     "mobx-react": "~7.6.0",
     "mobx-react": "~7.6.0",
     "mockdate": "3.0.5",
     "mockdate": "3.0.5",
-    "moment": "2.29.4",
     "moment-timezone": "0.5.44",
     "moment-timezone": "0.5.44",
     "papaparse": "^5.3.2",
     "papaparse": "^5.3.2",
     "pegjs": "^0.10.0",
     "pegjs": "^0.10.0",

+ 1 - 1
static/app/bootstrap/exportGlobals.tsx

@@ -2,7 +2,7 @@ import * as React from 'react';
 import {findDOMNode} from 'react-dom';
 import {findDOMNode} from 'react-dom';
 import {createRoot} from 'react-dom/client';
 import {createRoot} from 'react-dom/client';
 import * as Sentry from '@sentry/react';
 import * as Sentry from '@sentry/react';
-import moment from 'moment';
+import moment from 'moment-timezone';
 
 
 import plugins from 'sentry/plugins';
 import plugins from 'sentry/plugins';
 
 

+ 1 - 1
static/app/bootstrap/initializeLocale.tsx

@@ -1,5 +1,5 @@
 import * as Sentry from '@sentry/react';
 import * as Sentry from '@sentry/react';
-import * as moment from 'moment';
+import * as moment from 'moment-timezone';
 import * as qs from 'query-string';
 import * as qs from 'query-string';
 
 
 import {DEFAULT_LOCALE_DATA, setLocale} from 'sentry/locale';
 import {DEFAULT_LOCALE_DATA, setLocale} from 'sentry/locale';

+ 1 - 1
static/app/components/avatar/seenByList.tsx

@@ -1,6 +1,6 @@
 import {Fragment} from 'react';
 import {Fragment} from 'react';
 import styled from '@emotion/styled';
 import styled from '@emotion/styled';
-import moment from 'moment';
+import moment from 'moment-timezone';
 
 
 import AvatarList from 'sentry/components/avatar/avatarList';
 import AvatarList from 'sentry/components/avatar/avatarList';
 import {Tooltip} from 'sentry/components/tooltip';
 import {Tooltip} from 'sentry/components/tooltip';

+ 1 - 1
static/app/components/charts/chartZoom.tsx

@@ -6,7 +6,7 @@ import type {
   ToolboxComponentOption,
   ToolboxComponentOption,
   XAXisComponentOption,
   XAXisComponentOption,
 } from 'echarts';
 } from 'echarts';
-import moment from 'moment';
+import moment from 'moment-timezone';
 import * as qs from 'query-string';
 import * as qs from 'query-string';
 
 
 import {updateDateTime} from 'sentry/actionCreators/pageFilters';
 import {updateDateTime} from 'sentry/actionCreators/pageFilters';

+ 1 - 1
static/app/components/charts/components/tooltip.tsx

@@ -3,7 +3,7 @@ import 'echarts/lib/component/tooltip';
 import type {Theme} from '@emotion/react';
 import type {Theme} from '@emotion/react';
 import {useTheme} from '@emotion/react';
 import {useTheme} from '@emotion/react';
 import type {TooltipComponentFormatterCallback, TooltipComponentOption} from 'echarts';
 import type {TooltipComponentFormatterCallback, TooltipComponentOption} from 'echarts';
-import moment from 'moment';
+import moment from 'moment-timezone';
 
 
 import type BaseChart from 'sentry/components/charts/baseChart';
 import type BaseChart from 'sentry/components/charts/baseChart';
 import {t} from 'sentry/locale';
 import {t} from 'sentry/locale';

+ 1 - 1
static/app/components/charts/components/xAxis.spec.tsx

@@ -2,7 +2,7 @@ import type {XAxisProps} from 'sentry/components/charts/components/xAxis';
 import XAxis from 'sentry/components/charts/components/xAxis';
 import XAxis from 'sentry/components/charts/components/xAxis';
 import {lightTheme} from 'sentry/utils/theme';
 import {lightTheme} from 'sentry/utils/theme';
 
 
-jest.mock('moment', () => {
+jest.mock('moment-timezone', () => {
   const moment = jest.requireActual('moment-timezone');
   const moment = jest.requireActual('moment-timezone');
   moment.tz.setDefault('America/Los_Angeles'); // Whatever timezone you want
   moment.tz.setDefault('America/Los_Angeles'); // Whatever timezone you want
   return moment;
   return moment;

+ 1 - 1
static/app/components/charts/percentageAreaChart.tsx

@@ -1,6 +1,6 @@
 import {Component} from 'react';
 import {Component} from 'react';
 import type {LineSeriesOption} from 'echarts';
 import type {LineSeriesOption} from 'echarts';
-import moment from 'moment';
+import moment from 'moment-timezone';
 
 
 import type {Series, SeriesDataUnit} from 'sentry/types/echarts';
 import type {Series, SeriesDataUnit} from 'sentry/types/echarts';
 import toArray from 'sentry/utils/array/toArray';
 import toArray from 'sentry/utils/array/toArray';

+ 1 - 1
static/app/components/charts/useChartZoom.tsx

@@ -6,7 +6,7 @@ import type {
   ToolboxComponentOption,
   ToolboxComponentOption,
   XAXisComponentOption,
   XAXisComponentOption,
 } from 'echarts';
 } from 'echarts';
-import moment from 'moment';
+import moment from 'moment-timezone';
 import * as qs from 'query-string';
 import * as qs from 'query-string';
 
 
 import {updateDateTime} from 'sentry/actionCreators/pageFilters';
 import {updateDateTime} from 'sentry/actionCreators/pageFilters';

+ 1 - 1
static/app/components/charts/utils.tsx

@@ -3,7 +3,7 @@ import * as Sentry from '@sentry/react';
 import type {LegendComponentOption, LineSeriesOption} from 'echarts';
 import type {LegendComponentOption, LineSeriesOption} from 'echarts';
 import type {Location} from 'history';
 import type {Location} from 'history';
 import orderBy from 'lodash/orderBy';
 import orderBy from 'lodash/orderBy';
-import moment from 'moment';
+import moment from 'moment-timezone';
 
 
 import {DEFAULT_STATS_PERIOD} from 'sentry/constants';
 import {DEFAULT_STATS_PERIOD} from 'sentry/constants';
 import type {EventsStats, MultiSeriesEventsStats, PageFilters} from 'sentry/types';
 import type {EventsStats, MultiSeriesEventsStats, PageFilters} from 'sentry/types';

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