Skip to content

Commit 2a5d88c

Browse files
committed
Run ESlint on runtime
1 parent 03c137f commit 2a5d88c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+2388
-2388
lines changed

rt/src/AbstractLevel.mts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import { TroupeType } from "./TroupeTypes.mjs";
22
import { TroupeRawValue } from "./TroupeRawValue.mjs";
33

4-
export abstract class AbstractLevel <T extends AbstractLevel<T>>
4+
export abstract class AbstractLevel <T extends AbstractLevel<T>>
55
implements TroupeRawValue {
6-
isLevel: boolean = true ;
7-
_troupeType: TroupeType = TroupeType.LEVEL
6+
isLevel = true ;
7+
_troupeType: TroupeType = TroupeType.LEVEL;
88
abstract dataLevel;
9-
abstract stringRep (): string
9+
abstract stringRep (): string
1010
}
1111

1212

1313
export abstract class AbstractLevelSystem <T extends AbstractLevel<T>> {
14-
abstract BOT : T
15-
abstract TOP : T
16-
abstract ROOT : T
17-
abstract NULL : T
18-
abstract lub (...ls:T[]) : T
14+
abstract BOT : T
15+
abstract TOP : T
16+
abstract ROOT : T
17+
abstract NULL : T
18+
abstract lub (...ls:T[]) : T
1919
lubs (ls:T[]) {
2020
return this.lub(...ls);
2121
}
22-
abstract glb (a : T, b: T) : T
22+
abstract glb (a : T, b: T) : T
2323
abstract flowsTo (a: T, b: T) : boolean
2424
abstract actsFor (a: T, b: T) : boolean
2525
}

rt/src/Asserts.mts

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import * as proc from './process.mjs';
55
const ProcessID = proc.ProcessID;
66
import { AbstractLevel } from './AbstractLevel.mjs';
77
import { Level } from './Level.mjs';
8-
import { Authority } from './Authority.mjs'
9-
import * as levels from './Level.mjs';
8+
import { Authority } from './Authority.mjs';
9+
import * as levels from './Level.mjs';
1010
import { TroupeType } from './TroupeTypes.mjs';
1111
const actsFor = levels.actsFor;
1212

@@ -16,204 +16,204 @@ import { TroupeAggregateRawValue, TroupeRawValue } from './TroupeRawValue.mjs';
1616
// import { LVal } from './Lval';
1717

1818
function _thread() {
19-
return getRuntimeObject().__sched.__currentThread
19+
return getRuntimeObject().__sched.__currentThread;
2020
}
2121

2222
function __stringRep (v) {
2323
if (v.stringRep) {
24-
return v.stringRep()
24+
return v.stringRep();
2525
} else {
26-
let t=""
26+
let t="";
2727
if (typeof v === 'string') {
28-
t = "\"" + v.toString() + "\""
28+
t = "\"" + v.toString() + "\"";
2929
} else {
3030
t = v.toString();
3131
}
32-
return t
32+
return t;
3333
}
3434
}
3535

36-
let err = x => _thread().threadError(x)
36+
const err = x => { _thread().threadError(x); };
3737
export function assertIsAtom (x: any) {
38-
_thread().raiseBlockingThreadLev(x.tlev)
38+
_thread().raiseBlockingThreadLev(x.tlev);
3939
if (x.val._troupeType != TroupeType.ATOM ) {
40-
err ("value " + __stringRep(x) + " is not an atom")
40+
err ("value " + __stringRep(x) + " is not an atom");
4141
}
4242
}
4343

4444
export function rawAssertIsNumber (x) {
4545
if (typeof x != 'number') {
46-
err("value " + __stringRep(x) + " is not a number")
46+
err("value " + __stringRep(x) + " is not a number");
4747
}
4848
}
4949

5050
export function assertIsNumber(x: any) {
51-
_thread().raiseBlockingThreadLev(x.tlev)
51+
_thread().raiseBlockingThreadLev(x.tlev);
5252
if (typeof x.val != 'number') {
53-
err("value " + __stringRep(x) + " is not a number")
53+
err("value " + __stringRep(x) + " is not a number");
5454
}
5555
}
5656

