Skip to content

Commit

Permalink
trying out semi-ESM Typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
akphi committed Jun 1, 2022
1 parent 1885a4b commit 3dfffea
Show file tree
Hide file tree
Showing 1,156 changed files with 6,699 additions and 6,650 deletions.
33 changes: 33 additions & 0 deletions .changeset/six-mails-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
'@finos/eslint-plugin-legend-studio': patch
'@finos/legend-application': patch
'@finos/legend-art': patch
'@finos/legend-dev-utils': patch
'@finos/legend-extension-dsl-data-space': patch
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-dsl-persistence': patch
'@finos/legend-extension-dsl-text': patch
'@finos/legend-extension-external-format-json-schema': patch
'@finos/legend-extension-external-language-morphir': patch
'@finos/legend-extension-external-store-service': patch
'@finos/legend-extension-mapping-generation': patch
'@finos/legend-graph': patch
'@finos/legend-graph-extension-collection': patch
'@finos/legend-manual-tests': patch
'@finos/legend-model-storage': patch
'@finos/legend-query': patch
'@finos/legend-query-app': patch
'@finos/legend-query-deployment': patch
'@finos/legend-server-depot': patch
'@finos/legend-server-sdlc': patch
'@finos/legend-shared': patch
'@finos/legend-studio': patch
'@finos/legend-studio-app': patch
'@finos/legend-studio-deployment': patch
'@finos/legend-studio-extension-management-toolkit': patch
'@finos/legend-studio-extension-query-builder': patch
'@finos/legend-taxonomy': patch
'@finos/legend-taxonomy-app': patch
'@finos/legend-taxonomy-deployment': patch
'@finos/legend-tracer-extension-zipkin': patch
---
2 changes: 1 addition & 1 deletion fixtures/legend-mock-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import Fastify from 'fastify';
import FastifyCORS from '@fastify/cors';
import TAXONOMY_TREE_DATA from './TEST_DATA__TaxonomyTreeData.json' assert { type: 'json' };
import TAXONOMY_TREE_DATA from './TEST_DATA__TaxonomyTreeData.json';

const PORT = 60001;
const BASE_URL = '/api/';
Expand Down
2 changes: 2 additions & 0 deletions packages/eslint-plugin/src/configs/recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ const IMPORT_RULES = {
'import/namespace': OFF,
'import/default': OFF,
'import/export': OFF,
// Enforce ESM-styled imports
'import/extensions': [ERROR, 'always', { ignorePackages: true }],
'import/newline-after-import': [WARN, { count: 1 }],
'import/no-default-export': WARN,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

import { configure as configureMobx } from 'mobx';
import { editor as monacoEditorAPI } from 'monaco-editor';
import { MONOSPACED_FONT_FAMILY } from '../const';
import { MONOSPACED_FONT_FAMILY } from '../const.js';
import type {
LegendApplicationConfig,
LegendApplicationConfigurationData,
LegendApplicationVersionData,
} from '../stores/LegendApplicationConfig';
} from '../stores/LegendApplicationConfig.js';
import {
type AbstractPlugin,
type AbstractPreset,
Expand All @@ -31,11 +31,11 @@ import {
assertNonNullable,
NetworkClient,
} from '@finos/legend-shared';
import { APPLICATION_EVENT } from '../stores/ApplicationEvent';
import { APPLICATION_EVENT } from '../stores/ApplicationEvent.js';
import { configureComponents } from '@finos/legend-art';
import type { GraphPluginManager } from '@finos/legend-graph';
import type { LegendApplicationPluginManager } from './LegendApplicationPluginManager';
import { setupPureLanguageService } from '../stores/PureLanguageSupport';
import type { LegendApplicationPluginManager } from './LegendApplicationPluginManager.js';
import { setupPureLanguageService } from '../stores/PureLanguageSupport.js';

export abstract class LegendApplicationLogger {
abstract debug(event: LogEvent, ...data: unknown[]): void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
type TracerServicePluginManager,
AbstractPluginManager,
} from '@finos/legend-shared';
import type { LegendApplicationPlugin } from '../stores/LegendApplicationPlugin';
import type { LegendApplicationPlugin } from '../stores/LegendApplicationPlugin.js';

export class LegendApplicationPluginManager
extends AbstractPluginManager
Expand Down
4 changes: 2 additions & 2 deletions packages/legend-application/src/components/ActionAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import {
ActionAlertActionType,
ActionAlertType,
type ActionAlertInfo,
} from '../stores/ApplicationStore';
} from '../stores/ApplicationStore.js';
import { observer } from 'mobx-react-lite';
import { noop } from '@finos/legend-shared';
import { useApplicationStore } from './ApplicationStoreProvider';
import { useApplicationStore } from './ApplicationStoreProvider.js';

