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

enable no-console and func-names rules #394

Merged
merged 1 commit into from
Nov 5, 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
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ module.exports = {
extends: ["airbnb", "airbnb-typescript", "airbnb/hooks", "prettier"],
plugins: ["prettier"],
rules: {
"no-param-reassign": "warn",
"no-param-reassign": "off",
"import/prefer-default-export": "off",
"import/no-cycle": "warn",
"import/no-cycle": "off",
"react/jsx-props-no-spreading": "off", // some Mantine components need to use spread operator
"react-hooks/exhaustive-deps": "off", // at this stage it is too risky to enable this
},
Expand Down
41 changes: 18 additions & 23 deletions src/actions/albumsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import type { DatePhotosGroup, IncompleteDatePhotosGroup } from "./photosActions
import { IncompleteDatePhotosGroupSchema } from "./photosActions.types";

export function fetchThingAlbumsList() {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "FETCH_THING_ALBUMS_LIST" });
Server.get("albums/thing/list/")
.then(response => {
Expand All @@ -53,7 +53,7 @@ export function fetchThingAlbumsList() {
}

export function fetchThingAlbum(album_id: string) {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "FETCH_THING_ALBUMS" });
Server.get(`albums/thing/${album_id}/`)
.then(response => {
Expand All @@ -71,7 +71,7 @@ export function fetchThingAlbum(album_id: string) {
}

export function fetchUserAlbumsList() {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "FETCH_USER_ALBUMS_LIST" });
Server.get("albums/user/list/")
.then(response => {
Expand All @@ -83,7 +83,6 @@ export function fetchUserAlbumsList() {
});
})
.catch(err => {
console.error(err);
dispatch({ type: "FETCH_USER_ALBUMS_LIST_REJECTED", payload: err });
});
};
Expand All @@ -94,7 +93,7 @@ export const FETCH_USER_ALBUM_FULFILLED = "FETCH_USER_ALBUM_FULFILLED";
export const FETCH_USER_ALBUM_REJECTED = "FETCH_USER_ALBUM_REJECTED";

export function fetchUserAlbum(album_id: number) {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: FETCH_USER_ALBUM });
Server.get(`albums/user/${album_id}/`)
.then(response => {
Expand All @@ -117,7 +116,7 @@ export function fetchUserAlbum(album_id: number) {
}

export function createNewUserAlbum(title: string, image_hashes: string[]) {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "CREATE_USER_ALBUMS_LIST" });
Server.post("albums/user/edit/", { title, photos: image_hashes })
.then(response => {
Expand All @@ -144,7 +143,7 @@ export function createNewUserAlbum(title: string, image_hashes: string[]) {
}

export function renameUserAlbum(albumID: string, albumTitle: string, newAlbumTitle: string) {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "RENAME_USER_ALBUM" });
Server.patch(`/albums/user/edit/${albumID}/`, {
title: newAlbumTitle,
Expand All @@ -166,7 +165,7 @@ export function renameUserAlbum(albumID: string, albumTitle: string, newAlbumTit
}

export function deleteUserAlbum(albumID: string, albumTitle: string) {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "DELETE_USER_ALBUM" });
Server.delete(`/albums/user/${albumID}`)
.then(() => {
Expand All @@ -185,7 +184,7 @@ export function deleteUserAlbum(albumID: string, albumTitle: string) {
}

export function removeFromUserAlbum(album_id: number, title: string, image_hashes: string[]) {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "REMOVE_USER_ALBUMS_LIST" });
Server.patch(`albums/user/edit/${album_id}/`, {
removedPhotos: image_hashes,
Expand Down Expand Up @@ -215,7 +214,7 @@ export function removeFromUserAlbum(album_id: number, title: string, image_hashe
}

export function setAlbumCoverForUserAlbum(album_id, photo_hash) {
return function (dispatch) {
return function cb(dispatch) {
dispatch({ type: "SET_ALBUM_COVER_FOR_USER_ALBUM" });
Server.patch(`albums/user/edit/${album_id}/`, {
cover_photo: photo_hash,
Expand All @@ -231,14 +230,13 @@ export function setAlbumCoverForUserAlbum(album_id, photo_hash) {
dispatch(fetchUserAlbumsList());
})
.catch(err => {
console.error(err);
dispatch({ type: "SET_ALBUM_COVER_FOR_PERSON_REJECTED", payload: err });
});
};
}

export function addToUserAlbum(album_id: number, title: string, image_hashes: string[]) {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "EDIT_USER_ALBUMS_LIST" });
Server.patch(`albums/user/edit/${album_id}/`, {
title,
Expand Down Expand Up @@ -268,7 +266,7 @@ export function addToUserAlbum(album_id: number, title: string, image_hashes: st
}

export function fetchPlaceAlbumsList() {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "FETCH_PLACE_ALBUMS_LIST" });
Server.get("albums/place/list/")
.then(response => {
Expand All @@ -293,7 +291,7 @@ export function fetchPlaceAlbumsList() {
const PlaceAlbumResponseSchema = z.object({ results: PlaceAlbumSchema });

export function fetchPlaceAlbum(album_id: string) {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "FETCH_PLACE_ALBUMS" });
Server.get(`albums/place/${album_id}/`)
.then(response => {
Expand All @@ -310,7 +308,7 @@ export function fetchPlaceAlbum(album_id: string) {
}

export function fetchAutoAlbumsList() {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "FETCH_AUTO_ALBUMS_LIST" });
Server.get("albums/auto/list/")
.then(response => {
Expand Down Expand Up @@ -366,7 +364,6 @@ export function fetchAlbumDateList(dispatch: AppDispatch, options: AlbumDateList
});
})
.catch(err => {
console.error(err);
dispatch({ type: "FETCH_DATE_ALBUMS_LIST_REJECTED", payload: err });
});
}
Expand Down Expand Up @@ -408,7 +405,6 @@ export function fetchAlbumDate(dispatch: AppDispatch, options: AlbumDateOption)
});
})
.catch(err => {
console.error(err);
dispatch({ type: "FETCH_DATE_ALBUMS_RETRIEVE_REJECTED", payload: err });
});
}
Expand All @@ -425,13 +421,12 @@ export function fetchAlbumsAutoGalleries(dispatch: AppDispatch, album_id: string
});
})
.catch(err => {
console.error(err);
dispatch({ type: "FETCH_AUTO_ALBUMS_RETRIEVE_REJECTED", payload: err });
});
}

