Skip to content

Commit f5ce160

Browse files
committed
Fixed ESLint warnings
1 parent a5e1ba4 commit f5ce160

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

src/cli.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ program
3232
.option('--runtime <string>', 'Node.js Lambda runtime identifier', 'nodejs20.x')
3333
.option('--asynchronous', 'Use asynchronous handler?', false)
3434

35-
.action(async function(this: any, opts: AppConfig) {
35+
.action(async function(opts: AppConfig) {
3636
const {name, description, prefix, timeout, sdkVersion, runtime} = opts;
3737

3838
const errors = [];
@@ -84,7 +84,7 @@ program
8484
if (err instanceof Error) {
8585
console.error(`error: ${err.message}\n`);
8686
} else {
87-
this.outputHelp();
87+
program.outputHelp();
8888
}
8989
}
9090
});
@@ -94,7 +94,7 @@ program
9494
.description('Install L³ middleware plugin.')
9595
.argument('[PluginName]', 'Plugin name (Example: BasicAuthHandler), list available if undefined')
9696

97-
.action(async function(this: any, name: string) {
97+
.action(async function(name: string) {
9898
const errors = [];
9999

100100
try {
@@ -133,7 +133,7 @@ program
133133
if (err instanceof Error) {
134134
console.error(`error: ${err.message}\n`);
135135
} else {
136-
this.outputHelp();
136+
program.outputHelp();
137137
}
138138
}
139139
});

src/generator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ function getAppPrefix(basePath: string): string | void {
115115
*/
116116
function getFsPath(files: string[], cmpFile: string, outPath: string): string | void {
117117
if (outPath && cmpFile && outPath) {
118-
cmpFile = cmpFile.replace(/^\_/, '.');
118+
cmpFile = cmpFile.replace(/^_/, '.');
119119

120120
for (const file of files) {
121-
const regex = new RegExp(`\/${path.parse(cmpFile).name}`);
121+
const regex = new RegExp(`/${path.parse(cmpFile).name}`);
122122

123123
if (regex.test(file) || path.basename(file) === cmpFile) {
124124
return `${outPath}/${file}`;

test/cli.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
'use strict';
22

3-
const chai = require('chai');
4-
const exec = require('child_process').exec;
5-
const fs = require('fs');
6-
const os = require('os');
7-
const path = require('path');
3+
import {describe, it, before, after} from 'mocha';
4+
5+
import chai from 'chai';
6+
import {exec} from 'child_process';
7+
import fs from 'fs';
8+
import os from 'os';
9+
import path from 'path';
810

911
const expect = chai.expect;
1012

@@ -164,7 +166,9 @@ function setUp() {
164166
* Remove test output directory.
165167
*/
166168
function tearDown() {
167-
fs.existsSync(outDir) && fs.rmSync(outDir, {recursive: true});
169+
if (fs.existsSync(outDir)) {
170+
fs.rmSync(outDir, {recursive: true});
171+
}
168172
}
169173

170174
/**

test/mocha.env.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
// eslint-disable-next-line no-undef
12
process.env.NODE_ENV = 'test';

0 commit comments

Comments
 (0)