[Glitch] Code style improvements in JavaScript

Port b5d7ec71ef to glitch-soc

* JS-linter: fix trailing comma's

* Configure eslinter to ignore this onchange error.

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
th-downstream
Bèr Kessels 5 years ago committed by Thibaut Girka
parent ce8d13d2fb
commit 96b18a705f

@ -45,7 +45,7 @@ export default class IntersectionObserverArticle extends React.Component {
intersectionObserverWrapper.observe( intersectionObserverWrapper.observe(
id, id,
this.node, this.node,
this.handleIntersection this.handleIntersection,
); );
this.componentMounted = true; this.componentMounted = true;

@ -66,7 +66,7 @@ class Blocks extends ImmutablePureComponent {
bindToDocument={!multiColumn} bindToDocument={!multiColumn}
> >
{accountIds.map(id => {accountIds.map(id =>
<AccountContainer key={id} id={id} /> <AccountContainer key={id} id={id} />,
)} )}
</ScrollableList> </ScrollableList>
</Column> </Column>

@ -143,6 +143,7 @@ class PollForm extends ImmutablePureComponent {
<option value='true'>{intl.formatMessage(messages.multiple_choices)}</option> <option value='true'>{intl.formatMessage(messages.multiple_choices)}</option>
</select> </select>
{/* eslint-disable-next-line jsx-a11y/no-onchange */}
<select value={expiresIn} onChange={this.handleSelectDuration}> <select value={expiresIn} onChange={this.handleSelectDuration}>
<option value={300}>{intl.formatMessage(messages.minutes, { number: 5 })}</option> <option value={300}>{intl.formatMessage(messages.minutes, { number: 5 })}</option>
<option value={1800}>{intl.formatMessage(messages.minutes, { number: 30 })}</option> <option value={1800}>{intl.formatMessage(messages.minutes, { number: 30 })}</option>

@ -67,7 +67,7 @@ class Blocks extends ImmutablePureComponent {
bindToDocument={!multiColumn} bindToDocument={!multiColumn}
> >
{domains.map(domain => {domains.map(domain =>
<DomainContainer key={domain} domain={domain} /> <DomainContainer key={domain} domain={domain} />,
)} )}
</ScrollableList> </ScrollableList>
</Column> </Column>

@ -88,7 +88,7 @@ class Favourites extends ImmutablePureComponent {
bindToDocument={!multiColumn} bindToDocument={!multiColumn}
> >
{accountIds.map(id => {accountIds.map(id =>
<AccountContainer key={id} id={id} withNote={false} /> <AccountContainer key={id} id={id} withNote={false} />,
)} )}
</ScrollableList> </ScrollableList>
</Column> </Column>

@ -67,7 +67,7 @@ class FollowRequests extends ImmutablePureComponent {
bindToDocument={!multiColumn} bindToDocument={!multiColumn}
> >
{accountIds.map(id => {accountIds.map(id =>
<AccountAuthorizeContainer key={id} id={id} /> <AccountAuthorizeContainer key={id} id={id} />,
)} )}
</ScrollableList> </ScrollableList>
</Column> </Column>

@ -105,7 +105,7 @@ class Followers extends ImmutablePureComponent {
bindToDocument={!multiColumn} bindToDocument={!multiColumn}
> >
{accountIds.map(id => {accountIds.map(id =>
<AccountContainer key={id} id={id} withNote={false} /> <AccountContainer key={id} id={id} withNote={false} />,
)} )}
</ScrollableList> </ScrollableList>
</Column> </Column>

@ -105,7 +105,7 @@ class Following extends ImmutablePureComponent {
bindToDocument={!multiColumn} bindToDocument={!multiColumn}
> >
{accountIds.map(id => {accountIds.map(id =>
<AccountContainer key={id} id={id} withNote={false} /> <AccountContainer key={id} id={id} withNote={false} />,
)} )}
</ScrollableList> </ScrollableList>
</Column> </Column>

@ -73,7 +73,7 @@ class Lists extends ImmutablePureComponent {
bindToDocument={!multiColumn} bindToDocument={!multiColumn}
> >
{lists.map(list => {lists.map(list =>
<ColumnLink key={list.get('id')} to={`/timelines/list/${list.get('id')}`} icon='list-ul' text={list.get('title')} /> <ColumnLink key={list.get('id')} to={`/timelines/list/${list.get('id')}`} icon='list-ul' text={list.get('title')} />,
)} )}
</ScrollableList> </ScrollableList>
</Column> </Column>

@ -66,7 +66,7 @@ class Mutes extends ImmutablePureComponent {
bindToDocument={!multiColumn} bindToDocument={!multiColumn}
> >
{accountIds.map(id => {accountIds.map(id =>
<AccountContainer key={id} id={id} /> <AccountContainer key={id} id={id} />,
)} )}
</ScrollableList> </ScrollableList>
</Column> </Column>

@ -89,7 +89,7 @@ class Reblogs extends ImmutablePureComponent {
bindToDocument={!multiColumn} bindToDocument={!multiColumn}
> >
{accountIds.map(id => {accountIds.map(id =>
<AccountContainer key={id} id={id} withNote={false} /> <AccountContainer key={id} id={id} withNote={false} />,
)} )}
</ScrollableList> </ScrollableList>
</Column> </Column>

@ -90,7 +90,7 @@ export default class Card extends React.PureComponent {
}, },
}, },
]), ]),
0 0,
); );
}; };

