Setup eslint and enforce rules
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-06-02 22:36:25 -05:00
parent 82e7a1f299
commit 1d5056b753
149 changed files with 6104 additions and 3114 deletions

View File

@@ -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,