Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed linting errors after web-version #168

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
const blob = await response.blob();
const arrayBuffer = await blob.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
console.log({ blob, arrayBuffer, buffer });

Check warning on line 14 in renderer/src/components/Resources/DownloadObsImages/checkandDownloadObsImages.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
if (blob.type.includes('image')) {
await fs.createWriteStream(savePath).write(buffer);
}
Expand All @@ -35,7 +35,7 @@
document.body.appendChild(img);
const { data, error } = await sbStorageUpload(`${packageInfo.name}/common/${environment.OBS_IMAGE_DIR}`, blob);
if (error) {
console.log('error uploading images to supabase', { error });

Check warning on line 38 in renderer/src/components/Resources/DownloadObsImages/checkandDownloadObsImages.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
throw error;
}
console.log(data);
Expand Down Expand Up @@ -71,7 +71,7 @@
const obsImagePath = `${packageInfo.name}/common/${environment.OBS_IMAGE_DIR}`;
const { data: exist } = await sbStorageList(obsImagePath);
if (!exist) {
await createDirectory({path:obsImagePath});
await createDirectory({ path: obsImagePath });

Check failure on line 74 in renderer/src/components/Resources/DownloadObsImages/checkandDownloadObsImages.js

View workflow job for this annotation

GitHub Actions / Lint Run

A space is required after '{'

Check failure on line 74 in renderer/src/components/Resources/DownloadObsImages/checkandDownloadObsImages.js

View workflow job for this annotation

GitHub Actions / Lint Run

Missing space before value for key 'path'

Check failure on line 74 in renderer/src/components/Resources/DownloadObsImages/checkandDownloadObsImages.js

View workflow job for this annotation

GitHub Actions / Lint Run

A space is required before '}'
}
const { data: filesInDir } = await sbStorageDownload(obsImagePath);
console.log({ filesInDir });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@
const { data: folderExist } = await sbStorageList(folder);
console.log({ folderExist });
if (!folderExist) {
await createDirectory({path:folder});
await createDirectory({ path: folder });

Check failure on line 156 in renderer/src/components/Resources/ResourceUtils/DownloadCreateSBforHelps.js

View workflow job for this annotation

GitHub Actions / Lint Run

A space is required after '{'

Check failure on line 156 in renderer/src/components/Resources/ResourceUtils/DownloadCreateSBforHelps.js

View workflow job for this annotation

GitHub Actions / Lint Run

Missing space before value for key 'path'

Check failure on line 156 in renderer/src/components/Resources/ResourceUtils/DownloadCreateSBforHelps.js

View workflow job for this annotation

GitHub Actions / Lint Run

A space is required before '}'
}
// writing zip to local
await createDirectory({path:`${folder}/${projectResource?.name}.zip}`,payload: Buffer.from(blob)});
await createDirectory({ path: `${folder}/${projectResource?.name}.zip}`, payload: Buffer.from(blob) });

Check failure on line 159 in renderer/src/components/Resources/ResourceUtils/DownloadCreateSBforHelps.js

View workflow job for this annotation

GitHub Actions / Lint Run

A space is required after '{'

Check failure on line 159 in renderer/src/components/Resources/ResourceUtils/DownloadCreateSBforHelps.js

View workflow job for this annotation

GitHub Actions / Lint Run

Missing space before value for key 'path'

Check failure on line 159 in renderer/src/components/Resources/ResourceUtils/DownloadCreateSBforHelps.js

View workflow job for this annotation

GitHub Actions / Lint Run

A space is required after ','

Check failure on line 159 in renderer/src/components/Resources/ResourceUtils/DownloadCreateSBforHelps.js

View workflow job for this annotation

GitHub Actions / Lint Run

A space is required before '}'

// extract zip
const { data: filecontent, error: fileContentError } = await sbStorageDownload(`${folder}/${projectResource?.name}.zip}`);
Expand All @@ -170,18 +170,18 @@
for (const key of keys) {
const item = result.files[key];
if (item.dir) {
await createDirectory({path:`${folder}/${item.name}`});
await createDirectory({ path: `${folder}/${item.name}` });
} else {
const bufferContent = Buffer.from(await item.async('arraybuffer'));
await createDirectory({path:`${folder}/${item.name}`,payload: bufferContent});
await createDirectory({ path: `${folder}/${item.name}`, payload: bufferContent });
}
}

await fetch(projectResource.metadata_json_url).then((res) => res.json()).then(async (data) => {
data.agOffline = true;
data.meta = projectResource;
data.lastUpdatedAg = moment().format();
await createDirectory({path:`${folder}/${projectResource?.name}/metadata.json`, payload :JSON.stringify(data)});
await createDirectory({ path: `${folder}/${projectResource?.name}/metadata.json`, payload: JSON.stringify(data) });
}).catch((err) => {
console.log('DownloadCreateSBforHelps.js', 'failed to save yml metadata.json : ', err);
});
Expand Down
2 changes: 1 addition & 1 deletion renderer/src/components/Resources/useReadLocalResources.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default async function readLocalResources(username, setSubMenuItems) {
const parseData = [];
const projectsDir = `${newPath}/${email}/resources`;
const userResourceMetaPath = `${newPath}/${email}/resources`;
createDirectory({path:userResourceMetaPath});
createDirectory({ path: userResourceMetaPath });
readResourceMetadata(projectsDir, userResourceMetaPath, setSubMenuItems, parseData);
}
}
2 changes: 1 addition & 1 deletion renderer/src/core/Login/handleJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export const handleJsonWeb = async (values) => {
});

console.log('handleJson.js', 'Successfully added new user to the existing list in file', { newUser });
await createDirectory({path:`${newpath}/${values.email}/projects`});
await createDirectory({ path: `${newpath}/${values.email}/projects` });

console.log('handleJson.js', 'Successfully created directories for new user');
// Add new user to localForage:
Expand Down
30 changes: 15 additions & 15 deletions renderer/src/core/editor/writeToFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ const writeToFile = async ({
username, projectname, filename, data,
});
if (!IsElectron) {
const filePath = `${newPath}/${username}/projects/${projectname}/${filename}`;
const { data: projectsPath, error } = await sbStorageDownload(filePath);
if (projectsPath) {
// appending to an existing file
console.log('writeToFile.js', 'Appending to the existing file');
sbStorageUpdate({ path: filePath, payload: data });
} else {
// Creating new file if nothing present
console.log('writeToFile.js', 'Creating new file to write');
sbStorageUpload(filePath, data);
}
if (error) {
console.log(error);
}
}
const filePath = `${newPath}/${username}/projects/${projectname}/${filename}`;
const { data: projectsPath, error } = await sbStorageDownload(filePath);
if (projectsPath) {
// appending to an existing file
console.log('writeToFile.js', 'Appending to the existing file');
sbStorageUpdate({ path: filePath, payload: data });
} else {
// Creating new file if nothing present
console.log('writeToFile.js', 'Creating new file to write');
sbStorageUpload(filePath, data);
}
if (error) {
console.log(error);
}
}
};

export default writeToFile;
2 changes: 1 addition & 1 deletion renderer/src/core/projects/saveProjetcsMeta.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ export const saveSupabaseProjectsMeta = async (projectMetaObj) => {
const userProfile = await localforage.getItem('userProfile');
const currentUser = userProfile.user.email;
const status = [];
await createDirectory({path:`${newPath}/${currentUser}/projects`});
await createDirectory({ path: `${newPath}/${currentUser}/projects` });
const projectDir = `${newPath}/${currentUser}/projects}`;
let projectNameExists = false;
let checkCanon = false;
Expand Down
Loading