Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
Fixes #50
  • Loading branch information
neatchee committed Feb 14, 2023
1 parent 27e11c2 commit 12ff665
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ module.exports = {
'react/jsx-equals-spacing': 'error',
'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
'react/jsx-indent': ['error', 2],
'react/jsx-no-bind': 'error',
// jsx-no-bind is outdated; browsers have been updated to support this case without the perf impact
// 'react/jsx-no-bind': 'error',
'react/jsx-no-target-blank': 'off',
'react/jsx-tag-spacing': 'error',
'react/jsx-wrap-multilines': 'error',
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/core/public.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// This file will be loaded on public pages, regardless of theme.

import 'packs/public-path';
import ready from '../mastodon/ready';

const { delegate } = require('@rails/ujs');
const { length } = require('stringz');

const getProfileAvatarAnimationHandler = (swapTo) => {
//animate avatar gifs on the profile page when moused over
Expand Down
14 changes: 12 additions & 2 deletions app/javascript/flavours/glitch/actions/accounts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import api, { getLinks } from '../api';
import { importAccount, importFetchedAccount, importFetchedAccounts } from './importer';
import { importFetchedAccount, importFetchedAccounts } from './importer';

export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST';
export const ACCOUNT_FETCH_SUCCESS = 'ACCOUNT_FETCH_SUCCESS';
Expand Down Expand Up @@ -84,6 +84,7 @@ export const PINNED_ACCOUNTS_FETCH_FAIL = 'PINNED_ACCOUNTS_FETCH_FAIL';
export const PINNED_ACCOUNTS_EDITOR_SUGGESTIONS_READY = 'PINNED_ACCOUNTS_EDITOR_SUGGESTIONS_READY';
export const PINNED_ACCOUNTS_EDITOR_SUGGESTIONS_CLEAR = 'PINNED_ACCOUNTS_EDITOR_SUGGESTIONS_CLEAR';
export const PINNED_ACCOUNTS_EDITOR_SUGGESTIONS_CHANGE = 'PINNED_ACCOUNTS_EDITOR_SUGGESTIONS_CHANGE';
export const PINNED_ACCOUNTS_EDITOR_SUGGESTIONS_FETCH_FAIL = 'PINNED_ACCOUNTS_EDITOR_SUGGESTIONS_FETCH_FAIL';

export const PINNED_ACCOUNTS_EDITOR_RESET = 'PINNED_ACCOUNTS_EDITOR_RESET';

Expand Down Expand Up @@ -851,7 +852,9 @@ export function fetchPinnedAccountsSuggestions(q) {
api(getState).get('/api/v1/accounts/search', { params }).then(response => {
dispatch(importFetchedAccounts(response.data));
dispatch(fetchPinnedAccountsSuggestionsReady(q, response.data));
});
}).catch(error => {
dispatch(fetchPinnedAccountsSuggestionsFail(error))
})
};
}

Expand All @@ -876,6 +879,13 @@ export function changePinnedAccountsSuggestions(value) {
};
}

export function fetchPinnedAccountsSuggestionsFail(error) {
return {
type: PINNED_ACCOUNTS_EDITOR_SUGGESTIONS_FETCH_FAIL,
error,
};
}

export function resetPinnedAccountsEditor() {
return {
type: PINNED_ACCOUNTS_EDITOR_RESET,
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/flavours/glitch/actions/interactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export function unpinFail(status, error) {
status,
error,
};
};
}

export const addReaction = (statusId, name, url) => (dispatch, getState) => {
const status = getState().get('statuses').get(statusId);
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/flavours/glitch/actions/timelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { submitMarkers } from './markers';
import api, { getLinks } from 'flavours/glitch/api';
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
import compareId from 'flavours/glitch/compare_id';
import { me, usePendingItems as preferPendingItems } from 'flavours/glitch/initial_state';
import { usePendingItems as preferPendingItems } from 'flavours/glitch/initial_state';
import { toServerSideType } from 'flavours/glitch/utils/filters';

export const TIMELINE_UPDATE = 'TIMELINE_UPDATE';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default class AvatarComposite extends React.PureComponent {
accounts: ImmutablePropTypes.list.isRequired,
animate: PropTypes.bool,
size: PropTypes.number.isRequired,
onAccountClick: PropTypes.func,
};

static defaultProps = {
Expand Down
4 changes: 3 additions & 1 deletion app/javascript/flavours/glitch/components/display_name.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class DisplayName extends React.PureComponent {
localDomain: PropTypes.string,
others: ImmutablePropTypes.list,
handleClick: PropTypes.func,
onAccountClick: PropTypes.func,
};

handleMouseEnter = ({ currentTarget }) => {
Expand Down Expand Up @@ -66,8 +67,9 @@ export default class DisplayName extends React.PureComponent {
onClick={(e) => onAccountClick(a.get('acct'), e)}
title={`@${a.get('acct')}`}
rel='noopener noreferrer'
key={a.get('id')}
>
<bdi key={a.get('id')}>
<bdi>
<strong className='display-name__html' dangerouslySetInnerHTML={{ __html: a.get('display_name_html') }} />
</bdi>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ class PollForm extends ImmutablePureComponent {
</ul>

<div className='poll__footer'>
// onChange is safe and necessary here, otherwise updates don't happen until the element loses focus
// eslint-disable-next-line jsx-a11y/no-onchange
<select value={isMultiple ? 'true' : 'false'} onChange={this.handleSelectMultiple}>
<option value='false'>{intl.formatMessage(messages.single_choice)}</option>
<option value='true'>{intl.formatMessage(messages.multiple_choices)}</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ class Announcement extends ImmutablePureComponent {
hour: skipTime ? undefined : '2-digit',
minute: skipTime ? undefined : '2-digit',
});

const formattedEndsAt = endsAt?.toLocaleString(undefined, {
hourCycle: 'h23',
year: (skipYear || startsAt.getFullYear() === now.getFullYear()) ? undefined : 'numeric',
Expand Down
1 change: 0 additions & 1 deletion app/javascript/flavours/glitch/features/ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ const mapStateToProps = state => ({
hasComposingText: state.getIn(['compose', 'text']).trim().length !== 0,
hasMediaAttachments: state.getIn(['compose', 'media_attachments']).size > 0,
canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < 4,
layout: state.getIn(['meta', 'layout']),
layout_local_setting: state.getIn(['local_settings', 'layout']),
isWide: state.getIn(['local_settings', 'stretch']),
navbarUnder: state.getIn(['local_settings', 'navbar_under']),
Expand Down

0 comments on commit 12ff665

Please sign in to comment.