gochan-org / gochan

Use shorthand property syntax for object literals JS-0240
Anti-pattern
Minor
2 months ago2 years old
Expected property shorthand
 95		const op = data.posts[0];
 96		const threadObj: WatchedThreadJSON = {
 97			id: threadID as number,
 98			board: board, 99			posts: data.posts.length,
100			op: op.name,
101			latest: data.posts[data.posts.length-1].no
Expected property shorthand
 36						newPosts: data.posts.slice(thread.posts),
 37						newNumPosts: data.posts.length,
 38						op: thread.id,
 39						board: board 40					});
 41				}
 42			}).catch(e => {
Expected property shorthand
10
11export function notify(title: string, body: string, img = noteIcon) {
12	const n = new Notification(title, {
13		body: body,14		image: img,
15		icon: noteIcon
16	});
Expected method shorthand
37				changesButtonAdded = false;
38				$("div#save-changes").remove();
39			},
40			error: function(t, xhr, errorText) {41				if(!errorShown) {42					alertLightbox(`Received an error when saving changes (only the first one will be shown): ${errorText}`, "Error");43					errorShown = true;44				}45			}46		}).fail((xhr,err,errorText) => {
47			if(!errorShown) {
48				alertLightbox(`Received an error when saving changes (only the first one will be shown): ${errorText}`, "Error");
Expected method shorthand
32				sectionhidden: sectionhidden,
33				save_section: "Save section"
34			},
35			success: function() {36				alertLightbox("Section order changes saved successfully!", "Success");37				changesButtonAdded = false;38				$("div#save-changes").remove();39			},40			error: function(t, xhr, errorText) {
41				if(!errorShown) {
42					alertLightbox(`Received an error when saving changes (only the first one will be shown): ${errorText}`, "Error");