mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Don't import react-intl directly to reduce bundle sizes (#102497)
This commit is contained in:
parent
cc6a64514d
commit
be1c5bbd72
25 changed files with 30 additions and 23 deletions
|
@ -75,6 +75,11 @@ module.exports = {
|
|||
to: '@kbn/test',
|
||||
disallowedMessage: `import from the root of @kbn/test instead`
|
||||
},
|
||||
{
|
||||
from: 'react-intl',
|
||||
to: '@kbn/i18n/react',
|
||||
disallowedMessage: `import from @kbn/i18n/react instead`
|
||||
}
|
||||
],
|
||||
],
|
||||
},
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/module_migration
|
||||
import { InjectedIntl as _InjectedIntl, InjectedIntlProps as _InjectedIntlProps } from 'react-intl';
|
||||
export type { InjectedIntl, InjectedIntlProps } from 'react-intl';
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
import * as PropTypes from 'prop-types';
|
||||
import * as React from 'react';
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/module_migration
|
||||
import { IntlProvider } from 'react-intl';
|
||||
|
||||
import * as i18n from '../core';
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import React from 'react';
|
||||
import { FieldFormat } from 'src/plugins/data/public';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
import { UrlFormatEditor } from './url';
|
||||
import { coreMock } from 'src/core/public/mocks';
|
||||
import { createKibanaReactContext } from '../../../../../../kibana_react/public';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { render } from '@testing-library/react';
|
||||
import React, { ReactNode } from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
import { ANOMALY_SEVERITY } from '../../../../common/ml_constants';
|
||||
import { SelectAnomalySeverity } from './select_anomaly_severity';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import React, { ReactNode } from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { UrlGeneratorsStart } from '../../../../../../../src/plugins/share/public/url_generators';
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ import {
|
|||
EuiToolTip,
|
||||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { CoreStart } from 'kibana/public';
|
||||
import { capitalize } from 'lodash';
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { RedirectAppLinks } from '../../../../../../../src/plugins/kibana_react/public';
|
||||
import { IManagementSectionsPluginsSetup, SessionsConfigSchema } from '../';
|
||||
import { SearchSessionStatus } from '../../../../../../../src/plugins/data/common';
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
import { coreMock } from '../../../../../../../src/core/public/mocks';
|
||||
import { TOUR_RESTORE_STEP_KEY, TOUR_TAKING_TOO_LONG_STEP_KEY } from './search_session_tour';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
import { createSearchUsageCollectorMock } from '../../../../../../../src/plugins/data/public/search/collectors/mocks';
|
||||
|
||||
const coreStart = coreMock.createStart();
|
||||
|
|
|
@ -9,7 +9,7 @@ import React, { ReactNode } from 'react';
|
|||
import { screen, render } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { SearchSessionIndicator } from './search_session_indicator';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
import { SearchSessionState } from '../../../../../../../src/plugins/data/public';
|
||||
|
||||
function Container({ children }: { children?: ReactNode }) {
|
||||
|
|
|
@ -7,12 +7,11 @@
|
|||
|
||||
import React from 'react';
|
||||
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import { useValues } from 'kea';
|
||||
|
||||
import { EuiCallOut, EuiLink } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
import { EuiLinkTo } from '../../../shared/react_router_helpers';
|
||||
import { DOCS_PREFIX, ENGINE_SCHEMA_PATH } from '../../routes';
|
||||
|
|
|
@ -26,7 +26,7 @@ import {
|
|||
EuiText,
|
||||
OnTimeChangeProps,
|
||||
} from '@elastic/eui';
|
||||
import { FormattedDate, FormattedMessage } from 'react-intl';
|
||||
import { FormattedMessage, FormattedDate } from '@kbn/i18n/react';
|
||||
import { datemathToEpochMillis } from '../../../../../../../utils/datemath';
|
||||
import { SnapshotMetricType } from '../../../../../../../../common/inventory_models/types';
|
||||
import { withTheme } from '../../../../../../../../../../../src/plugins/kibana_react/common';
|
||||
|
|
|
@ -18,7 +18,7 @@ import {
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { first } from 'lodash';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
interface Row {
|
||||
name: string;
|
||||
|
|
|
@ -9,7 +9,7 @@ import useObservable from 'react-use/lib/useObservable';
|
|||
import mockAnnotations from '../annotations_table/__mocks__/mock_annotations.json';
|
||||
import React from 'react';
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
|
||||
import { Annotation } from '../../../../../common/types/annotations';
|
||||
import { AnnotationUpdatesService } from '../../../services/annotations_service';
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import React from 'react';
|
||||
import { render, waitFor, screen } from '@testing-library/react';
|
||||
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
|
||||
import euiThemeLight from '@elastic/eui/dist/eui_theme_light.json';
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import React from 'react';
|
||||
import { render, fireEvent, waitFor, screen } from '@testing-library/react';
|
||||
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
|
||||
import {
|
||||
getIndexPatternAndSavedSearch,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import React, { ComponentType } from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
import { Observable } from 'rxjs';
|
||||
import { CoreStart } from 'src/core/public';
|
||||
import { EuiThemeProvider } from '../../../../../../../../src/plugins/kibana_react/common';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import React, { ComponentType, useEffect, useState } from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
import { Observable } from 'rxjs';
|
||||
import { CoreStart } from 'src/core/public';
|
||||
import { text } from '@storybook/addon-knobs';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { StoryContext } from '@storybook/react';
|
||||
import React, { ComponentType } from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { AlertsPage } from '.';
|
||||
import { HttpSetup } from '../../../../../../src/core/public';
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { render as testLibRender } from '@testing-library/react';
|
||||
import { AppMountParameters, CoreStart } from 'kibana/public';
|
||||
import React from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
import { of } from 'rxjs';
|
||||
import {
|
||||
KibanaContextProvider,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { mount } from 'enzyme';
|
||||
import React from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
import { coreMock } from '../../../../../src/core/public/mocks';
|
||||
import { BaseParams } from '../../common/types';
|
||||
import { ReportingAPIClient } from '../lib/reporting_api_client';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import React, { useMemo, useContext, useCallback } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { EuiI18nNumber } from '@elastic/eui';
|
||||
import { EventStats } from '../../../common/endpoint/types';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import React, { FC } from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { cloneDeep } from 'lodash';
|
||||
import React from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n/react';
|
||||
|
||||
import { render, waitFor, screen } from '@testing-library/react';
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
EuiText,
|
||||
} from '@elastic/eui';
|
||||
import React, { useCallback } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import * as i18n from '../translations';
|
||||
import { useKibana } from '../../../../../common/lib/kibana';
|
||||
import { useGetApplication } from '../use_get_application';
|
||||
|
|
|
@ -9,7 +9,7 @@ import React, { useEffect, useState } from 'react';
|
|||
import { EuiFlexItem, EuiCard, EuiIcon, EuiFlexGrid, EuiSpacer } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiToolTip } from '@elastic/eui';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { ActionType, ActionTypeIndex, ActionTypeRegistryContract } from '../../../types';
|
||||
import { loadActionTypes } from '../../lib/action_connector_api';
|
||||
import { actionTypeCompare } from '../../lib/action_type_compare';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue