Skip to content

Commit

Permalink
style: make eslint check .ts files
Browse files Browse the repository at this point in the history
  • Loading branch information
harttle committed Dec 7, 2020
1 parent ef43120 commit 117673a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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\"",
Expand Down
1 change: 0 additions & 1 deletion rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const nodeEsm = {
input
}


const browserEsm = {
output: [{
file: 'dist/liquid.browser.esm.js',
Expand Down
8 changes: 4 additions & 4 deletions src/render/expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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()
Expand All @@ -53,7 +53,7 @@ export function evalToken (token: Token | undefined, ctx: Context, lenient: bool
if (lenient && e instanceof InternalUndefinedVariableError) {
return null
} else {
throw(new UndefinedVariableError(e, token))
throw (new UndefinedVariableError(e, token))
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/render/operator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/builtin/tags/tablerow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('tags/tablerow', function () {
it('should support promises', async function () {
const src = '{% tablerow i in promiseNumbers %}{{ i }}{% endtablerow %}'
const ctx = {
promiseNumbers: Promise.resolve([1,2,3])
promiseNumbers: Promise.resolve([1, 2, 3])
}
const dst = '<tr class="row1"><td class="col1">1</td><td class="col2">2</td><td class="col3">3</td></tr>'
const html = await liquid.parseAndRender(src, ctx)
Expand Down
4 changes: 2 additions & 2 deletions test/integration/liquid/strict.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('LiquidOptions#strict*', function () {
return expect(engine.parseAndRender(html, ctx, opts)).to
.be.rejectedWith(/undefined variable: notdefined/)
})
describe('with strictVariables and lenientIf', function() {
describe('with strictVariables and lenientIf', function () {
const strictLenientOpts = {
strictVariables: true,
lenientIf: true
Expand All @@ -42,7 +42,7 @@ describe('LiquidOptions#strict*', function () {
})
it('should support elsif with undefined variables', async function () {
const tpl = engine.parse('{% if notdefined1 %}a{% elsif notdefined2 %}b{% elsif defined3 %}{{defined3}}{% else %}d{% endif %}')
const html = await engine.render(tpl, {'defined3': 'bla'}, strictLenientOpts)
const html = await engine.render(tpl, { 'defined3': 'bla' }, strictLenientOpts)
return expect(html).to.equal('bla')
})
it('should not throw in `unless` with a single variable', async function () {
Expand Down

0 comments on commit 117673a

Please sign in to comment.