Skip to content

Commit

Permalink
fix: solve lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
eliassjogreen committed Oct 9, 2020
1 parent 571fc65 commit 5afb34d
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions denon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const logger = log.create("main");
* instance as module:
* ```typescript
* const denon = new Denon(config);
* for await (let event of denon.run(script)) {
* for await (const event of denon.run(script)) {
* // event handling here
* }
* ``` */
Expand Down Expand Up @@ -161,7 +161,7 @@ if (import.meta.main) {
const denon = new Denon(config);

// TODO(@qu4k): events
for await (let event of denon.run(script)) {
for await (const event of denon.run(script)) {
if (event.type === "reload") {
if (
event.change.some(
Expand Down
4 changes: 2 additions & 2 deletions examples/oak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { green } from "https://deno.land/std/fmt/colors.ts";

const app = new Application();

let PORT = 8000;
const PORT = 8000;

let port = Deno.env.get("PORT");
const port = Deno.env.get("PORT");
if (port) {
PORT = Number.parseInt(port);
}
Expand Down
6 changes: 3 additions & 3 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const PERMISSION_OPTIONAL: {

export async function grantPermissions(): Promise<void> {
// @see PERMISSIONS .
let permissions = await grant([...PERMISSIONS]);
const permissions = await grant([...PERMISSIONS]);
if (!permissions || permissions.length < PERMISSIONS.length) {
logger.critical("Required permissions `read` and `run` not granted");
Deno.exit(1);
Expand All @@ -62,7 +62,7 @@ export async function grantPermissions(): Promise<void> {
/** Create configuration file in the root of current work directory.
* // TODO: make it interactive */
export async function initializeConfig(type = "json"): Promise<void> {
let permissions = await grant(PERMISSION_OPTIONAL.initializeConfig);
const permissions = await grant(PERMISSION_OPTIONAL.initializeConfig);
if (
!permissions ||
permissions.length < PERMISSION_OPTIONAL.initializeConfig.length
Expand Down Expand Up @@ -146,7 +146,7 @@ export async function printAvailableScripts(
console.log(` ${script.desc}`);
}

let commands = runner
const commands = runner
.build(name)
.map((command) => command.cmd.join(" "))
.join(bold(" && "));
Expand Down
1 change: 0 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ async function importConfig(
file: string,
): Promise<Partial<DenonConfig> | undefined> {
try {
// deno-lint-ignore no-undef
const configRaw = await import(`file://${resolve(file)}`);
return configRaw.default as Partial<DenonConfig>;
} catch (error) {
Expand Down
8 changes: 4 additions & 4 deletions src/daemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class Daemon implements AsyncIterable<DenonEvent> {
plog.info(`starting sequential \`${command.cmd.join(" ")}\``);
}

let process = command.exe();
const process = command.exe();
plog.debug(`starting process with pid ${process.pid}`);

if (last) {
Expand All @@ -83,9 +83,9 @@ export class Daemon implements AsyncIterable<DenonEvent> {
`killing ${Object.keys(this.#processes).length} orphan process[es]`,
);
// kill all processes spawned
let pcopy = Object.assign({}, this.#processes);
const pcopy = Object.assign({}, this.#processes);
this.#processes = {};
for (let id in pcopy) {
for (const id in pcopy) {
const p = pcopy[id];
if (Deno.build.os === "windows") {
logger.debug(`closing (windows) process with pid ${p.pid}`);
Expand All @@ -111,7 +111,7 @@ export class Daemon implements AsyncIterable<DenonEvent> {
} catch (error) {
logger.debug(`error getting status of process with pid ${process.pid}`);
}
let p = this.#processes[pid];
const p = this.#processes[pid];
if (p) {
logger.debug(`process with pid ${process.pid} exited on its own`);
// process exited on its own, so we should wait a reload
Expand Down
8 changes: 4 additions & 4 deletions src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class Runner {
args: string[],
): Command[] {
if (typeof script === "object") {
let options = Object.assign({}, merge(global, script));
const options = Object.assign({}, merge(global, script));
return this.buildStringCommands(script.cmd, options, args);
}

Expand All @@ -82,7 +82,7 @@ export class Runner {
args: string[],
): Command[] {
if (script.includes("&&")) {
let commands: Command[] = [];
const commands: Command[] = [];
script.split("&&").map((s) => {
commands.push(this.buildCommand(s, global, args));
});
Expand All @@ -99,7 +99,7 @@ export class Runner {
): Command {
let out: string[] = [];
cmd = stdCmd(cmd).join(" ");
let denoAction = reDenoAction.exec(cmd);
const denoAction = reDenoAction.exec(cmd);
if (denoAction && denoAction.length === 3) {
const action = denoAction[1];
const args = denoAction[2];
Expand Down Expand Up @@ -141,7 +141,7 @@ export class Runner {
}
}

let args = this.#args.slice(1);
const args = this.#args.slice(1);

let commands: Command[] = [];

Expand Down
2 changes: 1 addition & 1 deletion src/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export interface ScriptOptions {
/** Build deno flags from ScriptOptions.
* `{ allow: [ run, env ]}` -> `[--allow-run, --allow-env]` */
export function buildFlags(options: ScriptOptions): string[] {
let flags: string[] = [];
const flags: string[] = [];
if (options.allow) {
if (Array.isArray(options.allow)) {
options.allow.forEach((flag) => flags.push(`--allow-${flag}`));
Expand Down
2 changes: 1 addition & 1 deletion src/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class Watcher implements AsyncIterable<FileEvent[]> {

const walkPaths = async () => {
const tree: { [path: string]: Date | null } = {};
for (let i in this.#paths) {
for (const i in this.#paths) {
const action = walk(this.#paths[i], {
maxDepth: Infinity,
includeDirs: false,
Expand Down

0 comments on commit 5afb34d

Please sign in to comment.