5757
export function assertIsBoolean(x: any) {
5858
_thread().raiseBlockingThreadLev(x.tlev);
5959
if (typeof x.val != 'boolean') {
60-
err("value " + __stringRep(x) + " is not a boolean")
60+
err("value " + __stringRep(x) + " is not a boolean");
6161
}
6262
}
6363

6464
export function rawAssertIsBoolean(x:any) {
6565
if (typeof x != 'boolean') {
66-
err("value " + __stringRep(x) + " is not a boolean")
66+
err("value " + __stringRep(x) + " is not a boolean");
6767
}
6868
}
6969

7070
export function assertIsFunction(x: any, internal = false) {
7171
_thread().raiseBlockingThreadLev(x.tlev);
72-
rawAssertIsFunction (x.val, internal)
72+
rawAssertIsFunction (x.val, internal);
7373
}
7474

7575
export function rawAssertIsFunction(x, internal = false) {
7676
if (x._troupeType != TroupeType.CLOSURE) {
77-
_thread().threadError("value " + __stringRep(x) + " is not a function", internal)
77+
_thread().threadError("value " + __stringRep(x) + " is not a function", internal);
7878
}
7979
}
8080

8181

8282
export function assertIsLocalObject(x: any) {
8383
_thread().raiseBlockingThreadLev(x.tlev);
8484
if (x.val._troupeType != TroupeType.LOCALOBJECT) {
85-
err("value " + __stringRep(x) + " is not a local object")
85+
err("value " + __stringRep(x) + " is not a local object");
8686
}
8787
}
8888

8989
export function assertIsHandler(x: any) {
9090
_thread().raiseBlockingThreadLev(x.tlev);
9191
if (x.val._troupeType != TroupeType.CLOSURE) {
92-
err("value " + __stringRep(x) + " is not a handler")
92+
err("value " + __stringRep(x) + " is not a handler");
9393
}
9494
}
9595

9696
export function assertIsUnit(x: any) {
9797
_thread().raiseBlockingThreadLev(x.tlev);
9898
if (!x.val._is_unit) {
99-
err("value " + __stringRep(x) + " is not unit")
99+
err("value " + __stringRep(x) + " is not unit");
100100
}
101101
}
102102

103103

104104
export function assertIsListOrTuple(x: any) {
105105
_thread().raiseBlockingThreadLev(x.lev);;
106106
if (!((isListFlagSet(x.val) || isTupleFlagSet(x.val)))) {
107-
err("value " + __stringRep(x) + " is not a list or tuple")
107+
err("value " + __stringRep(x) + " is not a list or tuple");
108108
}
109109
}
110110

111111
export function assertIsList(x: any) {
112112
_thread().raiseBlockingThreadLev(x.lev);;
113-
rawAssertIsList(x.val)
113+
rawAssertIsList(x.val);
114114
}
115115

116116
export function rawAssertIsList (x:any) {
117117
if (!isListFlagSet(x)) {
118-
err("value " + __stringRep(x) + " is not a list")
118+
err("value " + __stringRep(x) + " is not a list");
119119
}
120120
}
121121

122122
export function assertIsNTuple(x: any, n: number) {
123123
_thread().raiseBlockingThreadLev(x.lev);
124124
if (!(Array.isArray(x.val) && isTupleFlagSet(x.val) && x.val.length == n)) {
125-
err("value " + __stringRep(x) + " is not a " + n + "-tuple")
125+
err("value " + __stringRep(x) + " is not a " + n + "-tuple");
126126
}
127127
}
128128

129129

130130
export function assertIsNTupleR3 (x:TroupeRawValue, lev:Level, tlev:Level, n:number) {
131131
_thread().raiseBlockingThreadLev(lev);
132132
if (!(Array.isArray(x) && isTupleFlagSet(x) && x.length == n)) {
133-
err("value " + __stringRep(x) + " is not a " + n + "-tuple")
133+
err("value " + __stringRep(x) + " is not a " + n + "-tuple");
134134
}
135135
}
136136

