Skip to content

Commit

Permalink
Eslint rule for platform (#10544)
Browse files Browse the repository at this point in the history
* update for types

* move constants into platform

* eslint rule enforced for platform
  • Loading branch information
rebornix authored Jun 23, 2022
1 parent 4af7b2a commit 923275a
Show file tree
Hide file tree
Showing 53 changed files with 655 additions and 671 deletions.
11 changes: 6 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,6 @@ module.exports = {
{
target: './src/**[!test,standalone,webviews]**/**/*.ts',
from: './src/webviews/**/*.ts',
except: [
'**/src/webviews/webview-side/common/constants.ts',
'**/src/webviews/types',
],
message: 'Importing modules from ./src/webviews into core components (platform, kernels, notebooks, interactive-window) is not allowed.'
},
{
Expand All @@ -332,7 +328,12 @@ module.exports = {
{
target: './src/telemetry/**/**[!types]**.ts',
from: './src/**[!telemetry,platform]**/**/*.ts',
message: 'Importing non-platform modules into telemetry files is not allowed.'
message: 'Importing non-telemetry modules into telemetry files is not allowed.'
},
{
target: './src/platform/**/*.ts',
from: './src/**[!platform]**/**/*.ts',
message: 'Importing non-platform modules into platform files is not allowed.'
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Uri,
ViewColumn
} from 'vscode';
import { IShowDataViewerFromVariablePanel } from './platform/messageTypes';
import { IShowDataViewerFromVariablePanel } from './messageTypes';
import { Commands as DSCommands } from './platform/common/constants';
import { PythonEnvironment } from './platform/pythonEnvironments/info';
import { CommandSource } from './platform/testing/common/constants';
Expand Down
9 changes: 7 additions & 2 deletions src/extension.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import { Common, OutputChannelNames } from './platform/common/utils/localize';
import { IServiceContainer, IServiceManager } from './platform/ioc/types';
import { sendErrorTelemetry, sendStartupTelemetry } from './platform/telemetry/startupTelemetry';
import { noop } from './platform/common/utils/misc';
import { PythonExtension } from './webviews/webview-side/common/constants';
import { registerTypes as registerPlatformTypes } from './platform/serviceRegistry.node';
import { registerTypes as registerKernelTypes } from './kernels/serviceRegistry.node';
import { registerTypes as registerNotebookTypes } from './notebooks/serviceRegistry.node';
Expand All @@ -75,7 +74,13 @@ import { registerTypes as registerTelemetryTypes } from './platform/telemetry/se
import { registerTypes as registerIntellisenseTypes } from './intellisense/serviceRegistry.node';
import { registerTypes as registerWebviewTypes } from './webviews/extension-side/serviceRegistry.node';
import { IExtensionActivationManager } from './platform/activation/types';
import { isCI, isTestExecution, JUPYTER_OUTPUT_CHANNEL, STANDARD_OUTPUT_CHANNEL } from './platform/common/constants';
import {
isCI,
isTestExecution,
JUPYTER_OUTPUT_CHANNEL,
PythonExtension,
STANDARD_OUTPUT_CHANNEL
} from './platform/common/constants';
import { getDisplayPath } from './platform/common/platform/fs-paths';
import { IFileSystemNode } from './platform/common/platform/types.node';
import { getJupyterOutputChannel } from './standalone/devTools/jupyterOutputChannel';
Expand Down
9 changes: 7 additions & 2 deletions src/extension.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import { Common, OutputChannelNames } from './platform/common/utils/localize';
import { IServiceContainer, IServiceManager } from './platform/ioc/types';
import { sendErrorTelemetry, sendStartupTelemetry } from './platform/telemetry/startupTelemetry';
import { noop } from './platform/common/utils/misc';
import { PythonExtension } from './webviews/webview-side/common/constants';
import { registerTypes as registerPlatformTypes } from './platform/serviceRegistry.web';
import { registerTypes as registerTelemetryTypes } from './platform/telemetry/serviceRegistry.web';
import { registerTypes as registerKernelTypes } from './kernels/serviceRegistry.web';
Expand All @@ -73,7 +72,13 @@ import { registerTypes as registerTerminalTypes } from './platform/terminals/ser
import { registerTypes as registerStandaloneTypes } from './standalone/serviceRegistry.web';
import { registerTypes as registerWebviewTypes } from './webviews/extension-side/serviceRegistry.web';
import { IExtensionActivationManager } from './platform/activation/types';
import { isCI, isTestExecution, JUPYTER_OUTPUT_CHANNEL, STANDARD_OUTPUT_CHANNEL } from './platform/common/constants';
import {
isCI,
isTestExecution,
JUPYTER_OUTPUT_CHANNEL,
PythonExtension,
STANDARD_OUTPUT_CHANNEL
} from './platform/common/constants';
import { getJupyterOutputChannel } from './standalone/devTools/jupyterOutputChannel';
import { registerLogger, setLoggingLevel } from './platform/logging';
import { Container } from 'inversify/lib/container/container';
Expand Down
3 changes: 1 addition & 2 deletions src/intellisense/logReplayService.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import * as lspConcat from '@vscode/lsp-notebook-concat';
import * as protocol from 'vscode-languageserver-protocol';
import { IExtensionSingleActivationService } from '../platform/activation/types';
import { ICommandManager, IApplicationShell } from '../platform/common/application/types';
import { PYTHON_LANGUAGE, NOTEBOOK_SELECTOR } from '../platform/common/constants';
import { PYTHON_LANGUAGE, NOTEBOOK_SELECTOR, Commands, EditorContexts } from '../platform/common/constants';
import { ContextKey } from '../platform/common/contextKey';
import { traceInfo } from '../platform/logging';
import { IFileSystemNode } from '../platform/common/platform/types.node';
import { IDisposableRegistry, IConfigurationService } from '../platform/common/types';
import { Commands, EditorContexts } from '../webviews/webview-side/common/constants';
import { sleep, waitForCondition } from '../platform/common/utils/async';
import { noop, swallowExceptions } from '../platform/common/utils/misc';

Expand Down
2 changes: 1 addition & 1 deletion src/interactive-window/interactiveWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { InteractiveCellResultError } from '../platform/errors/interactiveCellRe
import { DataScience } from '../platform/common/utils/localize';
import { createDeferred, Deferred } from '../platform/common/utils/async';
import { IServiceContainer } from '../platform/ioc/types';
import { SysInfoReason } from '../platform/messageTypes';
import { SysInfoReason } from '../messageTypes';
import { createOutputWithErrorMessageForDisplay } from '../platform/errors/errorUtils';
import { INotebookExporter } from '../kernels/jupyter/types';
import { IExportDialog, ExportFormat } from '../notebooks/export/types';
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { isCI, PYTHON_LANGUAGE, Telemetry } from '../platform/common/constants';
import { traceError, traceInfo, traceInfoIfCI, traceWarning } from '../platform/logging';
import { getDisplayPath, getFilePath } from '../platform/common/platform/fs-paths';
import { DataScience } from '../platform/common/utils/localize';
import { SysInfoReason } from '../platform/messageTypes';
import { SysInfoReason } from '../messageTypes';
import { getNormalizedInterpreterPath, getInterpreterHash } from '../platform/pythonEnvironments/info/interpreter';
import { getTelemetrySafeVersion } from '../platform/telemetry/helpers';
import { EnvironmentType, PythonEnvironment } from '../platform/pythonEnvironments/info';
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/ipywidgets/commonMessageCoordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
IPyWidgetMessages,
LoadIPyWidgetClassLoadAction,
NotifyIPyWidgetWidgetVersionNotSupportedAction
} from '../../platform/messageTypes';
} from '../../messageTypes';
import { IServiceContainer } from '../../platform/ioc/types';
import { sendTelemetryEvent, Telemetry } from '../../telemetry';
import { getTelemetrySafeHashedString } from '../../platform/telemetry/helpers';
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/ipywidgets/ipyWidgetMessageDispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { IDisposable } from '../../platform/common/types';
import { Deferred, createDeferred } from '../../platform/common/utils/async';
import { noop } from '../../platform/common/utils/misc';
import { deserializeDataViews, serializeDataViews } from '../../platform/common/utils/serializers';
import { IPyWidgetMessages, IInteractiveWindowMapping } from '../../platform/messageTypes';
import { IPyWidgetMessages, IInteractiveWindowMapping } from '../../messageTypes';
import { sendTelemetryEvent, Telemetry } from '../../telemetry';
import { IKernel, IKernelProvider, KernelSocketInformation } from '../types';
import { WIDGET_MIMETYPE } from './constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { inject, injectable } from 'inversify';
import { Event, EventEmitter, NotebookDocument } from 'vscode';
import { IDisposable, IDisposableRegistry } from '../../platform/common/types';
import { IPyWidgetMessages } from '../../platform/messageTypes';
import { IPyWidgetMessages } from '../../messageTypes';
import { getAssociatedNotebookDocument } from '../helpers';
import { IKernel, IKernelProvider } from '../types';
import { IPyWidgetMessageDispatcher } from './ipyWidgetMessageDispatcher';
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/ipywidgets/ipyWidgetScriptSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type * as jupyterlabService from '@jupyterlab/services';
import { Event, EventEmitter, NotebookDocument, Uri } from 'vscode';
import { traceError, traceInfo, traceVerbose, traceWarning } from '../../platform/logging';
import { IDisposableRegistry, IConfigurationService, IHttpClient, IDisposable } from '../../platform/common/types';
import { InteractiveWindowMessages, IPyWidgetMessages } from '../../platform/messageTypes';
import { InteractiveWindowMessages, IPyWidgetMessages } from '../../messageTypes';
import { sendTelemetryEvent, Telemetry } from '../../telemetry';
import { IKernel, IKernelProvider } from '../types';
import { IPyWidgetScriptSourceProvider } from './ipyWidgetScriptSourceProvider';
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/ipywidgets/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { Event, Uri } from 'vscode';
import { IDisposable, IHttpClient } from '../../platform/common/types';
import { IPyWidgetMessages } from '../../platform/messageTypes';
import { IPyWidgetMessages } from '../../messageTypes';
import { IKernel } from '../types';

export interface IPyWidgetMessage {
Expand Down
14 changes: 7 additions & 7 deletions src/platform/messageTypes.ts → src/messageTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
'use strict';
import { Uri } from 'vscode';
import type { KernelMessage } from '@jupyterlab/services';
import { NativeKeyboardCommandTelemetry, NativeMouseCommandTelemetry } from '../platform/common/constants';
import { NativeKeyboardCommandTelemetry, NativeMouseCommandTelemetry } from './platform/common/constants';
import {
IVariableExplorerHeight,
CommonActionType
// eslint-disable-next-line
} from '../webviews/webview-side/interactive-common/redux/reducers/types';
} from './webviews/webview-side/interactive-common/redux/reducers/types';
// eslint-disable-next-line
import { BaseReduxActionPayload } from '../webviews/types';
import { WidgetScriptSource } from '../kernels/ipywidgets/types';
import { KernelConnectionMetadata, KernelSocketOptions } from '../kernels/types';
import { ICell } from './common/types';
import { IJupyterVariable, IJupyterVariablesRequest, IJupyterVariablesResponse } from '../kernels/variables/types';
import { BaseReduxActionPayload } from './webviews/types';
import { WidgetScriptSource } from './kernels/ipywidgets/types';
import { KernelConnectionMetadata, KernelSocketOptions } from './kernels/types';
import { ICell } from './platform/common/types';
import { IJupyterVariable, IJupyterVariablesRequest, IJupyterVariablesResponse } from './kernels/variables/types';

export type NotifyIPyWidgetWidgetVersionNotSupportedAction = {
moduleName: 'qgrid';
Expand Down
2 changes: 1 addition & 1 deletion src/notebooks/controllers/vscodeNotebookController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import { EnvironmentType } from '../../platform/pythonEnvironments/info';
import { Commands } from '../../platform/common/constants';
import { Telemetry } from '../../telemetry';
import { WrappedError } from '../../platform/errors/types';
import { IPyWidgetMessages } from '../../platform/messageTypes';
import { IPyWidgetMessages } from '../../messageTypes';
import {
getKernelConnectionPath,
getRemoteKernelSessionInformation,
Expand Down
2 changes: 1 addition & 1 deletion src/notebooks/outputs/errorRendererComms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from '../../platform/common/application/types';
import { IFileSystem } from '../../platform/common/platform/types';
import { IDisposableRegistry } from '../../platform/common/types';
import { InteractiveWindowMessages } from '../../platform/messageTypes';
import { InteractiveWindowMessages } from '../../messageTypes';
import { linkCommandAllowList, LineQueryRegex } from './linkProvider';

@injectable()
Expand Down
Loading

0 comments on commit 923275a

Please sign in to comment.