1
0

[Glitch] Enable ESLlint no-case-declarations

Port f91f077985 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Nick Schonning 2024-10-01 12:26:30 -04:00 committed by Claire
parent af39ac6edc
commit 61a0c58dee
6 changed files with 16 additions and 8 deletions

View File

@ -106,12 +106,13 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti
dispatch(processNewNotificationForGroups(notificationJSON)); dispatch(processNewNotificationForGroups(notificationJSON));
break; break;
} }
case 'notifications_merged': case 'notifications_merged': {
const state = getState(); const state = getState();
if (state.notifications.top || !state.notifications.mounted) if (state.notifications.top || !state.notifications.mounted)
dispatch(expandNotifications({ forceLoad: true, maxId: undefined })); dispatch(expandNotifications({ forceLoad: true, maxId: undefined }));
dispatch(refreshStaleNotificationGroups()); dispatch(refreshStaleNotificationGroups());
break; break;
}
case 'conversation': case 'conversation':
// @ts-expect-error // @ts-expect-error
dispatch(updateConversations(JSON.parse(data.payload))); dispatch(updateConversations(JSON.parse(data.payload)));

View File

@ -41,7 +41,7 @@ const isLinkMisleading = (link) => {
case Node.TEXT_NODE: case Node.TEXT_NODE:
linkTextParts.push(node.textContent); linkTextParts.push(node.textContent);
break; break;
case Node.ELEMENT_NODE: case Node.ELEMENT_NODE: {
if (node.classList.contains('invisible')) return; if (node.classList.contains('invisible')) return;
const children = node.childNodes; const children = node.childNodes;
for (let i = 0; i < children.length; i++) { for (let i = 0; i < children.length; i++) {
@ -49,6 +49,7 @@ const isLinkMisleading = (link) => {
} }
break; break;
} }
}
}; };
walk(link); walk(link);

View File

