Change eslint
config to autofix missing comma and indentation in JS files (#26711)
This commit is contained in:
parent
c310374a2f
commit
774e1189d2
19 changed files with 39 additions and 38 deletions
|
@ -9,7 +9,6 @@ module.exports = {
|
||||||
'plugin:import/recommended',
|
'plugin:import/recommended',
|
||||||
'plugin:promise/recommended',
|
'plugin:promise/recommended',
|
||||||
'plugin:jsdoc/recommended',
|
'plugin:jsdoc/recommended',
|
||||||
'plugin:prettier/recommended',
|
|
||||||
],
|
],
|
||||||
|
|
||||||
env: {
|
env: {
|
||||||
|
@ -63,7 +62,9 @@ module.exports = {
|
||||||
'consistent-return': 'error',
|
'consistent-return': 'error',
|
||||||
'dot-notation': 'error',
|
'dot-notation': 'error',
|
||||||
eqeqeq: ['error', 'always', { 'null': 'ignore' }],
|
eqeqeq: ['error', 'always', { 'null': 'ignore' }],
|
||||||
|
'indent': ['error', 2],
|
||||||
'jsx-quotes': ['error', 'prefer-single'],
|
'jsx-quotes': ['error', 'prefer-single'],
|
||||||
|
'semi': ['error', 'always'],
|
||||||
'no-case-declarations': 'off',
|
'no-case-declarations': 'off',
|
||||||
'no-catch-shadow': 'error',
|
'no-catch-shadow': 'error',
|
||||||
'no-console': [
|
'no-console': [
|
||||||
|
|
|
@ -56,4 +56,4 @@ export const showAlertForError = (error, skipNotFound = false) => {
|
||||||
title: messages.unexpectedTitle,
|
title: messages.unexpectedTitle,
|
||||||
message: messages.unexpectedMessage,
|
message: messages.unexpectedMessage,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
|
@ -104,7 +104,7 @@ export function normalizeStatus(status, normalOldStatus) {
|
||||||
normalStatus.media_attachments.forEach(item => {
|
normalStatus.media_attachments.forEach(item => {
|
||||||
const oldItem = list.find(i => i.get('id') === item.id);
|
const oldItem = list.find(i => i.get('id') === item.id);
|
||||||
if (oldItem && oldItem.get('description') === item.description) {
|
if (oldItem && oldItem.get('description') === item.description) {
|
||||||
item.translation = oldItem.get('translation')
|
item.translation = oldItem.get('translation');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -137,13 +137,13 @@ export function normalizePoll(poll, normalOldPoll) {
|
||||||
...option,
|
...option,
|
||||||
voted: poll.own_votes && poll.own_votes.includes(index),
|
voted: poll.own_votes && poll.own_votes.includes(index),
|
||||||
titleHtml: emojify(escapeTextContentForBrowser(option.title), emojiMap),
|
titleHtml: emojify(escapeTextContentForBrowser(option.title), emojiMap),
|
||||||
}
|
};
|
||||||
|
|
||||||
if (normalOldPoll && normalOldPoll.getIn(['options', index, 'title']) === option.title) {
|
if (normalOldPoll && normalOldPoll.getIn(['options', index, 'title']) === option.title) {
|
||||||
normalOption.translation = normalOldPoll.getIn(['options', index, 'translation']);
|
normalOption.translation = normalOldPoll.getIn(['options', index, 'translation']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return normalOption
|
return normalOption;
|
||||||
});
|
});
|
||||||
|
|
||||||
return normalPoll;
|
return normalPoll;
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default class Column extends PureComponent {
|
||||||
scrollable = document.scrollingElement;
|
scrollable = document.scrollingElement;
|
||||||
} else {
|
} else {
|
||||||
scrollable = this.node.querySelector('.scrollable');
|
scrollable = this.node.querySelector('.scrollable');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!scrollable) {
|
if (!scrollable) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -132,7 +132,7 @@ class Poll extends ImmutablePureComponent {
|
||||||
|
|
||||||
handleReveal = () => {
|
handleReveal = () => {
|
||||||
this.setState({ revealed: true });
|
this.setState({ revealed: true });
|
||||||
}
|
};
|
||||||
|
|
||||||
renderOption (option, optionIndex, showResults) {
|
renderOption (option, optionIndex, showResults) {
|
||||||
const { poll, lang, disabled, intl } = this.props;
|
const { poll, lang, disabled, intl } = this.props;
|
||||||
|
|
|
@ -199,7 +199,7 @@ class Status extends ImmutablePureComponent {
|
||||||
} else if (attachments.getIn([0, 'type']) === 'audio') {
|
} else if (attachments.getIn([0, 'type']) === 'audio') {
|
||||||
return '16 / 9';
|
return '16 / 9';
|
||||||
} else {
|
} else {
|
||||||
return (attachments.size === 1 && attachments.getIn([0, 'meta', 'small', 'aspect'])) ? attachments.getIn([0, 'meta', 'small', 'aspect']) : '3 / 2'
|
return (attachments.size === 1 && attachments.getIn([0, 'meta', 'small', 'aspect'])) ? attachments.getIn([0, 'meta', 'small', 'aspect']) : '3 / 2';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default class NavigationBar extends ImmutablePureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const username = this.props.account.get('acct')
|
const username = this.props.account.get('acct');
|
||||||
return (
|
return (
|
||||||
<div className='navigation-bar'>
|
<div className='navigation-bar'>
|
||||||
<Link to={`/@${username}`}>
|
<Link to={`/@${username}`}>
|
||||||
|
|
|
@ -57,14 +57,14 @@ class Search extends PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultOptions = [
|
defaultOptions = [
|
||||||
{ label: <><mark>has:</mark> <FormattedList type='disjunction' value={['media', 'poll', 'embed']} /></>, action: e => { e.preventDefault(); this._insertText('has:') } },
|
{ label: <><mark>has:</mark> <FormattedList type='disjunction' value={['media', 'poll', 'embed']} /></>, action: e => { e.preventDefault(); this._insertText('has:'); } },
|
||||||
{ label: <><mark>is:</mark> <FormattedList type='disjunction' value={['reply', 'sensitive']} /></>, action: e => { e.preventDefault(); this._insertText('is:') } },
|
{ label: <><mark>is:</mark> <FormattedList type='disjunction' value={['reply', 'sensitive']} /></>, action: e => { e.preventDefault(); this._insertText('is:'); } },
|
||||||
{ label: <><mark>language:</mark> <FormattedMessage id='search_popout.language_code' defaultMessage='ISO language code' /></>, action: e => { e.preventDefault(); this._insertText('language:') } },
|
{ label: <><mark>language:</mark> <FormattedMessage id='search_popout.language_code' defaultMessage='ISO language code' /></>, action: e => { e.preventDefault(); this._insertText('language:'); } },
|
||||||
{ label: <><mark>from:</mark> <FormattedMessage id='search_popout.user' defaultMessage='user' /></>, action: e => { e.preventDefault(); this._insertText('from:') } },
|
{ label: <><mark>from:</mark> <FormattedMessage id='search_popout.user' defaultMessage='user' /></>, action: e => { e.preventDefault(); this._insertText('from:'); } },
|
||||||
{ label: <><mark>before:</mark> <FormattedMessage id='search_popout.specific_date' defaultMessage='specific date' /></>, action: e => { e.preventDefault(); this._insertText('before:') } },
|
{ label: <><mark>before:</mark> <FormattedMessage id='search_popout.specific_date' defaultMessage='specific date' /></>, action: e => { e.preventDefault(); this._insertText('before:'); } },
|
||||||
{ label: <><mark>during:</mark> <FormattedMessage id='search_popout.specific_date' defaultMessage='specific date' /></>, action: e => { e.preventDefault(); this._insertText('during:') } },
|
{ label: <><mark>during:</mark> <FormattedMessage id='search_popout.specific_date' defaultMessage='specific date' /></>, action: e => { e.preventDefault(); this._insertText('during:'); } },
|
||||||
{ label: <><mark>after:</mark> <FormattedMessage id='search_popout.specific_date' defaultMessage='specific date' /></>, action: e => { e.preventDefault(); this._insertText('after:') } },
|
{ label: <><mark>after:</mark> <FormattedMessage id='search_popout.specific_date' defaultMessage='specific date' /></>, action: e => { e.preventDefault(); this._insertText('after:'); } },
|
||||||
{ label: <><mark>in:</mark> <FormattedList type='disjunction' value={['all', 'library']} /></>, action: e => { e.preventDefault(); this._insertText('in:') } }
|
{ label: <><mark>in:</mark> <FormattedList type='disjunction' value={['all', 'library']} /></>, action: e => { e.preventDefault(); this._insertText('in:'); } }
|
||||||
];
|
];
|
||||||
|
|
||||||
setRef = c => {
|
setRef = c => {
|
||||||
|
|
|
@ -80,7 +80,7 @@ class Results extends PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
}
|
||||||
|
|
||||||
handleSelectAll = () => {
|
handleSelectAll = () => {
|
||||||
const { submittedType, dispatch } = this.props;
|
const { submittedType, dispatch } = this.props;
|
||||||
|
@ -116,7 +116,7 @@ class Results extends PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ type: 'hashtags' });
|
this.setState({ type: 'hashtags' });
|
||||||
}
|
};
|
||||||
|
|
||||||
handleSelectStatuses = () => {
|
handleSelectStatuses = () => {
|
||||||
const { submittedType, dispatch } = this.props;
|
const { submittedType, dispatch } = this.props;
|
||||||
|
@ -128,7 +128,7 @@ class Results extends PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ type: 'statuses' });
|
this.setState({ type: 'statuses' });
|
||||||
}
|
};
|
||||||
|
|
||||||
handleLoadMoreAccounts = () => this._loadMore('accounts');
|
handleLoadMoreAccounts = () => this._loadMore('accounts');
|
||||||
handleLoadMoreStatuses = () => this._loadMore('statuses');
|
handleLoadMoreStatuses = () => this._loadMore('statuses');
|
||||||
|
|
|
@ -199,7 +199,7 @@ const Firehose = ({ feedType, multiColumn }) => {
|
||||||
</Helmet>
|
</Helmet>
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
Firehose.propTypes = {
|
Firehose.propTypes = {
|
||||||
multiColumn: PropTypes.bool,
|
multiColumn: PropTypes.bool,
|
||||||
|
|
|
@ -27,9 +27,9 @@ const mapStateToProps = (state, { accountId }) => ({
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
onSignupClick() {
|
onSignupClick() {
|
||||||
dispatch(closeModal({
|
dispatch(closeModal({
|
||||||
modalType: undefined,
|
modalType: undefined,
|
||||||
ignoreFocus: false,
|
ignoreFocus: false,
|
||||||
}));
|
}));
|
||||||
dispatch(openModal({ modalType: 'CLOSED_REGISTRATIONS' }));
|
dispatch(openModal({ modalType: 'CLOSED_REGISTRATIONS' }));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -187,7 +187,7 @@ class LoginForm extends React.PureComponent {
|
||||||
|
|
||||||
setIFrameRef = (iframe) => {
|
setIFrameRef = (iframe) => {
|
||||||
this.iframeRef = iframe;
|
this.iframeRef = iframe;
|
||||||
}
|
};
|
||||||
|
|
||||||
handleFocus = () => {
|
handleFocus = () => {
|
||||||
this.setState({ expanded: true });
|
this.setState({ expanded: true });
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Reblogs extends ImmutablePureComponent {
|
||||||
if (!this.props.accountIds) {
|
if (!this.props.accountIds) {
|
||||||
this.props.dispatch(fetchReblogs(this.props.params.statusId));
|
this.props.dispatch(fetchReblogs(this.props.params.statusId));
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
handleRefresh = () => {
|
handleRefresh = () => {
|
||||||
this.props.dispatch(fetchReblogs(this.props.params.statusId));
|
this.props.dispatch(fetchReblogs(this.props.params.statusId));
|
||||||
|
|
|
@ -104,7 +104,7 @@ const Comment = ({ comment, domain, statusIds, isRemote, isSubmitting, selectedD
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
Comment.propTypes = {
|
Comment.propTypes = {
|
||||||
comment: PropTypes.string.isRequired,
|
comment: PropTypes.string.isRequired,
|
||||||
|
|
|
@ -132,7 +132,7 @@ class DetailedStatus extends ImmutablePureComponent {
|
||||||
} else if (attachments.getIn([0, 'type']) === 'audio') {
|
} else if (attachments.getIn([0, 'type']) === 'audio') {
|
||||||
return '16 / 9';
|
return '16 / 9';
|
||||||
} else {
|
} else {
|
||||||
return (attachments.size === 1 && attachments.getIn([0, 'meta', 'small', 'aspect'])) ? attachments.getIn([0, 'meta', 'small', 'aspect']) : '3 / 2'
|
return (attachments.size === 1 && attachments.getIn([0, 'meta', 'small', 'aspect'])) ? attachments.getIn([0, 'meta', 'small', 'aspect']) : '3 / 2';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,8 +76,8 @@ class Header extends PureComponent {
|
||||||
|
|
||||||
if (sso_redirect) {
|
if (sso_redirect) {
|
||||||
content = (
|
content = (
|
||||||
<a href={sso_redirect} data-method='post' className='button button--block button-tertiary'><FormattedMessage id='sign_in_banner.sso_redirect' defaultMessage='Login or Register' /></a>
|
<a href={sso_redirect} data-method='post' className='button button--block button-tertiary'><FormattedMessage id='sign_in_banner.sso_redirect' defaultMessage='Login or Register' /></a>
|
||||||
)
|
);
|
||||||
} else {
|
} else {
|
||||||
let signupButton;
|
let signupButton;
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ export default class ModalRoot extends PureComponent {
|
||||||
<BundleContainer fetchComponent={MODAL_COMPONENTS[type]} loading={this.renderLoading(type)} error={this.renderError} renderDelay={200}>
|
<BundleContainer fetchComponent={MODAL_COMPONENTS[type]} loading={this.renderLoading(type)} error={this.renderError} renderDelay={200}>
|
||||||
{(SpecificComponent) => {
|
{(SpecificComponent) => {
|
||||||
const ref = typeof SpecificComponent !== 'function' ? this.setModalRef : undefined;
|
const ref = typeof SpecificComponent !== 'function' ? this.setModalRef : undefined;
|
||||||
return <SpecificComponent {...props} onChangeBackgroundColor={this.setBackgroundColor} onClose={this.handleClose} ref={ref} />
|
return <SpecificComponent {...props} onChangeBackgroundColor={this.setBackgroundColor} onClose={this.handleClose} ref={ref} />;
|
||||||
}}
|
}}
|
||||||
</BundleContainer>
|
</BundleContainer>
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ const SignInBanner = () => {
|
||||||
<p><FormattedMessage id='sign_in_banner.text' defaultMessage='Login to follow profiles or hashtags, favorite, share and reply to posts. You can also interact from your account on a different server.' /></p>
|
<p><FormattedMessage id='sign_in_banner.text' defaultMessage='Login to follow profiles or hashtags, favorite, share and reply to posts. You can also interact from your account on a different server.' /></p>
|
||||||
<a href={sso_redirect} data-method='post' className='button button--block button-tertiary'><FormattedMessage id='sign_in_banner.sso_redirect' defaultMessage='Login or Register' /></a>
|
<a href={sso_redirect} data-method='post' className='button button--block button-tertiary'><FormattedMessage id='sign_in_banner.sso_redirect' defaultMessage='Login or Register' /></a>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (registrationsOpen) {
|
if (registrationsOpen) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import './public-path';
|
import './public-path';
|
||||||
import main from "mastodon/main"
|
import main from "mastodon/main";
|
||||||
|
|
||||||
import { start } from '../mastodon/common';
|
import { start } from '../mastodon/common';
|
||||||
import { loadLocale } from '../mastodon/locales';
|
import { loadLocale } from '../mastodon/locales';
|
||||||
|
|
|
@ -256,7 +256,7 @@ const startServer = async () => {
|
||||||
CHANNEL_NAMES.forEach(( channel ) => {
|
CHANNEL_NAMES.forEach(( channel ) => {
|
||||||
connectedChannels.set({ type: 'websocket', channel }, 0);
|
connectedChannels.set({ type: 'websocket', channel }, 0);
|
||||||
connectedChannels.set({ type: 'eventsource', channel }, 0);
|
connectedChannels.set({ type: 'eventsource', channel }, 0);
|
||||||
})
|
});
|
||||||
|
|
||||||
// Prime the counters so that we don't loose metrics between restarts.
|
// Prime the counters so that we don't loose metrics between restarts.
|
||||||
// Unfortunately counters don't support the set() API, so instead I'm using
|
// Unfortunately counters don't support the set() API, so instead I'm using
|
||||||
|
@ -1296,7 +1296,7 @@ const startServer = async () => {
|
||||||
log.verbose(request.requestId, 'Subscription error:', err.toString());
|
log.verbose(request.requestId, 'Subscription error:', err.toString());
|
||||||
socket.send(JSON.stringify({ error: err.toString() }));
|
socket.send(JSON.stringify({ error: err.toString() }));
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
const removeSubscription = (subscriptions, channelIds, request) => {
|
const removeSubscription = (subscriptions, channelIds, request) => {
|
||||||
|
@ -1316,7 +1316,7 @@ const startServer = async () => {
|
||||||
subscription.stopHeartbeat();
|
subscription.stopHeartbeat();
|
||||||
|
|
||||||
delete subscriptions[channelIds.join(';')];
|
delete subscriptions[channelIds.join(';')];
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {WebSocketSession} session
|
* @param {WebSocketSession} session
|
||||||
|
@ -1336,7 +1336,7 @@ const startServer = async () => {
|
||||||
socket.send(JSON.stringify({ error: "Error unsubscribing from channel" }));
|
socket.send(JSON.stringify({ error: "Error unsubscribing from channel" }));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {WebSocketSession} session
|
* @param {WebSocketSession} session
|
||||||
|
@ -1414,7 +1414,7 @@ const startServer = async () => {
|
||||||
const subscriptions = Object.keys(session.subscriptions);
|
const subscriptions = Object.keys(session.subscriptions);
|
||||||
|
|
||||||
subscriptions.forEach(channelIds => {
|
subscriptions.forEach(channelIds => {
|
||||||
removeSubscription(session.subscriptions, channelIds.split(';'), req)
|
removeSubscription(session.subscriptions, channelIds.split(';'), req);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Decrement the metrics for connected clients:
|
// Decrement the metrics for connected clients:
|
||||||
|
|
Loading…
Reference in a new issue