Skip to content

Commit

Permalink
chore(types): Make import of types explicit
Browse files Browse the repository at this point in the history
... so that TS 5 ("importsNotUsedAsValues") will be happy, too
  • Loading branch information
ribose-jeffreylau committed Aug 18, 2023
1 parent 96c2990 commit aec4b72
Show file tree
Hide file tree
Showing 307 changed files with 1,304 additions and 1,045 deletions.
3 changes: 2 additions & 1 deletion src/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { DatasetContext } from '@riboseinc/paneron-extension-kit/context';
import React from 'react';
import { useContext, useMemo, useState } from 'react';
import RepositoryView from '@/smart/ui/app/RepoView';
import { RepoIndex, repoIndexPath } from '@/smart/model/repo';
import type { RepoIndex } from '@/smart/model/repo';
import { repoIndexPath } from '@/smart/model/repo';
import { LoadingScreen } from '@/smart/ui/common/Loading';
import { createEmptyIndex } from '@/smart/utils/repo/CommonFunctions';

Expand Down
5 changes: 3 additions & 2 deletions src/css/MGDButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
* They are migrated to TS codes (either CSSProperties or Styled)
*/

import { css, SerializedStyles } from '@emotion/react';
import { CSSProperties } from 'react';
import type { SerializedStyles } from '@emotion/react';
import { css } from '@emotion/react';
import type { CSSProperties } from 'react';
import { CSSROOTVARIABLES } from '@/css/root.css';

