mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 05:02:12 +08:00
Performance: Standardize lodash imports to use destructured members (#33040)
* Performance: Standardize lodash imports to use destructured members Changes lodash imports of the form `import x from 'lodash/x'` to `import { x } from 'lodash'` to reduce bundle size. * Remove unnecessary _ import from Graph component * Enforce lodash import style * Fix remaining lodash imports
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import _range from 'lodash/range';
|
||||
import { range as _range } from 'lodash';
|
||||
|
||||
import renderIntoCanvas, {
|
||||
BG_COLOR,
|
||||
|
@ -13,9 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
import * as React from 'react';
|
||||
import _get from 'lodash/get';
|
||||
import _maxBy from 'lodash/maxBy';
|
||||
import _values from 'lodash/values';
|
||||
import { get as _get, maxBy as _maxBy, values as _values } from 'lodash';
|
||||
import MdKeyboardArrowRight from 'react-icons/lib/md/keyboard-arrow-right';
|
||||
import { css } from '@emotion/css';
|
||||
import cx from 'classnames';
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
import cx from 'classnames';
|
||||
import { css } from '@emotion/css';
|
||||
import _groupBy from 'lodash/groupBy';
|
||||
import { groupBy as _groupBy } from 'lodash';
|
||||
import React from 'react';
|
||||
import { compose, onlyUpdateForKeys, withProps, withState } from 'recompose';
|
||||
import { autoColor, createStyle, Theme } from '../Theme';
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
import * as React from 'react';
|
||||
import _sortBy from 'lodash/sortBy';
|
||||
import { sortBy as _sortBy } from 'lodash';
|
||||
import IoIosArrowDown from 'react-icons/lib/io/ios-arrow-down';
|
||||
import IoIosArrowRight from 'react-icons/lib/io/ios-arrow-right';
|
||||
import { css } from '@emotion/css';
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
import React from 'react';
|
||||
import _get from 'lodash/get';
|
||||
import { get as _get } from 'lodash';
|
||||
import IoChevronRight from 'react-icons/lib/io/chevron-right';
|
||||
import IoIosArrowDown from 'react-icons/lib/io/ios-arrow-down';
|
||||
import { css } from '@emotion/css';
|
||||
|
@ -14,12 +14,15 @@
|
||||
|
||||
import * as React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import debounceMock from 'lodash/debounce';
|
||||
// eslint-disable-next-line lodash/import-scope
|
||||
import _ from 'lodash';
|
||||
|
||||
import UiFindInput from './UiFindInput';
|
||||
import { UIInput } from '../uiElementsContext';
|
||||
|
||||
jest.mock('lodash/debounce');
|
||||
const debounceMock = jest.spyOn(_, 'debounce').mockImplementation((func) => {
|
||||
return Object.assign(func, { cancel: jest.fn(), flush: jest.fn() });
|
||||
});
|
||||
|
||||
describe('UiFindInput', () => {
|
||||
const flushMock = jest.fn();
|
||||
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import _uniq from 'lodash/uniq';
|
||||
import { uniq as _uniq } from 'lodash';
|
||||
import memoize from 'lru-memoize';
|
||||
import { getConfigValue } from '../utils/config/get-config';
|
||||
import { getParent } from './span';
|
||||
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import _isEqual from 'lodash/isEqual';
|
||||
import { isEqual as _isEqual } from 'lodash';
|
||||
|
||||
// @ts-ignore
|
||||
import { getTraceSpanIdsAsTree } from '../selectors/trace';
|
||||
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import _values from 'lodash/values';
|
||||
import { values as _values } from 'lodash';
|
||||
|
||||
import { followsFromRef } from './trace.fixture';
|
||||
import {
|
||||
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import _get from 'lodash/get';
|
||||
import { get as _get } from 'lodash';
|
||||
|
||||
import EUpdateTypes from './EUpdateTypes';
|
||||
import { DraggableBounds, DraggingUpdate } from './types';
|
||||
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import _get from 'lodash/get';
|
||||
import { get as _get } from 'lodash';
|
||||
|
||||
import defaultConfig from '../../constants/default-config';
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
import moment from 'moment-timezone';
|
||||
import _round from 'lodash/round';
|
||||
import { round as _round } from 'lodash';
|
||||
|
||||
import { toFloatPrecision } from './number';
|
||||
|
||||
|
@ -12,8 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import _find from 'lodash/find';
|
||||
import _get from 'lodash/get';
|
||||
import { find as _find, get as _get } from 'lodash';
|
||||
|
||||
import { TNil } from '../types';
|
||||
import { TraceSpan } from '../types/trace';
|
||||
|
Reference in New Issue
Block a user