Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update eslintrc import restriction rules #10535

Merged
merged 1 commit into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,20 @@ module.exports = {
from: './src/**webview**/**/*.ts',
message: 'Only modules from ./src/platform, ./src/telemetry, ./src/kernels and ./src/notebooks can be imported into ./src/interactive-window.'
},
{
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.'
},
{
target: './src/**[!test,standalone]**/*.ts',
from: './src/standalone/**/*.ts',
message: 'Importing modules from ./src/standalone into other components is not allowed.'
},
{
target: './src/telemetry/**/**[!types]**.ts',
from: './src/**[!telemetry,platform]**/**/*.ts',
Expand Down
2 changes: 2 additions & 0 deletions src/extension.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import { registerTypes as registerInteractiveTypes } from './interactive-window/
import { registerTypes as registerStandaloneTypes } from './standalone/serviceRegistry.node';
import { registerTypes as registerTelemetryTypes } from './telemetry/serviceRegistry.node';
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 { getDisplayPath } from './platform/common/platform/fs-paths';
Expand Down Expand Up @@ -320,6 +321,7 @@ async function activateLegacy(
registerInteractiveTypes(serviceManager);
registerStandaloneTypes(context, serviceManager, isDevMode);
registerIntellisenseTypes(serviceManager, isDevMode);
registerWebviewTypes(serviceManager);

// We need to setup this property before any telemetry is sent
const fs = serviceManager.get<IFileSystemNode>(IFileSystemNode);
Expand Down
2 changes: 2 additions & 0 deletions src/extension.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import { registerTypes as registerInteractiveTypes } from './interactive-window/
import { registerTypes as registerIntellisenseTypes } from './intellisense/serviceRegistry.web';
import { registerTypes as registerTerminalTypes } from './platform/terminals/serviceRegistry.web';
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 { getJupyterOutputChannel } from './standalone/devTools/jupyterOutputChannel';
Expand Down Expand Up @@ -291,6 +292,7 @@ async function activateLegacy(
registerIntellisenseTypes(serviceManager, isDevMode);
registerTerminalTypes(serviceManager);
registerStandaloneTypes(context, serviceManager, isDevMode);
registerWebviewTypes(serviceManager);

// Load the two data science experiments that we need to register types
// Await here to keep the register method sync
Expand Down
4 changes: 3 additions & 1 deletion src/platform/messageTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import { NativeKeyboardCommandTelemetry, NativeMouseCommandTelemetry } from '../
import {
IVariableExplorerHeight,
CommonActionType
// eslint-disable-next-line
} 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 { BaseReduxActionPayload } from '../webviews/types';
import { ICell } from './common/types';
import { IJupyterVariable, IJupyterVariablesRequest, IJupyterVariablesResponse } from '../kernels/variables/types';

Expand Down
13 changes: 12 additions & 1 deletion src/platform/serviceRegistry.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@ import { StatusProvider } from './progress/statusProvider';
import { IStatusProvider } from './progress/types';
import { ApplicationShell } from './common/application/applicationShell';
import { CommandManager } from './common/application/commandManager';
import { ICommandManager, IWorkspaceService, IApplicationShell } from './common/application/types';
import {
ICommandManager,
IWorkspaceService,
IApplicationShell,
IWebviewViewProvider,
IWebviewPanelProvider
} from './common/application/types';
import { ConfigurationService } from './common/configuration/service.node';
import { IFileSystem } from './common/platform/types';
import { IFileSystemNode } from './common/platform/types.node';
import { FileSystem } from './common/platform/fileSystem.node';
import { WorkspaceService } from './common/application/workspace.node';
import { OutputCommandListener } from './logging/outputCommandListener';
import { WebviewViewProvider } from './webviews/webviewViewProvider';
import { WebviewPanelProvider } from './webviews/webviewPanelProvider';

export function registerTypes(serviceManager: IServiceManager) {
serviceManager.addSingleton<FileSystem>(FileSystem, FileSystem);
Expand Down Expand Up @@ -51,4 +59,7 @@ export function registerTypes(serviceManager: IServiceManager) {
PreReleaseChecker
);
serviceManager.addSingleton<IDataScienceCommandListener>(IDataScienceCommandListener, OutputCommandListener);

serviceManager.add<IWebviewViewProvider>(IWebviewViewProvider, WebviewViewProvider);
serviceManager.add<IWebviewPanelProvider>(IWebviewPanelProvider, WebviewPanelProvider);
}
10 changes: 9 additions & 1 deletion src/platform/serviceRegistry.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import {
ICommandManager,
IWorkspaceService,
IApplicationShell,
IApplicationEnvironment
IApplicationEnvironment,
IWebviewViewProvider,
IWebviewPanelProvider
} from './common/application/types';
import { ConfigurationService } from './common/configuration/service.web';
import { registerTypes as registerApiTypes } from './api/serviceRegistry.web';
Expand All @@ -26,6 +28,8 @@ import { OutputCommandListener } from './logging/outputCommandListener';
import { IFileSystem } from './common/platform/types';
import { FileSystem } from './common/platform/fileSystem';
import { KernelProgressReporter } from './progress/kernelProgressReporter';
import { WebviewPanelProvider } from './webviews/webviewPanelProvider';
import { WebviewViewProvider } from './webviews/webviewViewProvider';

export function registerTypes(serviceManager: IServiceManager) {
serviceManager.addSingleton<IFileSystem>(IFileSystem, FileSystem);
Expand All @@ -45,4 +49,8 @@ export function registerTypes(serviceManager: IServiceManager) {
IExtensionSyncActivationService,
KernelProgressReporter
);

// Webview Provider
serviceManager.add<IWebviewViewProvider>(IWebviewViewProvider, WebviewViewProvider);
serviceManager.add<IWebviewPanelProvider>(IWebviewPanelProvider, WebviewPanelProvider);
}
4 changes: 2 additions & 2 deletions src/standalone/import-export/exportCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'use strict';

import { NotebookDocument, QuickPickItem, QuickPickOptions, Uri } from 'vscode';
import { getLocString } from '../../webviews/webview-side/react-common/locReactSide';
import * as localize from '../../platform/common/utils/localize';
import { ICommandNameArgumentTypeMapping } from '../../platform/common/application/commands';
import { IApplicationShell, ICommandManager, IVSCodeNotebook } from '../../platform/common/application/types';
import { traceInfo } from '../../platform/logging';
Expand Down Expand Up @@ -188,7 +188,7 @@ export class ExportCommands implements IDisposable {
ignoreFocusOut: false,
matchOnDescription: true,
matchOnDetail: true,
placeHolder: getLocString('DataScience.exportAsQuickPickPlaceholder', 'Export As...')
placeHolder: localize.DataScience.exportAsQuickPickPlaceholder()
};

return this.applicationShell.showQuickPick(items, options);
Expand Down
61 changes: 0 additions & 61 deletions src/standalone/serviceRegistry.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,12 @@ import {
IExtensionSingleActivationService,
IExtensionSyncActivationService
} from '../platform/activation/types';
import { IWebviewViewProvider, IWebviewPanelProvider } from '../platform/common/application/types';
import { IServiceManager } from '../platform/ioc/types';
import { INotebookWatcher, IVariableViewProvider } from '../webviews/extension-side/variablesView/types';
import { VariableViewActivationService } from '../webviews/extension-side/variablesView/variableViewActivationService';
import { VariableViewProvider } from '../webviews/extension-side/variablesView/variableViewProvider';
import { WebviewPanelProvider } from '../platform/webviews/webviewPanelProvider';
import { WebviewViewProvider } from '../platform/webviews/webviewViewProvider';
import { JupyterVariableDataProvider } from '../webviews/extension-side/dataviewer/jupyterVariableDataProvider';
import { JupyterVariableDataProviderFactory } from '../webviews/extension-side/dataviewer/jupyterVariableDataProviderFactory';
import {
IDataViewer,
IDataViewerDependencyService,
IDataViewerFactory,
IJupyterVariableDataProvider,
IJupyterVariableDataProviderFactory
} from '../webviews/extension-side/dataviewer/types';
import { INotebookExporter, INotebookImporter } from '../kernels/jupyter/types';
import { JupyterExporter } from './import-export/jupyterExporter';
import { JupyterImporter } from './import-export/jupyterImporter.node';
import { CommandRegistry as ExportCommandRegistry } from './import-export/commandRegistry';
import { ServerPreload } from './serverPreload/serverPreload.node';
import { RendererCommunication } from '../webviews/extension-side/plotView/rendererCommunication.node';
import { PlotSaveHandler } from '../webviews/extension-side/plotView/plotSaveHandler.node';
import { PlotViewHandler } from '../webviews/extension-side/plotView/plotViewHandler.node';
import { DataViewerCommandRegistry } from '../webviews/extension-side/dataviewer/dataViewerCommandRegistry';
import { DataViewer } from '../webviews/extension-side/dataviewer/dataViewer';
import { IPlotViewer, IPlotViewerProvider } from '../webviews/extension-side/plotting/types';
import { PlotViewer } from '../webviews/extension-side/plotting/plotViewer.node';
import { DataViewerDependencyService } from '../webviews/extension-side/dataviewer/dataViewerDependencyService.node';
import { PlotViewerProvider } from '../webviews/extension-side/plotting/plotViewerProvider.node';
import { DataViewerFactory } from '../webviews/extension-side/dataviewer/dataViewerFactory';
import { NotebookWatcher } from '../webviews/extension-side/variablesView/notebookWatcher';
import { ExtensionSideRenderer, IExtensionSideRenderer } from './renderer';
import { ExtensionRecommendationService } from './recommendation/extensionRecommendation.node';
import { ActiveEditorContextService } from './context/activeEditorContext';
Expand All @@ -61,10 +35,6 @@ export function registerTypes(context: IExtensionContext, serviceManager: IServi
IExtensionSingleActivationService,
WorkspaceActivation
);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSyncActivationService,
RendererCommunication
);
serviceManager.addSingleton<IExtensionSyncActivationService>(
IExtensionSyncActivationService,
ExtensionRecommendationService
Expand All @@ -80,37 +50,6 @@ export function registerTypes(context: IExtensionContext, serviceManager: IServi
serviceManager.addSingleton<AmlComputeContext>(AmlComputeContext, AmlComputeContext);
serviceManager.addSingleton<IImportTracker>(IImportTracker, ImportTracker);
serviceManager.addSingleton<IExtensionSingleActivationService>(IExtensionSingleActivationService, ImportTracker);
serviceManager.add<IDataViewer>(IDataViewer, DataViewer);
serviceManager.addSingleton<IDataViewerFactory>(IDataViewerFactory, DataViewerFactory);
serviceManager.add<IPlotViewer>(IPlotViewer, PlotViewer);
serviceManager.addSingleton<IPlotViewerProvider>(IPlotViewerProvider, PlotViewerProvider);
serviceManager.addSingleton<PlotSaveHandler>(PlotSaveHandler, PlotSaveHandler);
serviceManager.addSingleton<PlotViewHandler>(PlotViewHandler, PlotViewHandler);

serviceManager.addSingleton<IDataViewerDependencyService>(
IDataViewerDependencyService,
DataViewerDependencyService
);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
DataViewerCommandRegistry
);

serviceManager.add<IWebviewViewProvider>(IWebviewViewProvider, WebviewViewProvider);
serviceManager.add<IWebviewPanelProvider>(IWebviewPanelProvider, WebviewPanelProvider);

// Variable View
serviceManager.addSingleton<INotebookWatcher>(INotebookWatcher, NotebookWatcher);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
VariableViewActivationService
);
serviceManager.addSingleton<IVariableViewProvider>(IVariableViewProvider, VariableViewProvider);
serviceManager.add<IJupyterVariableDataProvider>(IJupyterVariableDataProvider, JupyterVariableDataProvider);
serviceManager.addSingleton<IJupyterVariableDataProviderFactory>(
IJupyterVariableDataProviderFactory,
JupyterVariableDataProviderFactory
);

// Import/Export
serviceManager.add<INotebookExporter>(INotebookExporter, JupyterExporter);
Expand Down
42 changes: 0 additions & 42 deletions src/standalone/serviceRegistry.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,12 @@
// Licensed under the MIT License.
'use strict';

import { IWebviewViewProvider, IWebviewPanelProvider } from '../platform/common/application/types';
import { IServiceManager } from '../platform/ioc/types';
import { WebviewViewProvider } from '../platform/webviews/webviewViewProvider';
import { WebviewPanelProvider } from '../platform/webviews/webviewPanelProvider';
import { IExtensionActivationManager, IExtensionSingleActivationService } from '../platform/activation/types';
import { VariableViewActivationService } from '../webviews/extension-side/variablesView/variableViewActivationService';
import { INotebookWatcher, IVariableViewProvider } from '../webviews/extension-side/variablesView/types';
import { VariableViewProvider } from '../webviews/extension-side/variablesView/variableViewProvider';
import { JupyterVariableDataProvider } from '../webviews/extension-side/dataviewer/jupyterVariableDataProvider';
import { JupyterVariableDataProviderFactory } from '../webviews/extension-side/dataviewer/jupyterVariableDataProviderFactory';
import {
IDataViewer,
IDataViewerFactory,
IJupyterVariableDataProvider,
IJupyterVariableDataProviderFactory
} from '../webviews/extension-side/dataviewer/types';
import { DataViewerCommandRegistry } from '../webviews/extension-side/dataviewer/dataViewerCommandRegistry';
import { CommandRegistry as ExportCommandRegistry } from './import-export/commandRegistry';
import { NotebookWatcher } from '../webviews/extension-side/variablesView/notebookWatcher';
import { DataViewerFactory } from '../webviews/extension-side/dataviewer/dataViewerFactory';
import { ExtensionSideRenderer, IExtensionSideRenderer } from './renderer';
import { ActiveEditorContextService } from './context/activeEditorContext';
import { GlobalActivation } from './activation/globalActivation';
import { DataViewer } from '../webviews/extension-side/dataviewer/dataViewer';
import { INotebookExporter } from '../kernels/jupyter/types';
import { JupyterExporter } from './import-export/jupyterExporter';
import { JupyterKernelServiceFactory } from './api/kernelApi';
Expand All @@ -42,30 +24,6 @@ export function registerTypes(context: IExtensionContext, serviceManager: IServi
ActiveEditorContextService
);

serviceManager.add<IWebviewViewProvider>(IWebviewViewProvider, WebviewViewProvider);
serviceManager.add<IWebviewPanelProvider>(IWebviewPanelProvider, WebviewPanelProvider);

// Data viewer
serviceManager.add<IDataViewer>(IDataViewer, DataViewer);
serviceManager.addSingleton<IDataViewerFactory>(IDataViewerFactory, DataViewerFactory);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
DataViewerCommandRegistry
);

// Variables view
serviceManager.addSingleton<INotebookWatcher>(INotebookWatcher, NotebookWatcher);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
VariableViewActivationService
);
serviceManager.addSingleton<IVariableViewProvider>(IVariableViewProvider, VariableViewProvider);
serviceManager.add<IJupyterVariableDataProvider>(IJupyterVariableDataProvider, JupyterVariableDataProvider);
serviceManager.addSingleton<IJupyterVariableDataProviderFactory>(
IJupyterVariableDataProviderFactory,
JupyterVariableDataProviderFactory
);

serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
ExportCommandRegistry
Expand Down
1 change: 1 addition & 0 deletions src/telemetry/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { EnvironmentType, PythonEnvironment } from '../platform/pythonEnvironmen
import { TelemetryErrorProperties, ErrorCategory } from '../platform/errors/types';
import { ExportFormat } from '../notebooks/export/types';
import { InterruptResult, KernelConnectionMetadata, KernelInterpreterDependencyResponse } from '../kernels/types';
// eslint-disable-next-line
import { IExportedKernelService } from '../standalone/api/extension';
import { PreferredKernelExactMatchReason } from '../notebooks/controllers/notebookControllerManager';
import { SelectJupyterUriCommandSource } from '../kernels/jupyter/serverSelector';
Expand Down
Loading