Browse Source

[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>
closed-social-glitch-2
Bèr Kessels 4 years ago
committed by Thibaut Girka
parent
commit
fc53d9cc76
16 changed files with 18 additions and 17 deletions
  1. +1
    -1
      app/javascript/flavours/glitch/components/intersection_observer_article.js
  2. +1
    -1
      app/javascript/flavours/glitch/features/blocks/index.js
  3. +1
    -0
      app/javascript/flavours/glitch/features/compose/components/poll_form.js
  4. +1
    -1
      app/javascript/flavours/glitch/features/domain_blocks/index.js
  5. +1
    -1
      app/javascript/flavours/glitch/features/favourites/index.js
  6. +1
    -1
      app/javascript/flavours/glitch/features/follow_requests/index.js
  7. +1
    -1
      app/javascript/flavours/glitch/features/followers/index.js
  8. +1
    -1
      app/javascript/flavours/glitch/features/following/index.js
  9. +1
    -1
      app/javascript/flavours/glitch/features/lists/index.js
  10. +1
    -1
      app/javascript/flavours/glitch/features/mutes/index.js
  11. +1
    -1
      app/javascript/flavours/glitch/features/reblogs/index.js
  12. +1
    -1
      app/javascript/flavours/glitch/features/status/components/card.js
  13. +2
    -2
      app/javascript/flavours/glitch/reducers/notifications.js
  14. +2
    -2
      app/javascript/flavours/glitch/reducers/timelines.js
  15. +1
    -1
      app/javascript/flavours/glitch/selectors/index.js
  16. +1
    -1
      app/javascript/flavours/glitch/store/configureStore.js

+ 1
- 1
app/javascript/flavours/glitch/components/intersection_observer_article.js 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;

+ 1
- 1
app/javascript/flavours/glitch/features/blocks/index.js 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>

+ 1
- 0
app/javascript/flavours/glitch/features/compose/components/poll_form.js 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>

+ 1
- 1
app/javascript/flavours/glitch/features/domain_blocks/index.js 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>

+ 1
- 1
app/javascript/flavours/glitch/features/favourites/index.js 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>

+ 1
- 1
app/javascript/flavours/glitch/features/follow_requests/index.js 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>

+ 1
- 1
app/javascript/flavours/glitch/features/followers/index.js 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>

+ 1
- 1
app/javascript/flavours/glitch/features/following/index.js 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>

+ 1
- 1
app/javascript/flavours/glitch/features/lists/index.js 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>

+ 1
- 1
app/javascript/flavours/glitch/features/mutes/index.js 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>

+ 1
- 1
app/javascript/flavours/glitch/features/reblogs/index.js 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>

+ 1
- 1
app/javascript/flavours/glitch/features/status/components/card.js View File

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

+ 2
- 2
app/javascript/flavours/glitch/reducers/notifications.js 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));

+ 2
- 2
app/javascript/flavours/glitch/reducers/timelines.js 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;

+ 1
- 1
app/javascript/flavours/glitch/selectors/index.js 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);
}); });
}
},
); );
}; };

+ 1
- 1
app/javascript/flavours/glitch/store/configureStore.js 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));
}; };

Loading…
Cancel
Save