[Glitch] Code style improvements in JavaScript

Port fd76955f39 to glitch-soc

* JS-linter: fix trailing comma's

* Configure eslinter to ignore this onchange error.

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
Bèr Kessels 2020-03-08 16:02:36 +01:00 committed by Thibaut Girka
parent 35d2189ac8
commit fc53d9cc76
16 changed files with 18 additions and 17 deletions

View File

@ -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;

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

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

View File

@ -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));

View File

@ -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;

View File

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

View File

@ -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));
}; };