Skip to content

Commit

Permalink
chore: lint auto-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mgabeler-lee-6rs committed Jan 18, 2023
1 parent 25e43ce commit ee7a5a0
Show file tree
Hide file tree
Showing 41 changed files with 73 additions and 57 deletions.
1 change: 1 addition & 0 deletions lib/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export {NodeStorage} from './NodeStorage';

export * from './ResultCode';
import {resultCodes} from './ResultCode';

export {resultCodes as rc};

export {BaseNode} from './BaseNode';
Expand Down
6 changes: 3 additions & 3 deletions lib/nodes/Base.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* Created by josh on 1/10/16.
*/
import {v4} from 'uuid';

import {
BlueshellState,
NodeStorage,
Expand All @@ -9,8 +11,6 @@ import {
BaseNode,
isParentNode,
} from '../models';
import {v4} from 'uuid';

import {TreePublisher, TreeNonPublisher, NodeManager} from '../utils';

/**
Expand All @@ -26,7 +26,7 @@ export interface PrivateNodeStorage {
* @author Joshua Chaitin-Pollak
*/
export class Base<S extends BlueshellState, E> implements BaseNode<S, E> {
private _id: string = '';
private _id = '';
private _parent: string;

// Hard to properly type this since the static can't
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/Composite.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BlueshellState, ResultCode, resultCodes, BaseNode} from '../models';
import {Parent, setEventCounter} from './Parent';
import {BlueshellState, ResultCode, resultCodes, BaseNode} from '../models';

/**
* Base class for all Composite Nodes (nodes which have an array of children).
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/Constant.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ResultCode, BlueshellState} from '../models';
import {Action} from './Base';
import {ResultCode, BlueshellState} from '../models';

export class Constant<S extends BlueshellState, E> extends Action<S, E> {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/Decorator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BlueshellState, ResultCode, rc, BaseNode} from '../models';
import {Composite} from './Composite';
import {BlueshellState, ResultCode, rc, BaseNode} from '../models';

/**
* Base Class for all Decorator Nodes. Can only have one child.
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/IfElse.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Created by jpollak on 5/29/16.
*/
import {BlueshellState, ResultCode, isResultCode, rc, BaseNode, Conditional} from '../models';
import {Parent} from './Parent';
import {Constant} from './Constant';
import {Parent} from './Parent';
import {BlueshellState, ResultCode, isResultCode, rc, BaseNode, Conditional} from '../models';

/**
* If-Else Conditional Composite Node.
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/IfElseWithNodeCondition.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {BlueshellState, ResultCode, rc, BaseNode} from '../models';
import {IfElse} from './IfElse';
import {BlueshellState, ResultCode, rc, BaseNode} from '../models';

export class IfElseWithNodeCondition<S extends BlueshellState, E> extends IfElse<S, E> {
// below variable is used to communicate the result of running the conditionNode between
// onEvent() and the callback passed to IfElse in the super() call
private conditionResult: boolean = false;
private conditionResult = false;

constructor(
name: string,
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/LatchedIfElse.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Created by masdoorian on 06/23/21
*/
import {BlueshellState, ResultCode, rc, BaseNode, Conditional} from '../models';
import {IfElse} from './IfElse';
import {BlueshellState, ResultCode, rc, BaseNode, Conditional} from '../models';

const LATCHED_RUNNING_CONSEQUENT = 0;
const LATCHED_RUNNING_ALTERNATIVE = 1;
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/LatchedSelector.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Created by josh on 1/10/16.
*/
import {BlueshellState, BaseNode} from '../models';
import {Selector} from './Selector';
import {BlueshellState, BaseNode} from '../models';

/**
* Sends an event to each child until one of them returns `SUCCESS` or `RUNNING`, then returns that value.
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/LatchedSequence.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BlueshellState, BaseNode} from '../models';
import {Sequence} from './Sequence';
import {BlueshellState, BaseNode} from '../models';

/**
* Sends an event to each child until one of the returns `FAILURE`, or `RUNNING`, then returns that value.
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/LatchedSwitch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BlueshellState, ResultCode, rc, BaseNode, Conditional} from '../models';
import {Switch} from './Switch';
import {BlueshellState, ResultCode, rc, BaseNode, Conditional} from '../models';

/**
* Executes the child action associated with the first matching conditional.
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/Parent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BlueshellState, BaseNode, ParentNode, isParentNode} from '../models';
import {Action, PrivateNodeStorage} from './Base';
import {BlueshellState, BaseNode, ParentNode, isParentNode} from '../models';

/**
* Sets the event counter of the nocde and any child nodes to indicate
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/Predicate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BlueshellState, rc} from '../models';
import {Action} from './Base';
import {BlueshellState, rc} from '../models';

export class Predicate<S extends BlueshellState, E> extends Action<S, E> {
constructor(name: string, private readonly predicate: (state: S, event: E) => boolean) {
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/RunningAction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BlueshellState, ResultCode, rc} from '../models';
import {Action} from './Base';
import {BlueshellState, ResultCode, rc} from '../models';

export abstract class RunningAction<S extends BlueshellState, E> extends Action<S, E> {
constructor(name: string) {
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/Selector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BlueshellState, rc, ResultCode} from '../models';
import {Composite} from './Composite';
import {BlueshellState, rc, ResultCode} from '../models';


/**
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/Sequence.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BlueshellState, rc, ResultCode} from '../models';
import {Composite} from './Composite';
import {BlueshellState, rc, ResultCode} from '../models';

/**
* Sends an event to each child until one of the returns `FAILURE`, or `RUNNING`, then returns that value.
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/SideEffect.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BlueshellState, rc} from '../models';
import {Action} from './Base';
import {BlueshellState, rc} from '../models';

export class SideEffect<S extends BlueshellState, E> extends Action<S, E> {
constructor(readonly name: string, private sideEffect: (state: S, event: E) => void) {
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/Success.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BlueshellState, rc} from '../models';
import {Constant} from './Constant';
import {BlueshellState, rc} from '../models';

export class Success<S extends BlueshellState, E> extends Constant<S, E> {
constructor(
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/Switch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {BlueshellState, ResultCode, isResultCode, rc, BaseNode, Conditional} from '../models';
import {Parent} from './Parent';
import {Constant} from './Constant';
import {Parent} from './Parent';
import {BlueshellState, ResultCode, isResultCode, rc, BaseNode, Conditional} from '../models';

export interface SwitchEntry<S extends BlueshellState, E> {
conditional?: Conditional<S, E>,
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/decorators/RepeatOnResult.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Created by josh on 1/12/16.
*/
import {BlueshellState, BaseNode} from '../../models';
import {RepeatWhen} from './RepeatWhen';
import {BlueshellState, BaseNode} from '../../models';

/**
* The child Node repeats handling the event if the child resulted in a specified status.
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/decorators/Retry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NodeStorage, BlueshellState, ResultCode, rc, BaseNode} from '../../models';
import {RepeatWhen} from './RepeatWhen';
import {NodeStorage, BlueshellState, ResultCode, rc, BaseNode} from '../../models';

export type RetryNodeStorage = NodeStorage & {repeats?: number};

Expand Down
1 change: 1 addition & 0 deletions lib/nodes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ export {Switch, SwitchEntry} from './Switch';
export {LatchedSwitch} from './LatchedSwitch';

import * as decorators from './decorators';

export {decorators};
8 changes: 5 additions & 3 deletions lib/utils/nodeManager.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
/* eslint-disable no-console */

import {BaseNode, BlueshellState, isParentNode} from '../models';
import Websocket from 'ws';
import util from 'util';
import {EventEmitter} from 'events';
import {Session} from 'inspector';
import util from 'util';

import Websocket from 'ws';

import {RuntimeWrappers, Utils} from './nodeManagerHelper';
import {
NodePathKey,
ClassMethodNameKey,
BreakpointInfo,
NodeMethodsInfo
} from './nodeManagerTypes';
import {BaseNode, BlueshellState, isParentNode} from '../models';

export class DuplicateNodeAdded extends Error {
constructor(path: string) {
Expand Down
5 changes: 3 additions & 2 deletions lib/utils/nodeManagerHelper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Runtime, Session, Debugger} from 'inspector';
import {promisify} from 'util';

import {
ClassMethodNameKey,
BreakpointInfo,
Expand Down Expand Up @@ -104,8 +105,8 @@ export namespace Utils {
}
condition +=
`(this.path === '${breakpointData.nodePath}'` +
(!!breakpointData.condition ? ` && ${breakpointData.condition}` : '')
+ ')';
(!!breakpointData.condition ? ` && ${breakpointData.condition}` : '') +
')';
});
return condition;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/renderTree.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Created by jpollak on 3/23/16.
*/
import {BlueshellState, BaseNode} from '../models';
import {serializeArchyTree} from './archyTree';
import {serializeDotTree} from './dotTree';
import {BlueshellState, BaseNode} from '../models';

export function toString<S extends BlueshellState, E>(
tree: BaseNode<S, E>, state?: S, contextDepth = Number.MAX_SAFE_INTEGER
Expand Down
1 change: 1 addition & 0 deletions test/nodes/Base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Created by josh on 1/10/16.
*/
import {assert} from 'chai';

import {rc} from '../../lib';
import * as Behavior from '../../lib';

Expand Down
2 changes: 1 addition & 1 deletion test/nodes/Composite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import {assert} from 'chai';

import {rc} from '../../lib';
import {RobotState, waitAi} from './test/RobotActions';
import {rc} from '../../lib';

describe('Composite', function() {
context('#resetNodeStorage', function() {
Expand Down
4 changes: 2 additions & 2 deletions test/nodes/IfElse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {rc} from '../../lib';
import * as Behavior from '../../lib';

class TestState implements Behavior.BlueshellState {
public success: boolean = false;
public failure: boolean = false;
public success = false;
public failure = false;
public errorReason?: Error;
public __blueshell: any;
}
Expand Down
4 changes: 2 additions & 2 deletions test/nodes/IfElseWithNodeCondition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {rc} from '../../lib';
import * as Behavior from '../../lib';

class TestState implements Behavior.BlueshellState {
public successCount: number = 0;
public failureCount: number = 0;
public successCount = 0;
public failureCount = 0;
public errorReason?: Error;
public __blueshell: any;
}
Expand Down
6 changes: 4 additions & 2 deletions test/nodes/LatchedIfElse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
* Created by josh on 1/10/16.
*/
import {assert} from 'chai';

import {rc, ResultCode} from '../../lib';
import * as Behavior from '../../lib';

class TestState implements Behavior.BlueshellState {
public calledMap: Map<ResultCode, boolean> = new Map();
public runCounter: number = 0;
public runCounter = 0;
public errorReason?: Error;
public __blueshell: any;
}

class LatchedAction extends Behavior.Action<TestState, string> {
private runCounter: number = 0;
private runCounter = 0;

constructor(
name?: string,
Expand Down
2 changes: 1 addition & 1 deletion test/nodes/LatchedSelector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
*/
import {assert} from 'chai';

import * as TestActions from './test/RobotActions';
import {rc} from '../../lib';
import * as Behavior from '../../lib';

import * as TestActions from './test/RobotActions';

const shutdownAi = new Behavior.LatchedSelector('shutdownAi',
[
Expand Down
2 changes: 1 addition & 1 deletion test/nodes/LatchedSequence.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
*/
import {assert} from 'chai';

import {RobotState} from './test/RobotActions';
import {rc} from '../../lib';
import * as Behavior from '../../lib';

import {RobotState} from './test/RobotActions';

class StopMotors extends Behavior.Action<RobotState, string> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
3 changes: 2 additions & 1 deletion test/nodes/LatchedSwitch.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {assert} from 'chai';

import {Action, BlueshellState, rc, ResultCode, LatchedSwitch, SwitchEntry} from '../../lib';

class TestAction<S extends BlueshellState, E> extends Action<S, E> {
public eventCount: number = 0;
public eventCount = 0;

constructor(
name?: string,
Expand Down
4 changes: 2 additions & 2 deletions test/nodes/Selector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
*/
import {assert} from 'chai';

import * as TestActions from './test/RobotActions';
import {RobotState} from './test/RobotActions';
import {rc, BlueshellState} from '../../lib';
import * as Behavior from '../../lib';

import * as TestActions from './test/RobotActions';
import {RobotState} from './test/RobotActions';

describe('Selector', function() {
let waitAi: Behavior.Selector<BlueshellState, any>;
Expand Down
2 changes: 1 addition & 1 deletion test/nodes/Sequence.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*/
import {assert} from 'chai';

import {DroneState} from './test/DroneActions';
import {rc} from '../../lib';
import * as Behavior from '../../lib';
import {DroneState} from './test/DroneActions';

class ShootFlares extends Behavior.Action<DroneState, string> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
3 changes: 2 additions & 1 deletion test/nodes/Switch.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {assert} from 'chai';

import {Action, BlueshellState, rc, ResultCode, Switch, SwitchEntry} from '../../lib';

class TestAction<S extends BlueshellState, E> extends Action<S, E> {
public eventCount: number = 0;
public eventCount = 0;

onEvent(state: S, event: E): ResultCode {
this.eventCount++;
Expand Down
5 changes: 3 additions & 2 deletions test/nodes/decorators/While.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {assert} from 'chai';

import {Action, BlueshellState, rc, ResultCode, decorators} from '../../../lib';

class TestAction extends Action<TestState, number> {
public eventCount: number = 0;
private currentSequenceIdx: number = 0;
public eventCount = 0;
private currentSequenceIdx = 0;

constructor(
name?: string,
Expand Down
Loading

0 comments on commit ee7a5a0

Please sign in to comment.