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

lint fixes #186

Merged
merged 1 commit into from
Oct 19, 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 @@ -12,7 +12,7 @@
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 @@
} 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 @@
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,10 +20,8 @@
});
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 {
setError(signInError);
setLoading(false);
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,8 +226,7 @@
}
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);
} else {
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,8 +51,7 @@
};

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 @@
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 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 @@
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 @@
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 @@
}
});
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 @@
// 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 @@
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 All @@ -199,7 +189,7 @@
throw new Error(`Removing Previous Resource Failed : ${projectResource?.name}_${projectResource?.owner}_${update?.prevVersion}`);
}
}
}

Check warning on line 192 in renderer/src/components/Resources/ResourceUtils/DownloadCreateSBforHelps.js

View workflow job for this annotation

GitHub Actions / Lint Run

Unexpected console statement
});
} catch (error) {
setLoading(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 @@
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 @@
// 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 @@
} 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 @@
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 @@
// 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 @@
// 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);
});
};
Loading