style: make eslint check .ts files

This commit is contained in:
harttle
2020-12-08 00:24:07 +08:00
parent ef43120d6e
commit 117673a725
6 changed files with 8 additions and 10 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
},
"types": "dist/liquid.d.ts",
"scripts": {
"lint": "eslint .",
"lint": "eslint '**/*.ts' .",
"check": "npm test && npm run lint",
"unit": "mocha \"test/unit/**/*.ts\"",
"integration": "mocha \"test/integration/**/*.ts\"",
-1
View File
@@ -57,7 +57,6 @@ const nodeEsm = {
input
}
const browserEsm = {
output: [{
file: 'dist/liquid.browser.esm.js',
+3 -3
View File
@@ -19,7 +19,7 @@ export class Expression {
private postfix: Token[]
private lenient: boolean
public constructor (str: string, lenient: boolean = false) {
public constructor (str: string, lenient = false) {
const tokenizer = new Tokenizer(str)
this.postfix = [...toPostfix(tokenizer.readExpression())]
this.lenient = lenient
@@ -32,7 +32,7 @@ export class Expression {
const result = evalOperatorToken(token, l, r, ctx)
this.operands.push(result)
} else {
this.operands.push(evalToken(token, ctx, this.lenient && this.postfix.length == 1))
this.operands.push(evalToken(token, ctx, this.lenient && this.postfix.length === 1))
}
}
return this.operands[0]
@@ -42,7 +42,7 @@ export class Expression {
}
}
export function evalToken (token: Token | undefined, ctx: Context, lenient: boolean = false): any {
export function evalToken (token: Token | undefined, ctx: Context, lenient = false): any {
assert(ctx, () => 'unable to evaluate: context not defined')
if (TypeGuards.isPropertyAccessToken(token)) {
const variable = token.getVariableAsText()
-1
View File
@@ -3,7 +3,6 @@ import { Context } from '../context/context'
import { isFunction } from '../util/underscore'
import { isTruthy } from '../render/boolean'
export const operatorImpls: {[key: string]: (lhs: any, rhs: any, ctx: Context) => boolean} = {
'==': (l: any, r: any) => {
if (isComparable(l)) return l.equals(r)