Skip to content

Commit

Permalink
core: lints code
Browse files Browse the repository at this point in the history
  • Loading branch information
dresende committed Feb 5, 2024
1 parent 5336d9a commit f7c343c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions core/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export class Renderer {
return "\t".repeat(level + n);
};

let i = 0, text_level = level, code = "", lines = [];
const text_level = level;
const lines = [];
let i = 0;
let code = "";

if (debug && options.filename) {
code += `${indent(0)}// ${options.filename}\n`;
Expand All @@ -45,7 +48,7 @@ export class Renderer {
code += `${indent(0)}let __output = "";\n`;
code += `${indent(0)}try { with (this) {\n`;

while (true) {
while (i < data.length) {
let j = data.indexOf(START_BLOCK, i);

if (j == -1) {
Expand Down Expand Up @@ -111,7 +114,7 @@ export class Renderer {
const command = match.groups.command;

switch (command) {
case "include":
case "include": {
const view = await this.compilePath(match.groups.method, options.filename ? dirname(options.filename) : null, debug ? text_level + 2 : text_level);

if (view !== null) {
Expand All @@ -126,6 +129,7 @@ export class Renderer {
code += `${indent()}__output += "${escape(new RenderingError(`Include not found: ${match.groups.method}`))}";\n`;
}
break;
}
default:
code += `${indent()}__output += "${escape(new RenderingError(`Unknown command: ${command}`))}";\n`;
}
Expand Down
2 changes: 1 addition & 1 deletion core/Resolver.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { dirname, resolve } from "path";
import { resolve } from "path";

export function Resolver(path, base = null) {
if (!path.endsWith(".html")) {
Expand Down

0 comments on commit f7c343c

Please sign in to comment.