Perfect the codebase for wamr-ide (#1817)

Fix errors and warnings reported by eslint
Add CONTRIBUTING document for vscode-extension
This commit is contained in:
Wang Ning
2022-12-27 15:04:36 +08:00
committed by GitHub
parent 676c3c7b04
commit 679a8ab3cb
14 changed files with 316 additions and 299 deletions

View File

@ -31,7 +31,7 @@ export function createDirectory(
return false;
}
let parent = path.dirname(dest);
const parent = path.dirname(dest);
if (!createDirectory(parent, mode)) {
return false;
}
@ -44,6 +44,7 @@ export function createDirectory(
}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function copyFiles(src: string, dest: string, flags?: number): boolean {
try {
fileSystem.copyFileSync(src, dest);
@ -64,7 +65,7 @@ export function writeIntoFile(path: string, data: string): void {
export function readFromFile(path: string): string {
try {
let data = fileSystem.readFileSync(path, { encoding: 'utf-8' });
const data = fileSystem.readFileSync(path, { encoding: 'utf-8' });
return data as string;
} catch (err) {
vscode.window.showErrorMessage(err as string);
@ -114,9 +115,9 @@ export function checkIfFileExists(path: string): boolean {
return false;
}
export function checkFolderName(folderName: string) {
export function checkFolderName(folderName: string): boolean {
let invalidCharacterArr: string[] = [];
var valid = true;
let valid = true;
if (folderName.length > 255) {
valid = false;
@ -143,6 +144,7 @@ export function downloadFile(
): Promise<void> {
return new Promise((resolve, reject) => {
const file = fileSystem.createWriteStream(destinationPath);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const stream = request(url, undefined, (error, response, body) => {
if (response.statusCode !== 200) {
reject(