Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalisa11 authored and samueljd committed Oct 19, 2023
1 parent ff3ad87 commit 3724ae6
Show file tree
Hide file tree
Showing 18 changed files with 22 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { SnackBar } from '@/components/SnackBar';
import { useTranslation } from 'react-i18next';
import EmptyScreen from '@/components/Loading/EmptySrceen';
import LoadingScreen from '@/components/Loading/LoadingScreen';
import { getDetails } from '../ObsEditor/ObsEditor';
import { getDetails } from '../ObsEditor/utils/getDetails';

Check failure on line 15 in renderer/src/components/EditorPage/AudioEditor/AudioEditor.js

View workflow job for this annotation

GitHub Actions / Lint Run

getDetails not found in '../ObsEditor/ObsEditor'

const grammar = require('usfm-grammar');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from 'react';
import { useReactMediaRecorder } from 'react-media-recorder';
import ConfirmationModal from '@/layouts/editor/ConfirmationModal';
import { getDetails } from '../ObsEditor/ObsEditor';
import { getDetails } from '../ObsEditor/utils/getDetails';

Check failure on line 9 in renderer/src/components/EditorPage/AudioEditor/MainPlayer.js

View workflow job for this annotation

GitHub Actions / Lint Run

getDetails not found in '../ObsEditor/ObsEditor'

const MainPlayer = () => {
const {
Expand Down
1 change: 1 addition & 0 deletions renderer/src/components/EditorPage/ObsEditor/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export async function readBlobAsync(blob) {
return content;
// Do something with the content
} catch (error) {
// eslint-disable-next-line no-console

Check warning on line 57 in renderer/src/components/EditorPage/ObsEditor/core.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
console.error('Error reading blob:', error);
}
}
Expand Down
2 changes: 0 additions & 2 deletions renderer/src/components/Login/Signin.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ const SignIn = () => {
});
if (data.session) {
await localforage.setItem('userProfile', data);
const userData = await localforage.getItem('userProfile');
console.log({ userData });
router.push('/projects');
setLoading(false);

Check warning on line 24 in renderer/src/components/Login/Signin.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
} else {
Expand Down
1 change: 0 additions & 1 deletion renderer/src/components/Projects/NewWebProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ export default function NewWebProject({ call, project, closeEdit }) {
}
if (create === true) {
// Checking whether the burrito is of latest version
console.warn('NewProject.js', 'Checking whether the burrito is of latest version.');
if (call === 'edit' && burrito?.meta?.version !== metadata?.meta?.version) {

Check warning on line 229 in renderer/src/components/Projects/NewWebProject.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
setOpenModal(true);
setLoading(false);
Expand Down
1 change: 0 additions & 1 deletion renderer/src/components/Projects/hooks/useEditProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const useEditProject = () => {
};

const editProject = async (project, setCurrentProject, setCallEditProject) => {
console.log('editing this...', { project });
const metadata = await loadProjectData(project);

Check warning on line 54 in renderer/src/components/Projects/hooks/useEditProject.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
setCurrentProject(metadata);
setCallEditProject(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ async function downloadImageAndSaveSupabase(url) {
throw error;
}
} catch (error) {
// eslint-disable-next-line no-console

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

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
console.error('Error fetching image:', error);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const JSZip = require('jszip');
const DownloadCreateSBforHelps = async (projectResource, setLoading, update = false, offlineResource = false) => {
if (isElectron()) {
try {
// console.log('download/update started --------', { projectResource, update, offlineResource });
logger.debug('DownloadCreateSBforHelps.js', 'Download Started');
setLoading(true);
await localForage.getItem('userProfile').then(async (user) => {
Expand Down Expand Up @@ -86,15 +85,12 @@ const DownloadCreateSBforHelps = async (projectResource, setLoading, update = fa
await fetch(projectResource.metadata_json_url)
.then((res) => res.json())
.then(async (data) => {
// console.log('json data : ', data);
// adding offline true tag in meta for identification
data.agOffline = true;
data.meta = projectResource;
data.lastUpdatedAg = moment().format();
// console.log('json data after : ', data);
await fs.writeFileSync(path.join(folder, projectResource?.name, 'metadata.json'), JSON.stringify(data));
}).catch((err) => {
// console.log('failed to save yml metadata.json : ', err);
logger.debug('DownloadCreateSBforHelps.js', 'failed to save yml metadata.json : ', err);
});

Expand All @@ -105,13 +101,11 @@ const DownloadCreateSBforHelps = async (projectResource, setLoading, update = fa
fs.unlinkSync(path.join(folder, `${projectResource?.name}.zip`), (err) => {
if (err) {
logger.debug('DownloadCreateSBforHelps.js', 'error in deleting zip');
// console.log(`Removing Resource Zip Failed : ${projectResource?.name}.zip`);
throw new Error(`Removing Resource Zip Failed : ${projectResource?.name}.zip`);
}
});
if (update && update?.status) {
// if updation delete old resource
// console.log({ projectOld: `${projectResource?.name}_${projectResource?.owner}_${update?.prevVersion}` });
try {
fs.rmSync(path.join(folder, `${projectResource?.name}_${projectResource?.owner}_${update?.prevVersion}`), { recursive: true });
update && update?.setIsOpen(false);
Expand All @@ -124,11 +118,8 @@ const DownloadCreateSBforHelps = async (projectResource, setLoading, update = fa
}
});
logger.debug('DownloadCreateSBforHelps.js', 'download completed');
// console.log('download finished --------');
setLoading(false);
// resolve(json);
});
// });
} catch (err) {
setLoading(false);
throw err;
Expand Down Expand Up @@ -158,7 +149,7 @@ const DownloadCreateSBforHelps = async (projectResource, setLoading, update = fa
// extract zip
const { data: filecontent, error: fileContentError } = await sbStorageDownload(`${folder}/${projectResource?.name}.zip}`);
if (fileContentError) {
// eslint-disable-next-line no-console
// eslint-disable-next-line no-console
console.log('Failed to download zip file', fileContentError);
}

Expand All @@ -181,15 +172,14 @@ const DownloadCreateSBforHelps = async (projectResource, setLoading, update = fa
data.lastUpdatedAg = moment().format();
await createDirectory({ path: `${folder}/${projectResource?.name}/metadata.json`, payload: JSON.stringify(data) });
}).catch((err) => {
// eslint-disable-next-line no-console
// eslint-disable-next-line no-console
console.log('DownloadCreateSBforHelps.js', 'failed to save yml metadata.json : ', err);
});

// finally remove zip and rename base folder to projectname_id
if (folderExist) {
if (update && update?.status) {
// if updation delete old resource
console.log({ projectOld: `${projectResource?.name}_${projectResource?.owner}_${update?.prevVersion}` });
try {
sbStorageRemove(`folder/${projectResource?.name}_${projectResource?.owner}_${update?.prevVersion}`);
update && update?.setIsOpen(false);
Expand Down
1 change: 1 addition & 0 deletions renderer/src/components/Signup/WebSignup.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function SignupPage() {
createWebUser(data.user);
router.push('/login');
} else {
// eslint-disable-next-line no-console

Check warning on line 28 in renderer/src/components/Signup/WebSignup.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
console.error('error occured', error);
setStatus(error);
}
Expand Down
1 change: 1 addition & 0 deletions renderer/src/components/Sync/Gitea/GiteaFileBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const GiteaFileBrowser = ({ changeRepo }) => {
// regex is for old sync
// const regex = /.+\/\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]).1$/;
let finalBranches = [];
// eslint-disable-next-line no-console

Check warning on line 92 in renderer/src/components/Sync/Gitea/GiteaFileBrowser.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
console.log('chedk : ', fetchBranches.some((branch) => branch.name === 'scribe-main'));
if (fetchBranches.some((branch) => branch.name === 'scribe-main')) {
finalBranches.push({ name: 'scribe-main' });
Expand Down
1 change: 1 addition & 0 deletions renderer/src/components/hooks/useGetUserName.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const useGetUserName = () => {
} else if (!IsElectron) {
const { data: { session }, error } = await supabase.auth.getSession();
if (error) {
// eslint-disable-next-line no-console

Check warning on line 20 in renderer/src/components/hooks/useGetUserName.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
console.error(error);
}
if (session) {
Expand Down
4 changes: 4 additions & 0 deletions renderer/src/core/Login/handleJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export const handleJsonWeb = async (values) => {
error = { userExist: false, fetchFile: false };

if (await supabaseStorage().list().then((result) => result.error)) {
// eslint-disable-next-line no-console

Check warning on line 123 in renderer/src/core/Login/handleJson.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
console.error('handleJson.js', 'Failed to access the storage');
error.fetchFile = true;
return error;
Expand All @@ -137,6 +138,7 @@ export const handleJsonWeb = async (values) => {
// Add new user to localForage:
localForage.setItem('users', array, (err) => {
if (err) {
// eslint-disable-next-line no-console
console.error('handleJson.js', 'Failed to Create a file and add user to LocalForage');
}
});
Expand Down Expand Up @@ -170,11 +172,13 @@ export const handleJsonWeb = async (values) => {
// Add new user to localForage:
localForage.setItem('users', json, (errLoc) => {
if (errLoc) {
// eslint-disable-next-line no-console
console.error('handleJson.js', 'Failed to add new user to existing list');
}
});
return error;
} catch (errCatch) {
// eslint-disable-next-line no-console
console.error('handleJson.js', 'Failed to add new user to the file');
return error;
}
Expand Down
1 change: 1 addition & 0 deletions renderer/src/core/editor/readFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const readFile = async ({
return new Promise(async (resolve) => {
const { data: fileContent, error } = await sbStorageDownload(projectsPath);
if (error) {
// eslint-disable-next-line no-console
console.error('readWebFile function error', error);
}
const parsedData = readBlobAsync(fileContent);
Expand Down
2 changes: 2 additions & 0 deletions renderer/src/core/projects/fetchProjectsMeta.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const fetchProjectsMeta = async ({ currentUser }) => {
const { data, error } = await sbStorageDownload(`${path}/${projectName}/metadata.json`);

if (error) {
// eslint-disable-next-line no-console
console.error('fetchProjectsMeta.js', error);
return null;
}
Expand All @@ -73,6 +74,7 @@ const fetchProjectsMeta = async ({ currentUser }) => {
if (settingData) {
setting = JSON.parse(await settingData.text());
} else {
// eslint-disable-next-line no-console
console.error('ProjectList.js', 'Unable to find scribe-settings for the project');
}
}
Expand Down
4 changes: 1 addition & 3 deletions renderer/src/core/reference/readRefBurrito.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
import { isElectron } from '@/core/handleElectron';
import { sbStorageDownload } from '../../../../supabase';
import * as logger from '../../logger';
// if (!process.env.NEXT_PUBLIC_IS_ELECTRON) {
// const supabaseStorage = require('../../../../supabase').supabaseStorage
// }

export const readRefBurrito = async ({
metaPath,
Expand All @@ -27,6 +24,7 @@ export const readRefBurrito = async ({
return new Promise(async (resolve) => {
const { data: files, error } = await sbStorageDownload(metaPath);
if (error) {
// eslint-disable-next-line no-console
console.error('Error fetching files:', error);
return;
}
Expand Down
2 changes: 2 additions & 0 deletions renderer/src/core/reference/readRefMeta.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ export const readRefMeta = async ({
try {
const { data: files, error } = await sbStorageList(`${projectsDir}`);
if (error) {
// eslint-disable-next-line no-console
console.error('Error fetching files:', error);
return [];
}
const directoryNames = files.map((file) => file.name);
return directoryNames;
} catch (error) {
// eslint-disable-next-line no-console
console.error('Error reading reference metadata:', error);
return [];
}
Expand Down
6 changes: 1 addition & 5 deletions renderer/src/layouts/editor/SubMenuBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ import MenuDropdown from '../../components/MenuDropdown/MenuDropdown';
import menuStyles from './MenuBar.module.css';
import packageInfo from '../../../../package.json';
import { newPath, sbStorageDownload } from '../../../../supabase';
// if (!process.env.NEXT_PUBLIC_IS_ELECTRON) {
// const supabaseStorage = require('../../../../../supabase').supabaseStorage
// const newPath = require('../../../../supabase').newPath
// }
// import WifiIcon from '@/icons/wifi.svg';

const activate = () => {
// console.log('rename');
Expand Down Expand Up @@ -107,6 +102,7 @@ export default function SubMenuBar() {
const email = userProfile.user.email;
const { data, error } = await sbStorageDownload(`${newPath}/${email}/projects/${projectName}/metadata.json`);
if (error) {
// eslint-disable-next-line no-console
console.log('SubMenuBar.js', error);
}
const metadata = JSON.parse(await data.text());
Expand Down
7 changes: 2 additions & 5 deletions renderer/src/util/createObsContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,7 @@ export const createObsContent = (
importedFiles,
copyright,
call,
) => {
console.log('createObsContent.js', 'In OBS md content creation');

return new Promise(async (resolve) => {
) => new Promise(async (resolve) => {
const ingredients = {};
const supabasePath = `${newPath}/${username}/projects/${project.projectName}_${id}/ingredients`;

Expand All @@ -239,6 +236,7 @@ export const createObsContent = (
});

if (error) {
// eslint-disable-next-line no-console
console.error('Error uploading file to Supabase:', error);
throw error;
} else {
Expand Down Expand Up @@ -384,4 +382,3 @@ export const createObsContent = (
};
resolve(ingredients);
});
};

0 comments on commit 3724ae6

Please sign in to comment.