137137
export function rawAssertIsTuple (x) {
138138
if (!(Array.isArray(x) && isTupleFlagSet(x) )) {
139-
err("value " + __stringRep(x) + " is not a tuple")
140-
}
139+
err("value " + __stringRep(x) + " is not a tuple");
140+
}
141141
}
142142

143143
/**
144144
* Assumes `x` is a tuple and asserts it has at least length `n`.
145145
*/
146146
export function rawAssertTupleLengthGreaterThan (x, n: number) {
147147
if (x.length <= n) {
148-
err("Index out of bounds: tuple " + __stringRep(x) + " does not have length more than " + n)
148+
err("Index out of bounds: tuple " + __stringRep(x) + " does not have length more than " + n);
149149
}
150150
}
151151

152152

153153
export function rawAssertRecordHasField (x, field: string) {
154154
if (!x.hasField(field)) {
155-
err (`record ${__stringRep(x)} does not have field \'${field}\'`)
155+
err (`record ${__stringRep(x)} does not have field \'${field}\'`);
156156
}
157157
}
158158

159159

160160
export function assertIsRecord (x: any) {
161161
_thread().raiseBlockingThreadLev(x.lev);
162162
if (x.val._troupeType != TroupeType.RECORD) {
163-
err (`value ${__stringRep(x)} is not a record`)
163+
err (`value ${__stringRep(x)} is not a record`);
164164
}
165165
}
166166

167167
export function rawAssertIsRecord (x: any) {
168168
if (x._troupeType != TroupeType.RECORD) {
169-
err (`value ${__stringRep(x)} is not a record`)
169+
err (`value ${__stringRep(x)} is not a record`);
170170
}
171171
}
172172

173173
export function assertIsString(x: any) {
174174
_thread().raiseBlockingThreadLev(x.tlev);
175175
if (typeof x.val != 'string') {
176-
err("value " + __stringRep(x) + " is not a string")
176+
err("value " + __stringRep(x) + " is not a string");
177177
}
178178
}
179179

180180
export function rawAssertIsString(x:any) {
181181
if (typeof x != 'string') {
182-
err("value " + __stringRep(x) + " is not a string")
183-
}
182+
err("value " + __stringRep(x) + " is not a string");
183+
}
184184
}
185185

186186
export function rawAssertNotZero(x:any) {
187187
if (x === 0) {
188-
err("Division by zero error")
188+
err("Division by zero error");
189189
}
190190
}
191191

192192

193193
export function assertIsNode(x: any) {
194194
_thread().raiseBlockingThreadLev(x.tlev);
195195
if (typeof x.val != 'string') {
196-
err("value " + __stringRep(x) + " is not a node string") // todo: check for it being a proper nodeid format?
196+
err("value " + __stringRep(x) + " is not a node string"); // todo: check for it being a proper nodeid format?
197197
}
198198
if (x.val.startsWith("@")) {
199199
if (!__nodeManager.aliases[x.val.substring(1)]) {
200-
err(`${x.val} is not a defined alias`)
200+
err(`${x.val} is not a defined alias`);
201201
}
202202
}
203203
}
204204

205205
export function assertIsProcessId(x: any) {
206206
_thread().raiseBlockingThreadLev(x.tlev);
207207
if (!(x.val instanceof ProcessID)) {
208-
err("value " + __stringRep(x) + " is not a process id")
208+
err("value " + __stringRep(x) + " is not a process id");
209209
}
210210
}
211211

212212

213213
export function assertIsCapability(x: any) {
214214
_thread().raiseBlockingThreadLev(x.tlev);
215215
if (!(x.val instanceof Capability)) {
216-
err("value " + __stringRep(x) + " is not a capability of lowering the mailbox clearance")
216+
err("value " + __stringRep(x) + " is not a capability of lowering the mailbox clearance");
217217
}
218218
}
219219

