import-js / import-js/eslint-plugin-import
[import/order] rule needed to be run 6 times before it actually sorted
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
I'm trying to use import/order in Insomnia instead of eslint-plugin-simple-import-sort. One problem we hit is that some files in the project needed the rule to run multiple times in order for the rule to work. One of the worst ones required the rule to be run 6 times before it worked:
Here is the input:
import React, { PureComponent, RefObject } from 'react';
import { autoBindMethodsForReact } from 'class-autobind-decorator';
import {
AUTOBIND_CFG,
ACTIVITY_HOME,
COLLAPSE_SIDEBAR_REMS,
DEFAULT_PANE_HEIGHT,
DEFAULT_PANE_WIDTH,
DEFAULT_SIDEBAR_WIDTH,
getAppName,
MAX_PANE_HEIGHT,
MAX_PANE_WIDTH,
MAX_SIDEBAR_REMS,
MIN_PANE_HEIGHT,
MIN_PANE_WIDTH,
MIN_SIDEBAR_REMS,
PREVIEW_MODE_SOURCE,
ACTIVITY_MIGRATION,
SortOrder,
} from '../../common/constants';
import fs from 'fs';
import { clipboard, ipcRenderer, remote, SaveDialogOptions } from 'electron';
import { parse as urlParse } from 'url';
import HTTPSnippet from 'httpsnippet';
import ReactDOM from 'react-dom';
import { connect } from 'react-redux';
import { Action, bindActionCreators, Dispatch } from 'redux';
import Wrapper from '../components/wrapper';
import WorkspaceEnvironmentsEditModal from '../components/modals/workspace-environments-edit-modal';
import Toast from '../components/toast';
import CookiesModal from '../components/modals/cookies-modal';
import RequestSwitcherModal from '../components/modals/request-switcher-modal';
import SettingsModal, { TAB_INDEX_SHORTCUTS } from '../components/modals/settings-modal';
import {
importUri,
loadRequestStart,
loadRequestStop,
newCommand,
setActiveWorkspace,
setActiveActivity,
goToNextActivity,
importFile,
importClipBoard,
exportRequestsToFile,
} from '../redux/modules/global';
import { initialize } from '../redux/modules/entities';
import { database as db } from '../../common/database';
import * as models from '../../models';
import {
selectActiveCookieJar,
selectActiveEnvironment,
selectActiveGitRepository,
selectActiveOAuth2Token,
selectActiveRequest,
selectActiveRequestMeta,
selectActiveRequestResponses,
selectActiveResponse,
selectActiveSpace,
selectActiveUnitTestResult,
selectActiveUnitTests,
selectActiveUnitTestSuite,
selectActiveUnitTestSuites,
selectActiveWorkspace,
selectActiveWorkspaceClientCertificates,
selectActiveWorkspaceMeta,
selectEntitiesLists,
selectSettings,
selectSyncItems,
selectUnseenWorkspaces,
selectWorkspaceRequestsAndRequestGroups,
selectWorkspacesForActiveSpace,
} from '../redux/selectors';
import { selectSidebarChildren } from '../redux/sidebar-selectors';
import RequestCreateModal from '../components/modals/request-create-modal';
import GenerateCodeModal from '../components/modals/generate-code-modal';
import WorkspaceSettingsModal from '../components/modals/workspace-settings-modal';
import RequestSettingsModal from '../components/modals/request-settings-modal';
import RequestRenderErrorModal from '../components/modals/request-render-error-modal';
import * as network from '../../network/network';
import {
debounce,
generateId,
getContentDispositionHeader,
} from '../../common/misc';
import { getDataDirectory } from '../../common/electron-helpers';
import * as mime from 'mime-types';
import * as path from 'path';
import * as render from '../../common/render';
import { getKeys } from '../../templating/utils';
import { showAlert, showModal, showPrompt } from '../components/modals/index';
import { exportHarRequest } from '../../common/har';
import { hotKeyRefs } from '../../common/hotkeys';
import { executeHotKey } from '../../common/hotkeys-listener';
import KeydownBinder from '../components/keydown-binder';
import ErrorBoundary from '../components/error-boundary';
import * as plugins from '../../plugins';
import * as templating from '../../templating/index';
import { NUNJUCKS_TEMPLATE_GLOBAL_PROPERTY_NAME } from '../../templating/index';
import AskModal from '../components/modals/ask-modal';
import { Request, updateMimeType } from '../../models/request';
import * as themes from '../../plugins/misc';
import FileSystemDriver from '../../sync/store/drivers/file-system-driver';
import { VCS } from '../../sync/vcs/vcs';
import SyncMergeModal from '../components/modals/sync-merge-modal';
import { GitVCS, GIT_CLONE_DIR, GIT_INSOMNIA_DIR, GIT_INTERNAL_DIR } from '../../sync/git/git-vcs';
import { NeDBClient } from '../../sync/git/ne-db-client';
import { fsClient } from '../../sync/git/fs-client';
import { routableFSClient } from '../../sync/git/routable-fs-client';
import { getWorkspaceLabel } from '../../common/get-workspace-label';
import * as requestOperations from '../../models/helpers/request-operations';
import { GrpcProvider } from '../context/grpc';
import { sortMethodMap } from '../../common/sorting';
import withDragDropContext from '../context/app/drag-drop-context';
import { trackSegmentEvent } from '../../common/analytics';
import getWorkspaceName from '../../models/helpers/get-workspace-name';
import * as workspaceOperations from '../../models/helpers/workspace-operations';
import { isCollection, isWorkspace } from '../../models/workspace';
import { GrpcRequest, isGrpcRequest, isGrpcRequestId } from '../../models/grpc-request';
import { isEnvironment } from '../../models/environment';
import { GrpcRequestMeta } from '../../models/grpc-request-meta';
import { RequestMeta } from '../../models/request-meta';
import { isRequestGroup, RequestGroup } from '../../models/request-group';
import { WorkspaceMeta } from '../../models/workspace-meta';
import { Response } from '../../models/response';
import { RenderContextAndKeys } from '../../common/render';
import { RootState } from '../redux/modules';
This seems broken maybe? I say that in part because simple-import-sort sorts it in one pass.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names packages/insomnia-app/app/ui/containers/app.tsx but no eslint-plugin-import source file or regression test. Start by reproducing the supplied imports with import/order, then trace the rule's sorting entry point. Done means the imports reach the expected order in one pass and a regression test covers the case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100