const getActionButtonClassName = (type: ActionAlertActionType): string => {
switch (type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

import { createContext, useContext } from 'react';
import { useLocalObservable } from 'mobx-react-lite';
import { ApplicationStore } from '../stores/ApplicationStore';
import type { LegendApplicationConfig } from '../stores/LegendApplicationConfig';
import { ApplicationStore } from '../stores/ApplicationStore.js';
import type { LegendApplicationConfig } from '../stores/LegendApplicationConfig.js';
import { guaranteeNonNullable } from '@finos/legend-shared';
import { useWebApplicationNavigator } from './WebApplicationNavigatorProvider';
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
import { useWebApplicationNavigator } from './WebApplicationNavigatorProvider.js';
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';

const ApplicationStoreContext = createContext<
ApplicationStore<LegendApplicationConfig> | undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

import { jest } from '@jest/globals';
import { createMemoryHistory } from 'history';
import { ApplicationStore } from '../stores/ApplicationStore';
import { WebApplicationNavigator } from '../stores/WebApplicationNavigator';
import type { LegendApplicationConfig } from '../stores/LegendApplicationConfig';
import { ApplicationStoreProvider } from './ApplicationStoreProvider';
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
import { ApplicationStore } from '../stores/ApplicationStore.js';
import { WebApplicationNavigator } from '../stores/WebApplicationNavigator.js';
import type { LegendApplicationConfig } from '../stores/LegendApplicationConfig.js';
import { ApplicationStoreProvider } from './ApplicationStoreProvider.js';
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';

export const TEST__ApplicationStoreProvider: React.FC<{
children: React.ReactNode;
Expand Down Expand Up @@ -50,7 +50,7 @@ export const TEST__provideMockedApplicationStore = <
new WebApplicationNavigator(createMemoryHistory()),
pluginManager,
);
const MockedApplicationStoreProvider = require('./ApplicationStoreProvider'); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
const MockedApplicationStoreProvider = require('./ApplicationStoreProvider.js'); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
MockedApplicationStoreProvider.useApplicationStore = jest.fn();
MockedApplicationStoreProvider.useApplicationStore.mockReturnValue(value);
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { observer } from 'mobx-react-lite';
import { PanelLoadingIndicator, Dialog } from '@finos/legend-art';
import { noop } from '@finos/legend-shared';
import { useApplicationStore } from './ApplicationStoreProvider';
import { useApplicationStore } from './ApplicationStoreProvider.js';

/**
* The users of this need to justify their use case because blocking app disrupts the UX flow.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { clsx, QuestionCircleIcon } from '@finos/legend-art';
import { useApplicationStore } from './ApplicationStoreProvider';
import { useApplicationStore } from './ApplicationStoreProvider.js';

export const DocumentationLink: React.FC<{
documentationKey: string;
Expand Down
8 changes: 4 additions & 4 deletions packages/legend-application/src/components/LambdaEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
LongArrowAltUpIcon,
Dialog,
} from '@finos/legend-art';
import type { LambdaEditorState } from '../stores/LambdaEditorState';
import type { LambdaEditorState } from '../stores/LambdaEditorState.js';
import {
debounce,
noop,
Expand All @@ -44,9 +44,9 @@ import {
} from '@finos/legend-shared';
import { flowResult } from 'mobx';
import { ParserError, type EngineError, type Type } from '@finos/legend-graph';
import { APPLICATION_TEST_ID } from './ApplicationTestID';
import { useApplicationStore } from './ApplicationStoreProvider';
import { EDITOR_LANGUAGE, EDITOR_THEME, TAB_SIZE } from '../const';
import { APPLICATION_TEST_ID } from './ApplicationTestID.js';
import { useApplicationStore } from './ApplicationStoreProvider.js';
import { EDITOR_LANGUAGE, EDITOR_THEME, TAB_SIZE } from '../const.js';

export type LambdaEditorOnKeyDownEventHandler = {
matcher: (event: IKeyboardEvent) => boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/

import { LegendStyleProvider } from '@finos/legend-art';
import { ActionAlert } from './ActionAlert';
import { BlockingAlert } from './BlockingAlert';
import { NotificationManager } from './NotificationManager';
import { ActionAlert } from './ActionAlert.js';
import { BlockingAlert } from './BlockingAlert.js';
import { NotificationManager } from './NotificationManager.js';

export const LegendApplicationComponentFrameworkProvider: React.FC<{
children: React.ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import { useEffect } from 'react';
import { ApplicationNavigationContextData } from '../stores/LegendApplicationNavigationContextService';
import { useApplicationStore } from './ApplicationStoreProvider';
import { ApplicationNavigationContextData } from '../stores/LegendApplicationNavigationContextService.js';
import { useApplicationStore } from './ApplicationStoreProvider.js';

/**
* Provides a convenient hook mechanism to handle application navigation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { observer } from 'mobx-react-lite';
import {
DEFAULT_NOTIFICATION_HIDE_TIME,
NOTIFCATION_SEVERITY,
} from '../stores/ApplicationStore';
import { useApplicationStore } from './ApplicationStoreProvider';
} from '../stores/ApplicationStore.js';
import { useApplicationStore } from './ApplicationStoreProvider.js';
import {
Notification,
NotificationContent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import {
getEditorValue,
normalizeLineEnding,
} from '@finos/legend-art';
import { type EDITOR_LANGUAGE, EDITOR_THEME, TAB_SIZE } from '../const';
import { useApplicationStore } from './ApplicationStoreProvider';
import { type EDITOR_LANGUAGE, EDITOR_THEME, TAB_SIZE } from '../const.js';
import { useApplicationStore } from './ApplicationStoreProvider.js';

export type TextInputEditorOnKeyDownEventHandler = {
matcher: (event: IKeyboardEvent) => boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ import {
import { format } from 'date-fns';
import { observer } from 'mobx-react-lite';
import { useEffect, useMemo, useRef, useState } from 'react';
import { DATE_TIME_FORMAT, TAB_SIZE } from '../const';
import { DATE_TIME_FORMAT, TAB_SIZE } from '../const.js';
import {
type VirtualAssistantDocumentationEntry,
VIRTUAL_ASSISTANT_TAB,
} from '../stores/LegendApplicationAssistantService';
import { useApplicationStore } from './ApplicationStoreProvider';
} from '../stores/LegendApplicationAssistantService.js';
import { useApplicationStore } from './ApplicationStoreProvider.js';
import Draggable from 'react-draggable';

const WIZARD_GREETING = `Bonjour, It's Pierre!`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useLocalObservable } from 'mobx-react-lite';
import { createContext, useContext } from 'react';
import { useHistory } from 'react-router';
import type { History } from 'history';
import { WebApplicationNavigator } from '../stores/WebApplicationNavigator';
import { WebApplicationNavigator } from '../stores/WebApplicationNavigator.js';

const WebApplicationNavigatorContext = createContext<
WebApplicationNavigator | undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { jest } from '@jest/globals';
import { WebApplicationNavigator } from '../stores/WebApplicationNavigator';
import { WebApplicationNavigator } from '../stores/WebApplicationNavigator.js';
import { createMemoryHistory, type History } from 'history';

export const TEST__provideMockedWebApplicationNavigator = (customization?: {
Expand All @@ -27,7 +27,7 @@ export const TEST__provideMockedWebApplicationNavigator = (customization?: {
new WebApplicationNavigator(
customization?.history ?? createMemoryHistory(),
);
const MockWebApplicationNavigatorProvider = require('./WebApplicationNavigatorProvider'); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
const MockWebApplicationNavigatorProvider = require('./WebApplicationNavigatorProvider.js'); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
MockWebApplicationNavigatorProvider.useWebApplicationNavigator = jest.fn();
MockWebApplicationNavigatorProvider.useWebApplicationNavigator.mockReturnValue(
value,
Expand Down
52 changes: 26 additions & 26 deletions packages/legend-application/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,37 @@
* limitations under the License.
*/

export * from './const';
export * from './const.js';

export * from './application/LegendApplicationPluginManager';
export * from './application/LegendApplication';
export * from './application/LegendApplicationPluginManager.js';
export * from './application/LegendApplication.js';

export * from './components/ApplicationStoreProvider';
export * from './components/WebApplicationNavigatorProvider';
export * from './components/LegendApplicationComponentFrameworkProvider';
export * from './components/LegendApplicationNavigationContextServiceUtils';
export * from './components/ApplicationStoreProvider.js';
export * from './components/WebApplicationNavigatorProvider.js';
export * from './components/LegendApplicationComponentFrameworkProvider.js';
export * from './components/LegendApplicationNavigationContextServiceUtils.js';

export * from './components/ApplicationStoreProviderTestUtils';
export * from './components/WebApplicationNavigatorProviderTestUtils';
export * from './components/ApplicationStoreProviderTestUtils.js';
export * from './components/WebApplicationNavigatorProviderTestUtils.js';

// TODO: consider moving this to `LegendApplicationComponentFrameworkProvider`
// once we think we can add virtual assistant support for all apps
export * from './components/VirtualAssistant';
export * from './components/DocumentationLink';
export * from './components/TextInputEditor';
export * from './components/LambdaEditor';
export * from './components/VirtualAssistant.js';
export * from './components/DocumentationLink.js';
export * from './components/TextInputEditor.js';
export * from './components/LambdaEditor.js';

export * from './stores/ApplicationStore';
export * from './stores/ApplicationTelemetry';
export * from './stores/ApplicationEvent';
export * from './stores/LegendApplicationConfig';
export { WebApplicationNavigator } from './stores/WebApplicationNavigator';
export { LambdaEditorState } from './stores/LambdaEditorState';
export * from './stores/PackageableElementOption';
export * from './stores/LegendApplicationDocumentationService';
export * from './stores/LegendApplicationEventService';
export * from './stores/LegendApplicationAssistantService';
export * from './stores/LegendApplicationNavigationContextService';
export * from './stores/LegendApplicationPlugin';
export * from './stores/ApplicationStore.js';
export * from './stores/ApplicationTelemetry.js';
export * from './stores/ApplicationEvent.js';
export * from './stores/LegendApplicationConfig.js';
export { WebApplicationNavigator } from './stores/WebApplicationNavigator.js';
export { LambdaEditorState } from './stores/LambdaEditorState.js';
export * from './stores/PackageableElementOption.js';
export * from './stores/LegendApplicationDocumentationService.js';
export * from './stores/LegendApplicationEventService.js';
export * from './stores/LegendApplicationAssistantService.js';
export * from './stores/LegendApplicationNavigationContextService.js';
export * from './stores/LegendApplicationPlugin.js';

export * from './stores/ApplicationStoreTestUtils';
export * from './stores/ApplicationStoreTestUtils.js';
16 changes: 8 additions & 8 deletions packages/legend-application/src/stores/ApplicationStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ import {
ApplicationError,
} from '@finos/legend-shared';
import { makeAutoObservable, action } from 'mobx';
import { APPLICATION_EVENT } from './ApplicationEvent';
import type { LegendApplicationConfig } from './LegendApplicationConfig';
import type { WebApplicationNavigator } from './WebApplicationNavigator';
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
import { LegendApplicationDocumentationService } from './LegendApplicationDocumentationService';
import { LegendApplicationAssistantService } from './LegendApplicationAssistantService';
import { LegendApplicationEventService } from './LegendApplicationEventService';
import { LegendApplicationNavigationContextService } from './LegendApplicationNavigationContextService';
import { APPLICATION_EVENT } from './ApplicationEvent.js';
import type { LegendApplicationConfig } from './LegendApplicationConfig.js';
import type { WebApplicationNavigator } from './WebApplicationNavigator.js';
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';
import { LegendApplicationDocumentationService } from './LegendApplicationDocumentationService.js';
import { LegendApplicationAssistantService } from './LegendApplicationAssistantService.js';
import { LegendApplicationEventService } from './LegendApplicationEventService.js';
import { LegendApplicationNavigationContextService } from './LegendApplicationNavigationContextService.js';

export enum ActionAlertType {
STANDARD = 'STANDARD',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

import { ApplicationStore } from './ApplicationStore';
import { ApplicationStore } from './ApplicationStore.js';
import { createBrowserHistory } from 'history';
import { WebApplicationNavigator } from './WebApplicationNavigator';
import type { LegendApplicationConfig } from './LegendApplicationConfig';
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
import { WebApplicationNavigator } from './WebApplicationNavigator.js';
import type { LegendApplicationConfig } from './LegendApplicationConfig.js';
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';

export const TEST_DATA__applicationVersion = {
buildTime: '2001-01-01T00:00:00-0000',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import type { TelemetryService } from '@finos/legend-shared';
import { APPLICATION_EVENT } from './ApplicationEvent';
import { APPLICATION_EVENT } from './ApplicationEvent.js';

type ApplicationLoaded_TelemetryData = {
browser: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import { action, makeObservable, observable, computed } from 'mobx';
import type {
LegendApplicationContextualDocumentationEntry,
LegendApplicationDocumentationEntry,
} from './LegendApplicationDocumentationService';
import type { LegendApplicationConfig } from './LegendApplicationConfig';
import type { ApplicationStore } from './ApplicationStore';
} from './LegendApplicationDocumentationService.js';
import type { LegendApplicationConfig } from './LegendApplicationConfig.js';
import type { ApplicationStore } from './ApplicationStore.js';
import Fuse from 'fuse.js';
import {
type MarkdownText,
Expand Down
Loading

0 comments on commit 3dfffea

Please sign in to comment.