export const mgdButton: CSSProperties = {
Expand Down
2 changes: 1 addition & 1 deletion src/css/MGDButtonGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* They are migrated to TS codes (either CSSProperties or Styled)
*/

import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';

export const mgdButtonGroup: CSSProperties = {
width : '100%',
Expand Down
2 changes: 1 addition & 1 deletion src/css/MGDComponentBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* They are migrated to TS codes (either CSSProperties or Styled)
*/

import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { CSSROOTVARIABLES } from '@/css/root.css';

export const mgdComponentBar: CSSProperties = {
Expand Down
2 changes: 1 addition & 1 deletion src/css/MGDContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* They are migrated to TS codes (either CSSProperties or Styled)
*/

import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';

export const mgdContainer: CSSProperties = {
display : 'flex',
Expand Down
2 changes: 1 addition & 1 deletion src/css/MGDDisplayPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { css } from '@emotion/react';
import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { CSSROOTVARIABLES } from '@/css/root.css';

export const mgd_display_pane = css`
Expand Down
2 changes: 1 addition & 1 deletion src/css/MGDLegend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* They are migrated to TS codes (either CSSProperties or Styled)
*/

import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { CSSROOTVARIABLES } from '@/css/root.css';

export const mgdLegend: CSSProperties = {
Expand Down
2 changes: 1 addition & 1 deletion src/css/MGDLegendEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* They are migrated to TS codes (either CSSProperties or Styled)
*/

import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { CSSROOTVARIABLES } from '@/css/root.css';

export const mgdLegendEntry: CSSProperties = {
Expand Down
2 changes: 1 addition & 1 deletion src/css/MGDSidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* They are migrated to TS codes (either CSSProperties or Styled)
*/

import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { CSSROOTVARIABLES } from '@/css/root.css';

export const mgdSidebar: CSSProperties = {
Expand Down
2 changes: 1 addition & 1 deletion src/css/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { css } from '@emotion/react';
import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { CSSROOTVARIABLES } from '@/css/root.css';

const normal_font_style = css`
Expand Down
2 changes: 1 addition & 1 deletion src/css/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { css } from '@emotion/react';
import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { CSSROOTVARIABLES } from '@/css/root.css';

export const flownode_top_left_button_layout = css`
Expand Down
2 changes: 1 addition & 1 deletion src/css/shame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { css } from '@emotion/react';
import { CSSProperties } from 'react';
import type { CSSProperties } from 'react';
import { CSSROOTVARIABLES } from '@/css/root.css';

export const shameLabel: CSSProperties = {
Expand Down
17 changes: 10 additions & 7 deletions src/css/visual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
* They are migrated to TS codes (either CSSProperties or Styled)
*/

import { css, SerializedStyles } from '@emotion/react';
import { CSSProperties } from 'react';
import {
import type { SerializedStyles } from '@emotion/react';
import { css } from '@emotion/react';
import type { CSSProperties } from 'react';
import type {
MapCoverType,
MapSourceType } from '@/smart/utils/map/MappingCalculator';
import {
MappingResultStyles,
MappingSourceStyles,
MapSourceType,
MappingSourceStyles
} from '@/smart/utils/map/MappingCalculator';
import {
import type {
MapDiffCoverType,
MapDiffSourceType,
MapDiffSourceType } from '@/smart/utils/map/MappingDiff';
import {
MappingDiffResultStyles,
MappingDiffSourceStyles,
} from '@/smart/utils/map/MappingDiff';
Expand Down
7 changes: 4 additions & 3 deletions src/formValidation.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import {
FormGroup,
import type {
FormGroupProps as IFormGroupProps,
Intent,
Intent } from '@blueprintjs/core';
import {
FormGroup
} from '@blueprintjs/core';

export type Validator<T> = (object: T) => ValidationResult<T>;
Expand Down
3 changes: 2 additions & 1 deletion src/smart/MGDComponents/MGDButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

import { jsx } from '@emotion/react';

import { Button, IconName } from '@blueprintjs/core';
import type { IconName } from '@blueprintjs/core';
import { Button } from '@blueprintjs/core';
import {
mgdButton,
MGDButtonSize,
Expand Down
3 changes: 2 additions & 1 deletion src/smart/MGDComponents/MGDProcessBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
/** @jsx jsx */
/** @jsxFrag React.Fragment */

import { jsx, SerializedStyles } from '@emotion/react';
import type { SerializedStyles } from '@emotion/react';
import { jsx } from '@emotion/react';
import { mgd_process_box } from '@/css/MGDProcessBox';

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down
3 changes: 2 additions & 1 deletion src/smart/MGDComponents/MGDTextarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

import { TextArea } from '@blueprintjs/core';
import React, { ChangeEvent } from 'react';
import type { ChangeEvent } from 'react';
import React from 'react';
import { mgdTextarea } from '@/css/form';

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down
19 changes: 10 additions & 9 deletions src/smart/model/FlowContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@
* This file defines the data structure of this payload
*/

import { XYPosition } from 'react-flow-renderer';
import { MMELEdge } from '@paneron/libmmel/interface/flowcontrolinterface';
import {
import type { XYPosition } from 'react-flow-renderer';
import type { MMELEdge } from '@paneron/libmmel/interface/flowcontrolinterface';
import type {
EditorModel,
EditorNode,
ModelType } from '@/smart/model/editormodel';
import {
getEditorRoleById,
isEditorData,
ModelType,
isEditorData
} from '@/smart/model/editormodel';
import { MMELtoFlowEntries } from '@/smart/model/States';
import {
import type {
MMELComment,
MMELFigure,
MMELLink,
MMELRole,
MMELTable,
} from '@paneron/libmmel/interface/supportinterface';
import { SerializedStyles } from '@emotion/react';
import React from 'react';
import { MMELRepo, RepoIndex } from '@/smart/model/repo';
import type { SerializedStyles } from '@emotion/react';
import type React from 'react';
import type { MMELRepo, RepoIndex } from '@/smart/model/repo';

export interface EdgeContainer {
id: string;
Expand Down
4 changes: 2 additions & 2 deletions src/smart/model/Measurement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* Data structure for measurement and variables
*/

import {
import type {
MMELVariable,
MMELView,
VarType,
} from '@paneron/libmmel/interface/supportinterface';
import { EditorModel } from '@/smart/model/editormodel';
import type { EditorModel } from '@/smart/model/editormodel';

export interface MTreeNode {
action: string; // if data is a value, action = ''
Expand Down
2 changes: 1 addition & 1 deletion src/smart/model/SemanticTriple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Data model for the NLP graph
*/

import { Node } from 'react-flow-renderer';
import type { Node } from 'react-flow-renderer';

export interface STNode {
data: string;
Expand Down
12 changes: 6 additions & 6 deletions src/smart/model/States.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { NodeProps } from 'react-flow-renderer';
import { HistoryItem, PageHistory } from '@/smart/model/history';
import { ModelWrapper } from '@/smart/model/modelwrapper';
import type React from 'react';
import type { NodeProps } from 'react-flow-renderer';
import type { HistoryItem, PageHistory } from '@/smart/model/history';
import type { ModelWrapper } from '@/smart/model/modelwrapper';
import { DataType } from '@paneron/libmmel/interface/baseinterface';
import { DataLinkEdge, NormalEdge, SelfLoopEdge } from '@/smart/ui/flowui/edgeUI';
import {
Expand All @@ -14,8 +14,8 @@ import {
StartComponent,
TimerComponent,
} from '@/smart/ui/flowui/nodeUI';
import { EditorModel, ModelType } from '@/smart/model/editormodel';
import { MMELDocument } from '@/smart/model/document';
import type { EditorModel, ModelType } from '@/smart/model/editormodel';
import type { MMELDocument } from '@/smart/model/document';

export interface FunModel {
mw: ModelWrapper;
Expand Down
12 changes: 6 additions & 6 deletions src/smart/model/ViewFunctionModel.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { SerializedStyles } from '@emotion/react';
import React from 'react';
import type { SerializedStyles } from '@emotion/react';
import type React from 'react';
import { textToMMEL } from '@paneron/libmmel';
import { MMELDataAttribute } from '@paneron/libmmel/interface/datainterface';
import {
import type { MMELDataAttribute } from '@paneron/libmmel/interface/datainterface';
import type {
MMELProvision,
MMELReference,
} from '@paneron/libmmel/interface/supportinterface';
import { EditorNode } from '@/smart/model/editormodel';
import { LegendInterface } from '@/smart/model/States';
import type { EditorNode } from '@/smart/model/editormodel';
import type { LegendInterface } from '@/smart/model/States';


console.log(textToMMEL);
Expand Down
4 changes: 2 additions & 2 deletions src/smart/model/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* The data model for change log and some utility functions for the change log
*/

import { ModelAction } from '@/smart/model/editor/model';
import { EditorModel } from '@/smart/model/editormodel';
import type { ModelAction } from '@/smart/model/editor/model';
import type { EditorModel } from '@/smart/model/editormodel';

interface CommandEvent {
type: 'command';
Expand Down
11 changes: 6 additions & 5 deletions src/smart/model/checklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
* The data model for checklist
*/

import { MMELProvision } from '@paneron/libmmel/interface/supportinterface';
import { MMELDataAttribute } from '@paneron/libmmel/interface/datainterface';
import { ModalityType } from '@/smart/utils/constants';
import {
import type { MMELProvision } from '@paneron/libmmel/interface/supportinterface';
import type { MMELDataAttribute } from '@paneron/libmmel/interface/datainterface';
import type { ModalityType } from '@/smart/utils/constants';
import type {
EditorApproval,
EditorDataClass,
EditorEGate,
EditorProcess,
EditorRegistry,
EditorRegistry } from '@/smart/model/editormodel';
import {
isMMELDataAttribute,
} from '@/smart/model/editormodel';

Expand Down
2 changes: 1 addition & 1 deletion src/smart/model/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* The model for text document. Can be a document translated from XML or a regulation document
*/

import { RefObject } from 'react';
import type { RefObject } from 'react';

export interface DocStatement {
id: string;
Expand Down
4 changes: 2 additions & 2 deletions src/smart/model/editor/commands/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* This file centralizes the commands generated related to comment components
*/

import { MMELComment } from '@paneron/libmmel/interface/supportinterface';
import { ModelAction } from '@/smart/model/editor/model';
import type { MMELComment } from '@paneron/libmmel/interface/supportinterface';
import type { ModelAction } from '@/smart/model/editor/model';

/**
* Add a new comment to the model
Expand Down
8 changes: 4 additions & 4 deletions src/smart/model/editor/commands/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* This file centralizes the commands generated related to registry and data class
*/

import { MMELReference } from '@paneron/libmmel/interface/supportinterface';
import { EditorDataClass } from '@/smart/model/editormodel';
import { RegistryCombined } from '@/smart/model/editor/components/element/registry';
import { ModelAction } from '@/smart/model/editor/model';
import type { MMELReference } from '@paneron/libmmel/interface/supportinterface';
import type { EditorDataClass } from '@/smart/model/editormodel';
import type { RegistryCombined } from '@/smart/model/editor/components/element/registry';
import type { ModelAction } from '@/smart/model/editor/model';

/**
* Delete the registries from the model
Expand Down
11 changes: 6 additions & 5 deletions src/smart/model/editor/commands/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@
* This file centralizes the commands related to node elements
*/

import { MMELEdge } from '@paneron/libmmel/interface/flowcontrolinterface';
import {
import type { MMELEdge } from '@paneron/libmmel/interface/flowcontrolinterface';
import type {
MMELLink,
MMELNote,
MMELProvision,
MMELReference,
} from '@paneron/libmmel/interface/supportinterface';
import {
import type {
EditorEGate,
EditorModel,
EditorNode,
EditorProcess,
EditorProcess } from '@/smart/model/editormodel';
import {
isEditorProcess,
} from '@/smart/model/editormodel';
import { ModelAction } from '@/smart/model/editor/model';
import type { ModelAction } from '@/smart/model/editor/model';

/**
* Edit the node elements. It can include gateway, approval, process, timer / signal events.
Expand Down
4 changes: 2 additions & 2 deletions src/smart/model/editor/commands/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* This file centralizes the commands related to page change
*/

import { HistoryItem } from '@/smart/model/history';
import { HistoryAction } from '@/smart/model/editor/history';
import type { HistoryItem } from '@/smart/model/history';
import type { HistoryAction } from '@/smart/model/editor/history';

/**
* Go to a new page (subprocess) of a process on the current page
Expand Down
Loading

0 comments on commit aec4b72

Please sign in to comment.