@@ -230,11 +230,11 @@ export function rawAssertIsLevel (x:any) {
230230
}
231231
}
232232
export function assertIsRootAuthority(x: any) {
233-
let isTop = actsFor(x.val.authorityLevel, levels.ROOT);
233+
const isTop = actsFor(x.val.authorityLevel, levels.ROOT);
234234
if (!isTop) {
235-
let errorMessage =
235+
const errorMessage =
236236
"Provided authority is not TOP\n" +
237-
` | level of the provided authority: ${x.val.authorityLevel.stringRep()}`
237+
` | level of the provided authority: ${x.val.authorityLevel.stringRep()}`;
238238
err(errorMessage);
239239
}
240240
}
@@ -262,13 +262,13 @@ export function assertIsEnv(x: any) {
262262

263263
export function assertNormalState(s: string) {
264264
if (!_thread().handlerState.isNormal()) {
265-
err("invalid handler state in " + s + " -- side effects are prohbited in handler pattern matching or sandboxed code")
265+
err("invalid handler state in " + s + " -- side effects are prohbited in handler pattern matching or sandboxed code");
266266
}
267267
}
268268

269269
export function assertDeclassificationAllowed(s: string) {
270270
if (!_thread().handlerState.declassificationAllowed()) {
271-
err("invalid handler state in " + s + ": declassification prohibited in handler pattern matching")
271+
err("invalid handler state in " + s + ": declassification prohibited in handler pattern matching");
272272
}
273273
}
274274

@@ -291,9 +291,9 @@ export function assertPairAreStringsOrNumbers(x: any, y: any) {
291291

292292
export function rawAssertPairsAreStringsOrNumbers (x:any, y:any) {
293293
switch (typeof x) {
294-
case 'number': rawAssertIsNumber(y); break
295-
case 'string': rawAssertIsString(y); break
296-
default: err("value " + __stringRep(x) + " is not a number or a string")
294+
case 'number': rawAssertIsNumber(y); break;
295+
case 'string': rawAssertIsString(y); break;
296+
default: err("value " + __stringRep(x) + " is not a number or a string");
297297
// default: err("values " + __stringRep(x) + " and " + __stringRep(y) + " are of different types")
298298
}
299299
}

rt/src/Atom.mts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import runId from "./runId.mjs"
2-
import { TroupeType } from "./TroupeTypes.mjs"
1+
import runId from "./runId.mjs";
2+
import { TroupeType } from "./TroupeTypes.mjs";
33
import { TroupeRawValue } from "./TroupeRawValue.mjs";
4-
import * as levels from './Level.mjs'
4+
import * as levels from './Level.mjs';
55

6-
let rt_uuid = runId
6+
const rt_uuid = runId;
77

88
export class Atom implements TroupeRawValue {
9-
atom: string
9+
atom: string;
1010
creation_uuid: any;
11-
_troupeType = TroupeType.ATOM
12-
dataLevel = levels.BOT
13-
11+
_troupeType = TroupeType.ATOM;
12+
dataLevel = levels.BOT;
13+
1414
constructor (name:string, creation_uuid = rt_uuid) {
15-
this.atom = name;
16-
this.creation_uuid = creation_uuid
15+
this.atom = name;
16+
this.creation_uuid = creation_uuid;
1717
}
1818

1919
stringRep (_omitLevels = false) {
20-
return this.atom
21-
}
20+
return this.atom;
21+
}
2222
}

rt/src/Authority.mts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import { TroupeType } from "./TroupeTypes.mjs";
66
export class Authority implements TroupeRawValue {
77
authorityLevel: Level;
88
stringRep: () => string;
9-
_troupeType = TroupeType.AUTHORITY
9+
_troupeType = TroupeType.AUTHORITY;
1010
dataLevel = BOT;
1111
constructor (authorityLevel: Level) {
12-
this.authorityLevel = authorityLevel
12+
this.authorityLevel = authorityLevel;
1313
this.stringRep = this.toString;
1414
}
1515

1616
toString () {
17-
let x = this.authorityLevel.stringRep();
17+
const x = this.authorityLevel.stringRep();
1818
return "!" + x;
19-
}
19+
}
2020
}
2121

0 commit comments

Comments
 (0)