Setup eslint and enforce rules
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {ViewEngine} from "./ViewEngine"
|
||||
import {Injectable} from "../di"
|
||||
import * as pug from "pug"
|
||||
import {ViewEngine} from './ViewEngine'
|
||||
import {Injectable} from '../di'
|
||||
import * as pug from 'pug'
|
||||
|
||||
/**
|
||||
* Implementation of the ViewEngine class that renders Pug/Jade templates.
|
||||
@@ -16,9 +16,13 @@ export class PugViewEngine extends ViewEngine {
|
||||
|
||||
public renderByName(templateName: string, locals: { [p: string]: any }): string | Promise<string> {
|
||||
let compiled = this.compileCache[templateName]
|
||||
if ( compiled ) return compiled(locals)
|
||||
if ( compiled ) {
|
||||
return compiled(locals)
|
||||
}
|
||||
|
||||
if ( !templateName.endsWith('.pug') ) templateName += '.pug'
|
||||
if ( !templateName.endsWith('.pug') ) {
|
||||
templateName += '.pug'
|
||||
}
|
||||
const filePath = this.path.concat(...templateName.split(':'))
|
||||
compiled = pug.compileFile(filePath.toLocal, this.getOptions())
|
||||
|
||||
@@ -30,7 +34,7 @@ export class PugViewEngine extends ViewEngine {
|
||||
* Get the object of options passed to Pug's compile methods.
|
||||
* @protected
|
||||
*/
|
||||
protected getOptions() {
|
||||
protected getOptions(): pug.Options {
|
||||
return {
|
||||
basedir: this.path.toLocal,
|
||||
debug: this.debug,
|
||||
|
||||
Reference in New Issue
Block a user