Skip to content

Commit

Permalink
[Enterprise Search] Fix eslint import rule not ordering sibling mocks…
Browse files Browse the repository at this point in the history
… with parent mocks (#96070)

* Enterprise Search eslint import order rule fix
- mocks in current folder should be grouped with mocks from parent folders

* Run --fix/update instances of importing ./__mocks__
  • Loading branch information
Constance authored Apr 2, 2021
1 parent f042ec8 commit 3237fd0
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ module.exports = {
pathGroups: [
{
pattern:
'{../../../../../../,../../../../../,../../../../,../../../,../../,../}{common/,*}__mocks__{*,/**}',
'{../../../../../../,../../../../../,../../../../,../../../,../../,../,./}{common/,*}__mocks__{*,/**}',
group: 'unknown',
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { setMockValues } from '../../../../__mocks__/kea.mock';
import { setMockSearchContextState } from './__mocks__/hooks.mock';

import React from 'react';

Expand All @@ -16,7 +17,6 @@ import { Results } from '@elastic/react-search-ui';

import { SchemaTypes } from '../../../../shared/types';

import { setMockSearchContextState } from './__mocks__/hooks.mock';
import { Pagination } from './pagination';
import { SearchExperienceContent } from './search_experience_content';
import { ResultView } from './views';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* 2.0.
*/

import { wsRoleMapping, asRoleMapping } from './__mocks__/roles';

import React from 'react';

import { shallow } from 'enzyme';

import { EuiFieldSearch, EuiTableRow } from '@elastic/eui';

import { wsRoleMapping, asRoleMapping } from './__mocks__/roles';

import { ALL_LABEL, ANY_AUTH_PROVIDER_OPTION_LABEL } from './constants';

import { RoleMappingsTable } from './role_mappings_table';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import {
mockHttpValues,
} from '../../../__mocks__';
import { groups } from '../../__mocks__/groups.mock';
import { mockGroupValues } from './__mocks__/group_logic.mock';

import { nextTick } from '@kbn/test/jest';

import { GROUPS_PATH } from '../../routes';

import { mockGroupValues } from './__mocks__/group_logic.mock';
import { GroupLogic } from './group_logic';

describe('GroupLogic', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { LogicMounter, mockFlashMessageHelpers, mockHttpValues } from '../../../
import { contentSources } from '../../__mocks__/content_sources.mock';
import { groups } from '../../__mocks__/groups.mock';
import { users } from '../../__mocks__/users.mock';
import { mockGroupsValues } from './__mocks__/groups_logic.mock';

import { nextTick } from '@kbn/test/jest';

import { JSON_HEADER as headers } from '../../../../../common/constants';
import { DEFAULT_META } from '../../../shared/constants';

import { mockGroupsValues } from './__mocks__/groups_logic.mock';
import { GroupsLogic } from './groups_logic';

// We need to mock out the debounced functionality
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { mockTelemetryActions } from '../../../__mocks__';

import { setMockValues } from './__mocks__';
import './__mocks__/overview_logic.mock';

import React from 'react';
Expand All @@ -15,7 +15,6 @@ import { shallow } from 'enzyme';

import { SOURCES_PATH, USERS_PATH } from '../../routes';

import { setMockValues } from './__mocks__';
import { OnboardingCard } from './onboarding_card';
import { OnboardingSteps, OrgNameOnboarding } from './onboarding_steps';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { setMockValues } from './__mocks__';
import './__mocks__/overview_logic.mock';

import React from 'react';
Expand All @@ -13,7 +14,6 @@ import { shallow } from 'enzyme';

import { EuiFlexGrid } from '@elastic/eui';

import { setMockValues } from './__mocks__';
import { OrganizationStats } from './organization_stats';
import { StatisticCard } from './statistic_card';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import '../../../__mocks__/react_router_history.mock';
import './__mocks__/overview_logic.mock';
import { mockActions, setMockValues } from './__mocks__';

import React from 'react';

Expand All @@ -15,7 +16,6 @@ import { shallow, mount } from 'enzyme';
import { Loading } from '../../../shared/loading';
import { ViewContentHeader } from '../../components/shared/view_content_header';

import { mockActions, setMockValues } from './__mocks__';
import { OnboardingSteps } from './onboarding_steps';
import { OrganizationStats } from './organization_stats';
import { Overview } from './overview';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import { LogicMounter, mockHttpValues } from '../../../__mocks__';

import { mockOverviewValues } from './__mocks__';

import { OverviewLogic } from './overview_logic';

describe('OverviewLogic', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { mockTelemetryActions } from '../../../__mocks__';

import { setMockValues } from './__mocks__';
import './__mocks__/overview_logic.mock';

import React from 'react';
Expand All @@ -18,7 +18,6 @@ import { FormattedMessage } from '@kbn/i18n/react';

import { EuiLinkTo } from '../../../shared/react_router_helpers';

import { setMockValues } from './__mocks__';
import { RecentActivity, RecentActivityItem } from './recent_activity';

const organization = { name: 'foo', defaultOrgName: 'bar' };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { mockTelemetryActions } from '../../../__mocks__';

import { setMockValues } from './__mocks__';
import './__mocks__/overview_logic.mock';

import React from 'react';
Expand All @@ -15,7 +15,6 @@ import { shallow } from 'enzyme';

import { SOURCES_PATH, USERS_PATH } from '../../routes';

import { setMockValues } from './__mocks__';
import { OnboardingCard } from './onboarding_card';
import { OnboardingSteps, OrgNameOnboarding } from './onboarding_steps';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { setMockValues } from './__mocks__';
import './__mocks__/overview_logic.mock';

import React from 'react';
Expand All @@ -13,7 +14,6 @@ import { shallow } from 'enzyme';

import { EuiFlexGrid } from '@elastic/eui';

import { setMockValues } from './__mocks__';
import { OrganizationStats } from './organization_stats';
import { StatisticCard } from './statistic_card';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import '../../../__mocks__/react_router_history.mock';
import './__mocks__/overview_logic.mock';
import { mockActions, setMockValues } from './__mocks__';

import React from 'react';

Expand All @@ -15,7 +16,6 @@ import { shallow, mount } from 'enzyme';
import { Loading } from '../../../shared/loading';
import { ViewContentHeader } from '../../components/shared/view_content_header';

import { mockActions, setMockValues } from './__mocks__';
import { OnboardingSteps } from './onboarding_steps';
import { OrganizationStats } from './organization_stats';
import { Overview } from './overview';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import { LogicMounter, mockHttpValues } from '../../../__mocks__';

import { mockOverviewValues } from './__mocks__';

import { OverviewLogic } from './overview_logic';

describe('OverviewLogic', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { mockTelemetryActions } from '../../../__mocks__';

import { setMockValues } from './__mocks__';
import './__mocks__/overview_logic.mock';

import React from 'react';
Expand All @@ -16,7 +16,6 @@ import { shallow } from 'enzyme';
import { EuiEmptyPrompt, EuiLink } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

import { setMockValues } from './__mocks__';
import { RecentActivity, RecentActivityItem } from './recent_activity';

const organization = { name: 'foo', defaultOrgName: 'bar' };
Expand Down

0 comments on commit 3237fd0

Please sign in to comment.