Skip to content

Commit 29c4048

Browse files
authored
Merge pull request #6518 from hayemaxi/eslint-import-index
ci(lint): rule to detect index.ts imports in core
2 parents 5213237 + 6c1ff4b commit 29c4048

File tree

325 files changed

+681
-445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+681
-445
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ module.exports = {
180180
'aws-toolkits/no-console-log': 'error',
181181
'aws-toolkits/no-json-stringify-in-log': 'error',
182182
'aws-toolkits/no-printf-mismatch': 'error',
183+
'aws-toolkits/no-index-import': 'error',
183184
'no-restricted-imports': [
184185
'error',
185186
{

packages/core/src/amazonq/commons/connector/baseMessenger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import { ChatItemAction, ProgressField } from '@aws/mynah-ui'
77
import { AuthFollowUpType, AuthMessageDataMap } from '../../../amazonq/auth/model'
8-
import { FeatureAuthState } from '../../../codewhisperer'
98
import { i18n } from '../../../shared/i18n-helper'
109
import { CodeReference } from '../../../amazonq/webview/ui/connector'
1110

@@ -28,6 +27,7 @@ import {
2827
import { FollowUpTypes } from '../types'
2928
import { messageWithConversationId } from '../../../amazonqFeatureDev/userFacingText'
3029
import { DeletedFileInfo, NewFileInfo } from '../../../amazonqFeatureDev/types'
30+
import { FeatureAuthState } from '../../../codewhisperer/util/authUtil'
3131

3232
export class Messenger {
3333
public constructor(

packages/core/src/amazonq/commons/controllers/contentController.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as vscode from 'vscode'
77
import path from 'path'
88
import { Position, TextEditor, window } from 'vscode'
9-
import { getLogger } from '../../../shared/logger'
9+
import { getLogger } from '../../../shared/logger/logger'
1010
import { amazonQDiffScheme, amazonQTabSuffix } from '../../../shared/constants'
1111
import { disposeOnEditorClose } from '../../../shared/utilities/editorUtilities'
1212
import {
@@ -15,7 +15,9 @@ import {
1515
getIndentedCode,
1616
getSelectionFromRange,
1717
} from '../../../shared/utilities/textDocumentUtilities'
18-
import { extractFileAndCodeSelectionFromMessage, fs, getErrorMsg, ToolkitError } from '../../../shared'
18+
import { ToolkitError, getErrorMsg } from '../../../shared/errors'
19+
import fs from '../../../shared/fs/fs'
20+
import { extractFileAndCodeSelectionFromMessage } from '../../../shared/utilities/textUtilities'
1921
import { UserWrittenCodeTracker } from '../../../codewhisperer/tracker/userWrittenCodeTracker'
2022

2123
export class ContentProvider implements vscode.TextDocumentContentProvider {

packages/core/src/amazonq/commons/diff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import * as vscode from 'vscode'
7-
import { fs } from '../../shared'
7+
import { fs } from '../../shared/fs/fs'
88
import { diffLines } from 'diff'
99

1010
export async function openDiff(leftPath: string, rightPath: string, tabId: string, scheme: string) {

packages/core/src/amazonq/commons/session/sessionConfigFactory.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66
import * as vscode from 'vscode'
77
import { WorkspaceFolderNotFoundError } from '../../../amazonqFeatureDev/errors'
8-
import { VirtualFileSystem, VirtualMemoryFile } from '../../../shared'
98
import { CurrentWsFolders } from '../../../amazonqFeatureDev/types'
9+
import { VirtualFileSystem } from '../../../shared/virtualFilesystem'
10+
import { VirtualMemoryFile } from '../../../shared/virtualMemoryFile'
1011

1112
export interface SessionConfig {
1213
// The paths on disk to where the source code lives

packages/core/src/amazonq/explorer/amazonQChildrenNodes.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ import { installAmazonQExtension } from '../../codewhisperer/commands/basicComma
1111
import { amazonQHelpUrl } from '../../shared/constants'
1212
import { cwTreeNodeSource } from '../../codewhisperer/commands/types'
1313
import { VSCODE_EXTENSION_ID } from '../../shared/extensions'
14-
import { globals, setContext } from '../../shared'
15-
import { ExtStartUpSources, telemetry } from '../../shared/telemetry'
14+
import globals from '../../shared/extensionGlobals'
15+
import { setContext } from '../../shared/vscode/setContext'
16+
import { telemetry } from '../../shared/telemetry/telemetry'
17+
import { ExtStartUpSources } from '../../shared/telemetry/util'
1618
import { ExtensionUse } from '../../auth/utils'
1719

1820
const localize = nls.loadMessageBundle()

packages/core/src/amazonq/extApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
*/
55

66
import vscode from 'vscode'
7-
import { VSCODE_EXTENSION_ID } from '../shared/utilities'
7+
import { VSCODE_EXTENSION_ID } from '../shared/extensions'
88
import { SendMessageCommandOutput, SendMessageRequest } from '@amzn/amazon-q-developer-streaming-client'
99
import { GenerateAssistantResponseCommandOutput, GenerateAssistantResponseRequest } from '@amzn/codewhisperer-streaming'
1010
import { FeatureAuthState } from '../codewhisperer/util/authUtil'
11-
import { ToolkitError } from '../shared'
11+
import { ToolkitError } from '../shared/errors'
1212

1313
/**
1414
* This interface is used and exported by the amazon q extension. If you make a change here then

packages/core/src/amazonq/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export { ExtensionMessage } from '../amazonq/webview/ui/commands'
4343
export { CodeReference } from '../codewhispererChat/view/connector/connector'
4444
export { extractAuthFollowUp } from './util/authUtils'
4545
export { Messenger } from './commons/connector/baseMessenger'
46-
import { FeatureContext } from '../shared'
46+
import { FeatureContext } from '../shared/featureConfig'
4747

4848
/**
4949
* main from createMynahUI is a purely browser dependency. Due to this

packages/core/src/amazonq/lsp/lspClient.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ import {
3232
} from './types'
3333
import { Writable } from 'stream'
3434
import { CodeWhispererSettings } from '../../codewhisperer/util/codewhispererSettings'
35-
import { fs, getLogger, globals } from '../../shared'
35+
import { fs } from '../../shared/fs/fs'
36+
import { getLogger } from '../../shared/logger/logger'
37+
import globals from '../../shared/extensionGlobals'
3638

3739
const localize = nls.loadMessageBundle()
3840

packages/core/src/amazonq/lsp/lspController.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ import AdmZip from 'adm-zip'
1616
import { RelevantTextDocument } from '@amzn/codewhisperer-streaming'
1717
import { makeTemporaryToolkitFolder, tryRemoveFolder } from '../../shared/filesystemUtilities'
1818
import { activate as activateLsp } from './lspClient'
19-
import { telemetry } from '../../shared/telemetry'
19+
import { telemetry } from '../../shared/telemetry/telemetry'
2020
import { isCloud9 } from '../../shared/extensionUtilities'
21-
import { fs, globals, ToolkitError } from '../../shared'
21+
import { fs } from '../../shared/fs/fs'
22+
import globals from '../../shared/extensionGlobals'
23+
import { ToolkitError } from '../../shared/errors'
2224
import { isWeb } from '../../shared/extensionGlobals'
2325
import { getUserAgent } from '../../shared/telemetry/util'
2426
import { isAmazonInternalOs } from '../../shared/vscode/env'

0 commit comments

Comments
 (0)