@ -512,7 +512,7 @@ export default function compose(state = initialState, action) {
return item; return item;
})); }));
case INIT_MEDIA_EDIT_MODAL: case INIT_MEDIA_EDIT_MODAL: {
const media = state.get('media_attachments').find(item => item.get('id') === action.id); const media = state.get('media_attachments').find(item => item.get('id') === action.id);
return state.set('media_modal', ImmutableMap({ return state.set('media_modal', ImmutableMap({
id: action.id, id: action.id,
@ -521,6 +521,7 @@ export default function compose(state = initialState, action) {
focusY: media.getIn(['meta', 'focus', 'y'], 0), focusY: media.getIn(['meta', 'focus', 'y'], 0),
dirty: false, dirty: false,
})); }));
}
case COMPOSE_CHANGE_MEDIA_DESCRIPTION: case COMPOSE_CHANGE_MEDIA_DESCRIPTION:
return state.setIn(['media_modal', 'description'], action.description).setIn(['media_modal', 'dirty'], true); return state.setIn(['media_modal', 'description'], action.description).setIn(['media_modal', 'dirty'], true);
case COMPOSE_CHANGE_MEDIA_FOCUS: case COMPOSE_CHANGE_MEDIA_FOCUS:
@ -575,7 +576,7 @@ export default function compose(state = initialState, action) {
})); }));
case COMPOSE_DOODLE_SET: case COMPOSE_DOODLE_SET:
return state.mergeIn(['doodle'], action.options); return state.mergeIn(['doodle'], action.options);
case REDRAFT: case REDRAFT: {
const do_not_federate = !!action.status.get('local_only'); const do_not_federate = !!action.status.get('local_only');
let text = action.raw_text || unescapeHTML(expandMentions(action.status)); let text = action.raw_text || unescapeHTML(expandMentions(action.status));
if (do_not_federate) text = text.replace(/ ?👁\ufe0f?\u200b?$/, ''); if (do_not_federate) text = text.replace(/ ?👁\ufe0f?\u200b?$/, '');
@ -616,6 +617,7 @@ export default function compose(state = initialState, action) {
})); }));
} }
}); });
}
case COMPOSE_SET_STATUS: case COMPOSE_SET_STATUS:
return state.withMutations(map => { return state.withMutations(map => {
map.set('id', action.status.get('id')); map.set('id', action.status.get('id'));

View File

@ -369,9 +369,10 @@ export default function notifications(state = initialState, action) {
} }
return markAllForDelete(st, action.yes); return markAllForDelete(st, action.yes);
case NOTIFICATIONS_MARK_AS_READ: case NOTIFICATIONS_MARK_AS_READ: {
const lastNotification = state.get('items').find(item => item !== null); const lastNotification = state.get('items').find(item => item !== null);
return lastNotification ? recountUnread(state, lastNotification.get('id')) : state; return lastNotification ? recountUnread(state, lastNotification.get('id')) : state;
}
default: default:
return state; return state;

View File

@ -72,9 +72,10 @@ export default function search(state = initialState, action) {
}); });
case SEARCH_EXPAND_REQUEST: case SEARCH_EXPAND_REQUEST:
return state.set('type', action.searchType).set('isLoading', true); return state.set('type', action.searchType).set('isLoading', true);
case SEARCH_EXPAND_SUCCESS: case SEARCH_EXPAND_SUCCESS: {
const results = action.searchType === 'hashtags' ? ImmutableOrderedSet(fromJS(action.results.hashtags)) : action.results[action.searchType].map(item => item.id); const results = action.searchType === 'hashtags' ? ImmutableOrderedSet(fromJS(action.results.hashtags)) : action.results[action.searchType].map(item => item.id);
return state.updateIn(['results', action.searchType], list => list.union(results)).set('isLoading', false); return state.updateIn(['results', action.searchType], list => list.union(results)).set('isLoading', false);
}
case SEARCH_HISTORY_UPDATE: case SEARCH_HISTORY_UPDATE:
return state.set('recent', ImmutableOrderedSet(fromJS(action.recent))); return state.set('recent', ImmutableOrderedSet(fromJS(action.recent)));
default: default:

View File

@ -17,7 +17,7 @@ const dropOrientationIfNeeded = (orientation) => new Promise(resolve => {
case false: case false:
resolve(orientation); resolve(orientation);
break; break;
default: default: {
// black 2x1 JPEG, with the following meta information set: // black 2x1 JPEG, with the following meta information set:
// - EXIF Orientation: 6 (Rotated 90° CCW) // - EXIF Orientation: 6 (Rotated 90° CCW)
const testImageURL = const testImageURL =
@ -39,6 +39,7 @@ const dropOrientationIfNeeded = (orientation) => new Promise(resolve => {
}; };
img.src = testImageURL; img.src = testImageURL;
} }
}
}); });
// Some browsers don't allow reading from a canvas and instead return all-white // Some browsers don't allow reading from a canvas and instead return all-white
@ -52,7 +53,7 @@ const checkCanvasReliability = () => new Promise((resolve, reject) => {
case false: case false:
resolve(); resolve();
break; break;
default: default: {
// 2×2 GIF with white, red, green and blue pixels // 2×2 GIF with white, red, green and blue pixels
const testImageURL = const testImageURL =
'data:image/gif;base64,R0lGODdhAgACAKEDAAAA//8AAAD/AP///ywAAAAAAgACAAACA1wEBQA7'; 'data:image/gif;base64,R0lGODdhAgACAKEDAAAA//8AAAD/AP///ywAAAAAAgACAAACA1wEBQA7';
@ -78,6 +79,7 @@ const checkCanvasReliability = () => new Promise((resolve, reject) => {
}; };
img.src = testImageURL; img.src = testImageURL;
} }
}
}); });
const getImageUrl = inputFile => new Promise((resolve, reject) => { const getImageUrl = inputFile => new Promise((resolve, reject) => {