diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..0b6a6532 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,23 @@ +exclude: ".projen*|.git*" +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: https://github.com/gitleaks/gitleaks + rev: v8.18.0 + hooks: + - id: gitleaks + - repo: local + hooks: + - id: eslint + name: eslint + entry: bash -c "npm run lint" + language: node + - id: test + name: test + entry: bash -c "npm run test" + stages: [pre-push] + language: node diff --git a/src/execute/lex-pipe.ts b/src/execute/lex-pipe.ts index 05c41d6e..cbd3dc6a 100644 --- a/src/execute/lex-pipe.ts +++ b/src/execute/lex-pipe.ts @@ -46,7 +46,6 @@ export class LexPipe extends Frame implements IFinish, IPerformer { break } case 'bind': { - break const next_parser = parser.bind() this.set(Frame.kOUT, next_parser) this.level += 1 diff --git a/src/execute/lex.ts b/src/execute/lex.ts index a6998050..a6e0d6c7 100644 --- a/src/execute/lex.ts +++ b/src/execute/lex.ts @@ -23,7 +23,7 @@ export class Token extends FrameAtom { return `Token[${this.data.inspect()}]` } - public isSpace() { + public isSpace () { return this.data instanceof FrameSpace } } @@ -57,7 +57,7 @@ export class Lex extends Frame implements ISourced { const end = this.isEnd(char) const terminal = Lex.isTerminal(char) const not_quote = !this.isQuote() - const not_space = char != ' ' + const not_space = char !== ' ' if (end && terminal && not_space) { // ends token on a terminal return this.finish(argument, true) diff --git a/src/execute/parse-pipe.ts b/src/execute/parse-pipe.ts index b681bf3f..fd086698 100644 --- a/src/execute/parse-pipe.ts +++ b/src/execute/parse-pipe.ts @@ -29,11 +29,11 @@ export class ParsePipe extends FrameArray implements IFinish { return this } - public bind(_Factory: any = undefined): Frame { + public bind (_Factory: any = undefined): Frame { return this.push(FrameBind) } - public unbind(): boolean { + public unbind (): boolean { if (this.Factory === FrameBind) { this.pop(FrameBind) return true diff --git a/src/frames/frame-array.ts b/src/frames/frame-array.ts index 0e2d0b30..0bac28eb 100644 --- a/src/frames/frame-array.ts +++ b/src/frames/frame-array.ts @@ -23,10 +23,10 @@ export class FrameArray extends FrameList { const array = this.array_eval(contexts) return new FrameArray(array) } - + public get (key: string, origin: MetaFrame = this): Frame { if (!isNaN(Number(key))) { - return this.at(Number(key)); + return this.at(Number(key)) } return super.get(key, origin) } diff --git a/test/frames/frame-expr-spec.ts b/test/frames/frame-expr-spec.ts index 3641cae3..4c0887b2 100644 --- a/test/frames/frame-expr-spec.ts +++ b/test/frames/frame-expr-spec.ts @@ -35,7 +35,7 @@ describe('FrameExpr', () => { expect(result).to.equal(context) }) - + it('applies FrameName to FrameArray to extract elements that index', () => { const js_string_2 = ', MAML!' const frame_string_2 = new FrameString(js_string_2)