Skip to content

Commit

Permalink
Fix lint errors (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim Demedes authored Nov 3, 2020
1 parent 71f3583 commit 4cdb252
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export enum AbstractSyntaxType {
// Splits children into "leaves" and "nodes" so we get
// type safety and don't have to deal with union types
export interface ASTNode {
children: Array<Token | ASTNode>
children: (Token | ASTNode)[]
type: AbstractSyntaxType
}

Expand Down Expand Up @@ -96,7 +96,7 @@ function interleave<T>(array: T[], thing: T): T[] {
function traverseFunctionNodeForTokens(func: ASTNode): Token[] {
const [functionIdentifier, ...operands] = func.children

let operandTokens: Array<Token | Token[]> = operands.map(operand => {
let operandTokens: (Token | Token[])[] = operands.map(operand => {
if ('children' in operand) {
return traverseAstForTokens(operand)
}
Expand Down
4 changes: 2 additions & 2 deletions src/lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ export class Lexer {
let { char } = this.next()

// Allow escaping of any character except EOS
if (char == '\\') {
if (this.peek() == EOS_FLAG) {
if (char === '\\') {
if (this.peek() === EOS_FLAG) {
throw new LexerError('expected character after escape character, got EOS', this.cursor)
}
char = this.next().char
Expand Down
2 changes: 1 addition & 1 deletion src/unlexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function unlex(tokens: Token[]): UnLexResponse {
function escape(str: string): string {
let escaped = ''
for (const c of str) {
if (!isIdent(c) || c == '\\') {
if (!isIdent(c) || c === '\\') {
escaped += '\\'
}
escaped += c
Expand Down

0 comments on commit 4cdb252

Please sign in to comment.