Skip to content

Commit

Permalink
style: enable eslint-plugin-import-rule import/order (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
EAGzzyCSL authored Mar 10, 2022
1 parent 0a7be26 commit 58b998d
Show file tree
Hide file tree
Showing 1,411 changed files with 7,369 additions and 5,252 deletions.
23 changes: 11 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,17 @@ module.exports = {
'prefer-rest-params': 'warn',
'no-control-regex': 'warn',
// 让 import 中的内部包和外部包分组,看起来更美观
// TODO: 会触发大量代码改动,暂时不开启
// 'import/order': [
// 'error',
// {
// groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'unknown'],
// alphabetize: {
// order: 'asc',
// caseInsensitive: true,
// },
// 'newlines-between': 'always',
// },
// ],
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'unknown'],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always',
},
],
'import/no-restricted-paths': [
'error',
{
Expand Down
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const os = require('os');

const { pathsToModuleNameMapper } = require('ts-jest');

const tsconfig = require('./configs/ts/tsconfig.resolve.json');
const os = require('os');

const tsModuleNameMapper = pathsToModuleNameMapper(tsconfig.compilerOptions.paths, { prefix: '<rootDir>/configs/' });

Expand Down
23 changes: 11 additions & 12 deletions packages/addons/__test__/browser/file-search.contribution.test.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes';
import {
CommandService,
CommandServiceImpl,
CommandRegistryImpl,
CommandRegistry,
DisposableCollection,
} from '@opensumi/ide-core-common';
import {
KeybindingRegistry,
KeybindingRegistryImpl,
RecentFilesManager,
ILogger,
PreferenceService,
} from '@opensumi/ide-core-browser';
import {
CommandService,
CommandServiceImpl,
CommandRegistryImpl,
CommandRegistry,
DisposableCollection,
} from '@opensumi/ide-core-common';
import { WorkbenchEditorService } from '@opensumi/ide-editor';
import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser';
import { DocumentSymbol } from '@opensumi/ide-editor/lib/browser/breadcrumb/document-symbol';
import { FileSearchServicePath } from '@opensumi/ide-file-search/lib/common';
import { PrefixQuickOpenService } from '@opensumi/ide-quick-open';
import { QuickOpenHandlerRegistry } from '@opensumi/ide-quick-open/lib/browser/prefix-quick-open.service';
import { FileSearchServicePath } from '@opensumi/ide-file-search/lib/common';
import { IWorkspaceService } from '@opensumi/ide-workspace';
import { DocumentSymbol } from '@opensumi/ide-editor/lib/browser/breadcrumb/document-symbol';
import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser';
import * as modes from '@opensumi/monaco-editor-core/esm/vs/editor/common/modes';

import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper';
import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector';

import { ClientAddonModule } from '../../src/browser';
import {
FileSearchContribution,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {

import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper';
import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector';

import { ClientAddonModule } from '../../src/browser';
import { StatusBarContribution } from '../../src/browser/status-bar-contribution';

Expand Down
1 change: 0 additions & 1 deletion packages/addons/__test__/node/inde.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createNodeInjector } from '../../../../tools/dev-tool/src/injector-helper';
import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector';

import { AddonsModule } from '../../src';

describe('test for ', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Injectable, Autowired } from '@opensumi/di';
import { ClientAppContribution, Domain } from '@opensumi/ide-core-browser';
import { PreferenceSchema, PreferenceSchemaProvider, PreferenceService } from '@opensumi/ide-core-browser';
import { debounce, IReporterService, StaleLRUMap, OnEvent, URI, WithEventBus } from '@opensumi/ide-core-common';
import { EditorDocumentModelSavedEvent, EditorDocumentModelWillSaveEvent } from '@opensumi/ide-editor/lib/browser';
import { IWorkspaceService } from '@opensumi/ide-workspace';
import {
FileOperation,
WorkspaceFileEvent,
IWorkspaceFileOperationParticipant,
IWorkspaceFileService,
} from '@opensumi/ide-workspace-edit';
import { PreferenceSchema, PreferenceSchemaProvider, PreferenceService } from '@opensumi/ide-core-browser';
import { EditorDocumentModelSavedEvent, EditorDocumentModelWillSaveEvent } from '@opensumi/ide-editor/lib/browser';
import { IWorkspaceService } from '@opensumi/ide-workspace';

enum ContentUpdateOperation {
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/addons/src/browser/file-drop.contribution.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Injectable, Autowired } from '@opensumi/di';
import { ClientAppContribution, Domain } from '@opensumi/ide-core-browser';
import { IFileDropFrontendService, IFileDropFrontendServiceToken } from '../common';
import { OnEvent, FileTreeDropEvent, WithEventBus } from '@opensumi/ide-core-common';

import { IFileDropFrontendService, IFileDropFrontendServiceToken } from '../common';

@Injectable()
@Domain(ClientAppContribution)
export class FileDropContribution extends WithEventBus {
Expand Down
9 changes: 5 additions & 4 deletions packages/addons/src/browser/file-drop.service.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { Injectable, Autowired } from '@opensumi/di';
import { WithEventBus } from '@opensumi/ide-core-common/lib';
import { Path } from '@opensumi/ide-components/lib/utils/path';
import { Uri, formatLocalize } from '@opensumi/ide-core-browser/lib';
import { FileTreeDropEvent } from '@opensumi/ide-core-common/lib/types/dnd';
import { IStatusBarService, StatusBarAlignment, StatusBarEntryAccessor } from '@opensumi/ide-core-browser/lib/services';
import { WithEventBus } from '@opensumi/ide-core-common/lib';
import { FileTreeDropEvent } from '@opensumi/ide-core-common/lib/types/dnd';
import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common';

import {
IFileDropFrontendService,
IFileDropBackendService,
FileDropServicePath,
IWebkitDataTransfer,
IWebkitDataTransferItemEntry,
} from '../common';
import { Path } from '@opensumi/ide-components/lib/utils/path';
import { IFileServiceClient } from '@opensumi/ide-file-service/lib/common';

@Injectable()
export class FileDropService extends WithEventBus implements IFileDropFrontendService {
Expand Down
53 changes: 27 additions & 26 deletions packages/addons/src/browser/file-search.contribution.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
import { matchesFuzzy } from '@opensumi/monaco-editor-core/esm/vs/base/common/filters';
/**
* 用于快速打开,检索文件
*/
import fuzzy from 'fuzzy';

import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di';
import {
CommandContribution,
CommandRegistry,
Command,
CancellationTokenSource,
Schemas,
CancellationToken,
IRange,
IReporterService,
REPORT_NAME,
} from '@opensumi/ide-core-common';
import {
localize,
formatLocalize,
Expand All @@ -29,29 +17,42 @@ import {
Highlight,
Mode,
} from '@opensumi/ide-core-browser';
import { LabelService } from '@opensumi/ide-core-browser/lib/services';
import { KeybindingContribution, KeybindingRegistry, ILogger } from '@opensumi/ide-core-browser';
import { getIcon } from '@opensumi/ide-core-browser';
import { RecentFilesManager } from '@opensumi/ide-core-browser';
import { LabelService } from '@opensumi/ide-core-browser/lib/services';
import {
CommandContribution,
CommandRegistry,
Command,
CancellationTokenSource,
Schemas,
CancellationToken,
IRange,
IReporterService,
REPORT_NAME,
} from '@opensumi/ide-core-common';
import { Domain } from '@opensumi/ide-core-common/lib/di-helper';
import { EditorGroupSplitAction, WorkbenchEditorService } from '@opensumi/ide-editor';
import {
QuickOpenContribution,
QuickOpenHandlerRegistry,
} from '@opensumi/ide-quick-open/lib/browser/prefix-quick-open.service';
DocumentSymbolStore,
IDummyRoot,
INormalizedDocumentSymbol,
} from '@opensumi/ide-editor/lib/browser/breadcrumb/document-symbol';
import { FileSearchServicePath, IFileSearchService } from '@opensumi/ide-file-search/lib/common';
import {
QuickOpenModel,
QuickOpenOptions,
PrefixQuickOpenService,
QuickOpenBaseAction,
} from '@opensumi/ide-quick-open';
import { IWorkspaceService } from '@opensumi/ide-workspace';
import { EditorGroupSplitAction, WorkbenchEditorService } from '@opensumi/ide-editor';
import {
DocumentSymbolStore,
IDummyRoot,
INormalizedDocumentSymbol,
} from '@opensumi/ide-editor/lib/browser/breadcrumb/document-symbol';
import { getIcon } from '@opensumi/ide-core-browser';
import { FileSearchServicePath, IFileSearchService } from '@opensumi/ide-file-search/lib/common';
import { RecentFilesManager } from '@opensumi/ide-core-browser';
QuickOpenContribution,
QuickOpenHandlerRegistry,
} from '@opensumi/ide-quick-open/lib/browser/prefix-quick-open.service';
import { IWorkspaceService } from '@opensumi/ide-workspace';
import { matchesFuzzy } from '@opensumi/monaco-editor-core/esm/vs/base/common/filters';
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';

const DEFAULT_FILE_SEARCH_LIMIT = 200;

Expand Down
11 changes: 7 additions & 4 deletions packages/addons/src/browser/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { Injectable } from '@opensumi/di';
import { BrowserModule } from '@opensumi/ide-core-browser';

import { IFileDropFrontendServiceToken, FileDropServicePath } from '../common';

import { FileDropContribution } from './file-drop.contribution';
import { FileDropService } from './file-drop.service';
import { FileSearchContribution } from './file-search.contribution';
import { LanguageChangeHintContribution } from './langauge-change.contribution';
import { StatusBarContribution } from './status-bar-contribution';
import { ToolbarCustomizeContribution } from './toolbar-customize/toolbar-customize.contribution';
import { LanguageChangeHintContribution } from './langauge-change.contribution';
import { FileDropContribution } from './file-drop.contribution';
import { FileDropService } from './file-drop.service';
import { IFileDropFrontendServiceToken, FileDropServicePath } from '../common';


@Injectable()
export class ClientAddonModule extends BrowserModule {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Domain, ClientAppContribution, PreferenceService, IClientApp, localize } from '@opensumi/ide-core-browser';
import { Autowired } from '@opensumi/di';
import { Domain, ClientAppContribution, PreferenceService, IClientApp, localize } from '@opensumi/ide-core-browser';
import { IDialogService } from '@opensumi/ide-overlay';

@Domain(ClientAppContribution)
Expand Down
2 changes: 1 addition & 1 deletion packages/addons/src/browser/status-bar-contribution.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Autowired } from '@opensumi/di';
import { ClientAppContribution } from '@opensumi/ide-core-browser';
import {
BrowserConnectionCloseEvent,
BrowserConnectionOpenEvent,
Expand All @@ -7,7 +8,6 @@ import {
CommandService,
Domain,
} from '@opensumi/ide-core-common';
import { ClientAppContribution } from '@opensumi/ide-core-browser';

@Domain(ClientAppContribution)
export class StatusBarContribution extends WithEventBus implements ClientAppContribution {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Autowired } from '@opensumi/di';
import {
Domain,
CommandContribution,
Expand All @@ -8,10 +9,11 @@ import {
SlotLocation,
localize,
} from '@opensumi/ide-core-browser';
import { Autowired } from '@opensumi/di';
import { ToolbarCustomizeComponent, ToolbarCustomizeViewService } from './toolbar-customize';
import { MenuContribution, IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next';

import { ToolbarCustomizeComponent, ToolbarCustomizeViewService } from './toolbar-customize';


@Domain(CommandContribution, ComponentContribution, MenuContribution)
export class ToolbarCustomizeContribution implements CommandContribution, ComponentContribution, MenuContribution {
@Autowired(AppConfig)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React from 'react';

import { Injectable, Autowired } from '@opensumi/di';
import { CheckBox, Select, Button } from '@opensumi/ide-components';
import {
useInjectable,
PreferenceService,
PreferenceScope,
IToolbarRegistry,
localize,
} from '@opensumi/ide-core-browser';

import styles from './style.module.less';
import { CheckBox, Select, Button } from '@opensumi/ide-components';

@Injectable()
export class ToolbarCustomizeViewService {
Expand Down
3 changes: 2 additions & 1 deletion packages/addons/src/node/file-drop.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import fs from 'fs';
import path from 'path';
import { Uri } from '@opensumi/ide-core-common';

import { Injectable } from '@opensumi/di';
import { Uri } from '@opensumi/ide-core-common';

import { IFileDropBackendService } from '../common';
@Injectable()
Expand Down
4 changes: 3 additions & 1 deletion packages/addons/src/node/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Provider, Injectable } from '@opensumi/di';
import { NodeModule } from '@opensumi/ide-core-node';
import { FileDropService } from './file-drop.service';

import { IFileDropServiceToken, FileDropServicePath } from '../common';

import { FileDropService } from './file-drop.service';

@Injectable()
export class AddonsModule extends NodeModule {
providers: Provider[] = [
Expand Down
15 changes: 8 additions & 7 deletions packages/comments/__test__/browser/comment-thread.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper';
import { CommentsModule } from '../../src/browser';
import { Injector } from '@opensumi/di';
import { ICommentsService, CommentMode } from '../../src/common';
import { URI, positionToRange } from '@opensumi/ide-core-common';
import { IContextKeyService } from '@opensumi/ide-core-browser';
import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service';
import { createMockedMonaco } from '../../../monaco/__mocks__/monaco';
import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector';
import { URI, positionToRange } from '@opensumi/ide-core-common';
import { IIconService } from '@opensumi/ide-theme';
import { IconService } from '@opensumi/ide-theme/lib/browser';

import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper';
import { MockInjector } from '../../../../tools/dev-tool/src/mock-injector';
import { createMockedMonaco } from '../../../monaco/__mocks__/monaco';
import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service';
import { CommentsModule } from '../../src/browser';
import { ICommentsService, CommentMode } from '../../src/common';

describe('comment service test', () => {
let injector: MockInjector;
let commentsService: ICommentsService;
Expand Down
21 changes: 11 additions & 10 deletions packages/comments/__test__/browser/comment.service.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper';
import { CommentsModule } from '../../src/browser';
import { Injector } from '@opensumi/di';
import { ICommentsService, CommentMode } from '../../src/common';
import { URI, positionToRange, Disposable } from '@opensumi/ide-core-common';
import { IContextKeyService } from '@opensumi/ide-core-browser';
import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service';
import { createMockedMonaco } from '../../../monaco/__mocks__/monaco';
import { MockInjector, mockService } from '../../../../tools/dev-tool/src/mock-injector';
import { IIconService } from '@opensumi/ide-theme';
import { IconService } from '@opensumi/ide-theme/lib/browser';
import { URI, positionToRange, Disposable } from '@opensumi/ide-core-common';
import { IEditor, EditorCollectionService, ResourceService } from '@opensumi/ide-editor';
import { ResourceServiceImpl } from '@opensumi/ide-editor/lib/browser/resource.service';
import { IEditorDecorationCollectionService } from '@opensumi/ide-editor/lib/browser';
import { ResourceServiceImpl } from '@opensumi/ide-editor/lib/browser/resource.service';
import { IIconService } from '@opensumi/ide-theme';
import { IconService } from '@opensumi/ide-theme/lib/browser';

import { createBrowserInjector } from '../../../../tools/dev-tool/src/injector-helper';
import { MockInjector, mockService } from '../../../../tools/dev-tool/src/mock-injector';
import { createMockedMonaco } from '../../../monaco/__mocks__/monaco';
import { MockContextKeyService } from '../../../monaco/__mocks__/monaco.context-key.service';
import { CommentsModule } from '../../src/browser';
import { ICommentsService, CommentMode } from '../../src/common';

describe('comment service test', () => {
let injector: MockInjector;
Expand Down
Loading

0 comments on commit 58b998d

Please sign in to comment.