@ -91,11 +91,11 @@ const expandNormalizedNotifications = (state, notifications, next, isLoadingRece
mutable.update(usePendingItems ? 'pendingItems' : 'items', list => { mutable.update(usePendingItems ? 'pendingItems' : 'items', list => {
const lastIndex = 1 + list.findLastIndex( const lastIndex = 1 + list.findLastIndex(
item => item !== null && (compareId(item.get('id'), items.last().get('id')) > 0 || item.get('id') === items.last().get('id')) item => item !== null && (compareId(item.get('id'), items.last().get('id')) > 0 || item.get('id') === items.last().get('id')),
); );
const firstIndex = 1 + list.take(lastIndex).findLastIndex( const firstIndex = 1 + list.take(lastIndex).findLastIndex(
item => item !== null && compareId(item.get('id'), items.first().get('id')) > 0 item => item !== null && compareId(item.get('id'), items.first().get('id')) > 0,
); );
return list.take(firstIndex).concat(items, list.skip(lastIndex)); return list.take(firstIndex).concat(items, list.skip(lastIndex));

@ -53,7 +53,7 @@ const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial, is
return oldIds.take(firstIndex + 1).concat( return oldIds.take(firstIndex + 1).concat(
isPartial && oldIds.get(firstIndex) !== null ? newIds.unshift(null) : newIds, isPartial && oldIds.get(firstIndex) !== null ? newIds.unshift(null) : newIds,
oldIds.skip(lastIndex) oldIds.skip(lastIndex),
); );
}); });
} }
@ -171,7 +171,7 @@ export default function timelines(state = initialState, action) {
return state.update( return state.update(
action.timeline, action.timeline,
initialTimeline, initialTimeline,
map => map.set('online', false).update(action.usePendingItems ? 'pendingItems' : 'items', items => items.first() ? items.unshift(null) : items) map => map.set('online', false).update(action.usePendingItems ? 'pendingItems' : 'items', items => items.first() ? items.unshift(null) : items),
); );
default: default:
return state; return state;

@ -146,7 +146,7 @@ export const makeGetStatus = () => {
map.set('account', accountBase); map.set('account', accountBase);
map.set('filtered', filtered); map.set('filtered', filtered);
}); });
} },
); );
}; };

@ -10,6 +10,6 @@ export default function configureStore() {
thunk, thunk,
loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] }), loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] }),
errorsMiddleware(), errorsMiddleware(),
soundsMiddleware() soundsMiddleware(),
), window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : f => f)); ), window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : f => f));
}; };

Loading…
Cancel
Save