export function deleteAutoAlbum(albumID: string, albumTitle: string) {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "DELETE_AUTO_ALBUM" });
Server.delete(`/albums/auto/${albumID}`)
.then(() => {
Expand All @@ -450,7 +445,7 @@ export function deleteAutoAlbum(albumID: string, albumTitle: string) {
}

export function deleteAllAutoAlbum() {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "DELETE_All_AUTO_ALBUM" });
Server.post(`/albums/auto/delete_all/`)
.then(() => {
Expand All @@ -470,7 +465,7 @@ export function deleteAllAutoAlbum() {

// share user album
export function setUserAlbumShared(album_id: number, target_user_id: string, val_shared: boolean) {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "SET_ALBUM_USER_SHARED" });
Server.post("useralbum/share/", { shared: val_shared, album_id, target_user_id })
.then(response => {
Expand Down Expand Up @@ -502,7 +497,7 @@ export function setUserAlbumShared(album_id: number, target_user_id: string, val
}

export function fetchUserAlbumsSharedToMe() {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "FETCH_ALBUMS_SHARED_TO_ME" });
Server.get("/albums/user/shared/tome/")
.then(response => {
Expand All @@ -524,7 +519,7 @@ export function fetchUserAlbumsSharedToMe() {
}

export function fetchUserAlbumsSharedFromMe() {
return function (dispatch: Dispatch<any>) {
return function cb(dispatch: Dispatch<any>) {
dispatch({ type: "FETCH_ALBUMS_SHARED_FROM_ME" });
Server.get("/albums/user/shared/fromme/")
.then(response => {
Expand Down
6 changes: 3 additions & 3 deletions src/actions/peopleActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function fetchPeople(dispatch) {
}

export function renamePerson(personId, personName, newPersonName) {
return function (dispatch) {
return function cb(dispatch) {
dispatch({ type: "RENAME_PERSON" });
Server.patch(`persons/${personId}/`, { newPersonName })
.then(() => {
Expand All @@ -48,7 +48,7 @@ export function renamePerson(personId, personName, newPersonName) {
}

export function deletePerson(person_id) {
return function (dispatch) {
return function cb(dispatch) {
dispatch({ type: "DELETE_PERSON" });
Server.delete(`persons/${person_id}/`)
.then(() => {
Expand All @@ -69,7 +69,7 @@ export function deletePerson(person_id) {
}

export function setAlbumCoverForPerson(person_id, photo_hash) {
return function (dispatch) {
return function cb(dispatch) {
dispatch({ type: "SET_ALBUM_COVER_FOR_PERSON" });
Server.patch(`persons/${person_id}/`, {
cover_photo: photo_hash,
Expand Down
Loading