Merged PR 170: Add new eslint rules

- naming-convention
- prefer-arrow-callback
- func-style
- import/no-default-export
This commit is contained in:
Eric Nguyen 2022-08-26 16:13:21 +00:00
parent 3f58c5ba5e
commit ad126c6c28
65 changed files with 781 additions and 784 deletions

View file

@ -1,4 +1,4 @@
import { findContainerById, MakeIterator } from './itertools';
import { FindContainerById, MakeIterator } from './itertools';
import { IEditorState } from '../Interfaces/IEditorState';
import { IHistoryState } from '../Interfaces/IHistoryState';
@ -19,34 +19,32 @@ export function Revive(editorState: IEditorState): void {
}
}
export const ReviveState = (
state: IHistoryState
): void => {
if (state.MainContainer === null || state.MainContainer === undefined) {
export function ReviveState(state: IHistoryState): void {
if (state.mainContainer === null || state.mainContainer === undefined) {
return;
}
state.Symbols = new Map(state.Symbols);
for (const symbol of state.Symbols.values()) {
state.symbols = new Map(state.symbols);
for (const symbol of state.symbols.values()) {
symbol.linkedContainers = new Set(symbol.linkedContainers);
}
const it = MakeIterator(state.MainContainer);
const it = MakeIterator(state.mainContainer);
for (const container of it) {
const parentId = container.properties.parentId;
if (parentId === null) {
container.parent = null;
continue;
}
const parent = findContainerById(state.MainContainer, parentId);
const parent = FindContainerById(state.mainContainer, parentId);
if (parent === undefined) {
continue;
}
container.parent = parent;
}
};
}
export const getCircularReplacer = (): (key: any, value: object | Map<string, any> | null) => object | null | undefined => {
export function GetCircularReplacer(): (key: any, value: object | Map<string, any> | null) => object | null | undefined {
return (key: any, value: object | null) => {
if (key === 'parent') {
return;
@ -62,4 +60,4 @@ export const getCircularReplacer = (): (key: any, value: object | Map<string, an
return value;
};
};
}