Skip to content

Commit

Permalink
fixed lint issues. (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
samueljd authored Oct 10, 2023
1 parent ddd1daa commit 8ac1b8a
Show file tree
Hide file tree
Showing 32 changed files with 728 additions and 1,334 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@
},
"optionalDependencies": {
"bufferutil": "^4.0.6",
"react-icons": "4.10.1",
"scripture-resources-rcl": "5.1.0",
"utf-8-validate": "^5.0.9",
"react-icons": "4.10.1"
"utf-8-validate": "^5.0.9"
},
"overrides": {
"react": "$react",
Expand All @@ -204,4 +204,4 @@
"word-aligner": "$word-aligner",
"@mui/lab": "$@mui/lab"
}
}
}
10 changes: 0 additions & 10 deletions renderer/src/components/EditorPage/BookMarks/Bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ export default function Bookmarks() {
}).finally(() => setIsLoading(false));
};

// useEffect(() => {
// console.log('tempChapter', tempChapter, chapter);
// timeout(2000).then(async () => {
// setIsLoading(true);
// onChangeChapter(tempChapter);
// onChangeVerse('1');
// }).then(() => setIsLoading(false));
// // eslint-disable-next-line react-hooks/exhaustive-deps
// }, [tempChapter]);

return (
<>
<div className="bg-gray-800 uppercase text-white text-xs p-2 tracking-wider">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ const { t } = useTranslation();
if (window?.navigator?.onLine) {
await checkandDownloadObsImages(window?.navigator?.onLine);
}
// else {
// console.log('No internet connection');
// }
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Expand Down
4 changes: 0 additions & 4 deletions renderer/src/components/EditorPage/ObsEditor/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ const loadWebData = async (file, projectName, username) => {
const filePath = `${newPath}/${username}/resources/${projectName}/content/${file}.md`;
const { data } = await sbStorageDownload(filePath);
const parsedData = readBlobAsync(data);
console.log({ filePath, data, parsedData });

if (parsedData) {
return parsedData;
Expand Down Expand Up @@ -151,12 +150,10 @@ const core = (fs, num, projectName, username) => {
};

const webCore = async (num, projectName, username) => {
console.log({ num, projectName, username });
const stories = [];
// eslint-disable-next-line prefer-const
let id = 1; let footer = false;
const data = await loadWebData(num.toString().padStart(2, 0), projectName, username);
console.log({ data });
const allLines = data.split(/\r\n|\n/);
// Reading line by line
allLines.forEach((line) => {
Expand Down Expand Up @@ -230,7 +227,6 @@ const webCore = async (num, projectName, username) => {
}
}
});
console.log({ stories });
return stories;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function MultiComboBox({
.toLowerCase()
.replace(/\s+/g, '')
.includes(query.toLowerCase().replace(/\s+/g, '')));
// console.log({ options, selectedOption });

useEffect(() => {
if (selectedOption === null && options.length > 0) {
Expand Down
40 changes: 2 additions & 38 deletions renderer/src/components/EditorPage/Scribex/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ReferenceContext } from '@/components/context/ReferenceContext';
import { ProjectContext } from '@/components/context/ProjectContext';
import EmptyScreen from '@/components/Loading/EmptySrceen';
import {
insertVerseNumber, insertChapterNumber, insertFootnote, insertXRef,
insertVerseNumber, insertChapterNumber, insertFootnote, insertXRef,
} from '@/util/cursorUtils';
import RecursiveBlock from './RecursiveBlock';

Expand Down Expand Up @@ -134,45 +134,9 @@ export default function Editor(props) {
if (insertVerseRChapter === 'Cross Reference') {
insertXRef(caretPosition, newVerChapNumber, selectedText);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [triggerVerseInsert]);

// useEffect(() => {
// let pressedKeys = [];
// const handleKeyDown = (e) => {
// const copyKeys = ['Control', 'c'];
// const pasteKeys = ['Control', 'v'];
// pressedKeys.push(e.key);
// if (pressedKeys.join('+') === copyKeys.join('+')) {
// e.preventDefault();
// copyText();
// pressedKeys = [];
// }
// if (pressedKeys.join('+') === pasteKeys.join('+')) {
// e.preventDefault();
// pasteText();
// pressedKeys = [];
// }
// // if (e.key === 's') { console.log("savingssssssssss") }
// // if (e.key === 'Control' && e.key === 'c') {
// // console.log("copying")
// // e.preventDefault();
// // // Call your custom copy function
// // copyText();
// // } else if (e.metaKey && e.key === 'v') {
// // console.log("pasting")
// // e.preventDefault();
// // // Call your custom paste function
// // pasteText();
// // }
// };

// document.addEventListener('keydown', handleKeyDown);
// return () => {
// document.removeEventListener('keydown', handleKeyDown);
// };
// }, []);

const scrollReference = (chapterNumber) => {
const refEditors = document.getElementsByClassName('ref-editor');
refEditors.length > 0 && Array.prototype.filter.call(refEditors, (refEditor) => {
Expand Down
1 change: 0 additions & 1 deletion renderer/src/components/EditorPage/Scribex/Popup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const Popup = ({
handleClose, handleButtonClick, title, isPopupOpen, selectedText,
}) => {
const [number, setNumber] = useState('');
// console.log({ title }, "title");
const handleInputChange = (event) => {
setNumber(event.target.value);
};
Expand Down
2 changes: 0 additions & 2 deletions renderer/src/components/EditorPage/Scribex/RecursiveBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ export default function RecursiveBlock({
const checkCurrentVerse = () => {
if (document.getSelection().rangeCount >= 1 && onReferenceSelected) {
const range = document.getSelection().getRangeAt(0);
// console.log({ range })
const selectedNode = range.startContainer;
// console.log({ selectedNode })
const verse = getCurrentVerse(selectedNode);
const chapter = getCurrentChapter(selectedNode);
// if (onReferenceSelected) {
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 @@ -19,7 +19,6 @@ const SignIn = () => {
password,
});
if (data.session) {
console.log('sign in success', data);
await localforage.setItem('userProfile', data);
const userData = await localforage.getItem('userProfile');
console.log({ userData });

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

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

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

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
Expand All @@ -28,7 +27,6 @@ const SignIn = () => {
} else {
setError(signInError);
setLoading(false);
console.log('sign in error', signInError);
}
};

Expand Down
1 change: 1 addition & 0 deletions renderer/src/components/Profile/UserProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const UserProfile = () => {
// if(!process.env.NEXT_PUBLIC_IS_ELECTRON){
const { error } = await supabaseSignout();
localforage.removeItem('userProfile');
// eslint-disable-next-line no-console
error ? console.log({ error }) : router.push('/login');
};
// }
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 @@ -177,7 +177,6 @@ export default function NewWebProject({ call, project, closeEdit }) {
setLoading(true);
if (newProjectFields.projectName && newProjectFields.abbreviation) {
const value = await createSupabaseProject(call, metadata, update, headerDropDown);
console.log({ value });

const status = value[0];
logger.debug('NewProject.js', status.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const downloadImageAndSave = async (url, savePath, fs) => {
const blob = await response.blob();
const arrayBuffer = await blob.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
console.log({ blob, arrayBuffer, buffer });
if (blob.type.includes('image')) {
await fs.createWriteStream(savePath).write(buffer);
}
Expand All @@ -33,12 +32,12 @@ async function downloadImageAndSaveSupabase(url) {
const img = document.createElement('img');
img.src = imageUrl;
document.body.appendChild(img);
const { data, error } = await sbStorageUpload(`${packageInfo.name}/common/${environment.OBS_IMAGE_DIR}`, blob);
const { error } = await sbStorageUpload(`${packageInfo.name}/common/${environment.OBS_IMAGE_DIR}`, blob);
if (error) {
// eslint-disable-next-line no-console
console.log('error uploading images to supabase', { error });
throw error;
}
console.log(data);
} catch (error) {
console.error('Error fetching image:', error);

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

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

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

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
}
Expand Down Expand Up @@ -74,7 +73,6 @@ export const checkandDownloadObsImages = async () => {
await createDirectory({ path: obsImagePath });
}
const { data: filesInDir } = await sbStorageDownload(obsImagePath);
console.log({ filesInDir });
Object.values(OBSData).forEach(async (storyObj) => {
Object.values(storyObj.story).forEach(async (story) => {
let fileName = story.url.split('/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,9 @@ const DownloadCreateSBforHelps = async (projectResource, setLoading, update = fa
const userProfile = await localForage.getItem('userProfile');
const username = userProfile?.user?.email;
try {
console.log('DownloadCreateSBforHelps.js', 'In helps-resource download');
setLoading(true);
const folder = `${newPath}/${username}/resources`;
const { data: existingResource } = await sbStorageDownload(folder);
console.log(existingResource);
const downloadProjectName = `${projectResource?.name}_${projectResource?.owner}_${projectResource?.release?.tag_name}`;
existingResource?.forEach((element) => {
if (downloadProjectName === element.name) {
Expand All @@ -151,7 +149,6 @@ const DownloadCreateSBforHelps = async (projectResource, setLoading, update = fa

await fetch(projectResource?.zipball_url).then((res) => res.arrayBuffer()).then(async (blob) => {
const { data: folderExist } = await sbStorageList(folder);
console.log({ folderExist });
if (!folderExist) {
await createDirectory({ path: folder });
}
Expand All @@ -161,6 +158,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
console.log('Failed to download zip file', fileContentError);
}

Expand All @@ -183,14 +181,12 @@ 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
console.log('DownloadCreateSBforHelps.js', 'failed to save yml metadata.json : ', err);
});

// finally remove zip and rename base folder to projectname_id
console.log('DownloadCreateSBforHelps.js', 'deleting zip file - rename project with project + id in ag format');
if (folderExist) {
console.log('DownloadCreateSBforHelps.js', 'deleting zip file - rename project with project + id in ag format');

if (update && update?.status) {
// if updation delete old resource
console.log({ projectOld: `${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

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

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

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
Expand All @@ -207,7 +203,6 @@ const DownloadCreateSBforHelps = async (projectResource, setLoading, update = fa
});
} catch (error) {
setLoading(false);
console.log('DownloadCreateSBforHelps.js', error);
}
}
};
Expand Down
Loading

0 comments on commit 8ac1b8a

Please sign in to comment.