Skip to content

Commit 4797589

Browse files
committed
chore: consistently use direct imports for Lodash functions
This commit replaces barrel imports like ``` import { range } from 'lodash' ``` with direct imports like ``` import range from 'lodash/range' ``` All of these imports are in test code (Lodash is a devDependency only), so this won't affect the build. But it will make code style more consistent, and it should slightly improve test performance.
1 parent ed72f6c commit 4797589

File tree

7 files changed

+9
-7
lines changed

7 files changed

+9
-7
lines changed

src/__a11y__/to-validate-a11y.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
import Axe from 'axe-core';
55
import { HtmlValidate } from 'html-validate';
6-
import { compact, uniq } from 'lodash';
6+
import compact from 'lodash/compact';
7+
import uniq from 'lodash/uniq';
78

89
import { runOptions, spec } from './axe';
910

src/__tests__/snapshot-tests/test-utils-selectors.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import { NodePath, PluginObj, transformSync, types } from '@babel/core';
55
import fs from 'fs';
66
import * as glob from 'glob';
7-
import { flatten, zip } from 'lodash';
7+
import flatten from 'lodash/flatten';
8+
import zip from 'lodash/zip';
89
import path from 'path';
910

1011
// eslint-disable-next-line @typescript-eslint/no-require-imports

src/area-chart/__tests__/area-chart-initial-state.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33
import React from 'react';
44
import { render } from '@testing-library/react';
5-
import { cloneDeep } from 'lodash';
5+
import cloneDeep from 'lodash/cloneDeep';
66

77
import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
88
import { KeyCode } from '@cloudscape-design/test-utils-core/utils';

src/button-group/__integ__/button-group.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
import { range } from 'lodash';
3+
import range from 'lodash/range';
44

55
import { BasePageObject } from '@cloudscape-design/browser-test-tools/page-objects';
66
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

src/i18n/__tests__/i18n.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import React from 'react';
55
import { render } from '@testing-library/react';
66
import * as IntlMessageFormat from 'intl-messageformat';
7-
import { range } from 'lodash';
7+
import range from 'lodash/range';
88

99
import { I18nProvider, I18nProviderProps } from '../../../lib/components/i18n';
1010
import { MESSAGES, TestComponent } from './test-component';

src/multiselect/__integ__/select-all.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
import { range } from 'lodash';
3+
import range from 'lodash/range';
44

55
import { BasePageObject } from '@cloudscape-design/browser-test-tools/page-objects';
66
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

src/table/table-role/__integ__/grid-navigation.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
import { range } from 'lodash';
4+
import range from 'lodash/range';
55

66
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';
77

0 commit comments

Comments
 (0)