[build] upgrade eslint to 9.37.0 (#88)

Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/88
Co-authored-by: Zoë Bijl <moiety@noreply.codeberg.org>
Co-committed-by: Zoë Bijl <moiety@noreply.codeberg.org>
This commit is contained in:
Zoë Bijl
2025-10-12 13:42:02 +02:00
committed by tobi
parent 75d7a62693
commit 1ff70886a1
975 changed files with 22196 additions and 21964 deletions
@@ -1,42 +1,42 @@
import PropTypes from 'prop-types';
import PropTypes from "prop-types";
import { injectIntl, FormattedMessage, defineMessages } from 'react-intl';
import { injectIntl, FormattedMessage, defineMessages } from "react-intl";
import classNames from 'classnames';
import { Link } from 'react-router-dom';
import classNames from "classnames";
import { Link } from "react-router-dom";
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import ImmutablePropTypes from "react-immutable-proptypes";
import ImmutablePureComponent from "react-immutable-pure-component";
import { HotKeys } from 'react-hotkeys';
import { HotKeys } from "react-hotkeys";
import { Icon } from 'mastodon/components/icon';
import AccountContainer from 'mastodon/containers/account_container';
import StatusContainer from 'mastodon/containers/status_container';
import { me } from 'mastodon/initial_state';
import { Icon } from "mastodon/components/icon";
import AccountContainer from "mastodon/containers/account_container";
import StatusContainer from "mastodon/containers/status_container";
import { me } from "mastodon/initial_state";
import FollowRequestContainer from '../containers/follow_request_container';
import FollowRequestContainer from "../containers/follow_request_container";
import Report from './report';
import Report from "./report";
const messages = defineMessages({
favourite: { id: 'notification.favourite', defaultMessage: '{name} favorited your status' },
follow: { id: 'notification.follow', defaultMessage: '{name} followed you' },
ownPoll: { id: 'notification.own_poll', defaultMessage: 'Your poll has ended' },
poll: { id: 'notification.poll', defaultMessage: 'A poll you have voted in has ended' },
reblog: { id: 'notification.reblog', defaultMessage: '{name} boosted your status' },
status: { id: 'notification.status', defaultMessage: '{name} just posted' },
update: { id: 'notification.update', defaultMessage: '{name} edited a post' },
adminSignUp: { id: 'notification.admin.sign_up', defaultMessage: '{name} signed up' },
adminReport: { id: 'notification.admin.report', defaultMessage: '{name} reported {target}' },
favourite: { id: "notification.favourite", defaultMessage: "{name} favorited your status" },
follow: { id: "notification.follow", defaultMessage: "{name} followed you" },
ownPoll: { id: "notification.own_poll", defaultMessage: "Your poll has ended" },
poll: { id: "notification.poll", defaultMessage: "A poll you have voted in has ended" },
reblog: { id: "notification.reblog", defaultMessage: "{name} boosted your status" },
status: { id: "notification.status", defaultMessage: "{name} just posted" },
update: { id: "notification.update", defaultMessage: "{name} edited a post" },
adminSignUp: { id: "notification.admin.sign_up", defaultMessage: "{name} signed up" },
adminReport: { id: "notification.admin.report", defaultMessage: "{name} reported {target}" },
});
const notificationForScreenReader = (intl, message, timestamp) => {
const output = [message];
output.push(intl.formatDate(timestamp, { hour: '2-digit', minute: '2-digit', month: 'short', day: 'numeric' }));
output.push(intl.formatDate(timestamp, { hour: "2-digit", minute: "2-digit", month: "short", day: "numeric" }));
return output.join(', ');
return output.join(", ");
};
class Notification extends ImmutablePureComponent {
@@ -65,19 +65,19 @@ class Notification extends ImmutablePureComponent {
handleMoveUp = () => {
const { notification, onMoveUp } = this.props;
onMoveUp(notification.get('id'));
onMoveUp(notification.get("id"));
};
handleMoveDown = () => {
const { notification, onMoveDown } = this.props;
onMoveDown(notification.get('id'));
onMoveDown(notification.get("id"));
};
handleOpen = () => {
const { notification } = this.props;
if (notification.get('status')) {
this.context.router.history.push(`/@${notification.getIn(['status', 'account', 'acct'])}/${notification.get('status')}`);
if (notification.get("status")) {
this.context.router.history.push(`/@${notification.getIn(["status", "account", "acct"])}/${notification.get("status")}`);
} else {
this.handleOpenProfile();
}
@@ -85,29 +85,35 @@ class Notification extends ImmutablePureComponent {
handleOpenProfile = () => {
const { notification } = this.props;
this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`);
this.context.router.history.push(`/@${notification.getIn(["account", "acct"])}`);
};
handleMention = e => {
e.preventDefault();
const { notification, onMention } = this.props;
onMention(notification.get('account'), this.context.router.history);
onMention(notification.get("account"), this.context.router.history);
};
handleHotkeyFavourite = () => {
const { status } = this.props;
if (status) this.props.onFavourite(status);
if (status) {
this.props.onFavourite(status);
}
};
handleHotkeyBoost = e => {
const { status } = this.props;
if (status) this.props.onReblog(status, e);
if (status) {
this.props.onReblog(status, e);
}
};
handleHotkeyToggleHidden = () => {
const { status } = this.props;
if (status) this.props.onToggleHidden(status);
if (status) {
this.props.onToggleHidden(status);
}
};
getHandlers () {
@@ -129,18 +135,18 @@ class Notification extends ImmutablePureComponent {
return (
<HotKeys handlers={this.getHandlers()}>
<div className={classNames('notification notification-follow focusable', { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.follow, { name: account.get('acct') }), notification.get('created_at'))}>
<div className={classNames("notification notification-follow focusable", { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.follow, { name: account.get("acct") }), notification.get("created_at"))}>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<Icon id='user-plus' fixedWidth />
</div>
<span title={notification.get('created_at')}>
<span title={notification.get("created_at")}>
<FormattedMessage id='notification.follow' defaultMessage='{name} followed you' values={{ name: link }} />
</span>
</div>
<AccountContainer id={account.get('id')} hidden={this.props.hidden} />
<AccountContainer id={account.get("id")} hidden={this.props.hidden} />
</div>
</HotKeys>
);
@@ -151,18 +157,18 @@ class Notification extends ImmutablePureComponent {
return (
<HotKeys handlers={this.getHandlers()}>
<div className={classNames('notification notification-follow-request focusable', { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage({ id: 'notification.follow_request', defaultMessage: '{name} has requested to follow you' }, { name: account.get('acct') }), notification.get('created_at'))}>
<div className={classNames("notification notification-follow-request focusable", { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage({ id: "notification.follow_request", defaultMessage: "{name} has requested to follow you" }, { name: account.get("acct") }), notification.get("created_at"))}>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<Icon id='user' fixedWidth />
</div>
<span title={notification.get('created_at')}>
<span title={notification.get("created_at")}>
<FormattedMessage id='notification.follow_request' defaultMessage='{name} has requested to follow you' values={{ name: link }} />
</span>
</div>
<FollowRequestContainer id={account.get('id')} withNote={false} hidden={this.props.hidden} />
<FollowRequestContainer id={account.get("id")} withNote={false} hidden={this.props.hidden} />
</div>
</HotKeys>
);
@@ -171,7 +177,7 @@ class Notification extends ImmutablePureComponent {
renderMention (notification) {
return (
<StatusContainer
id={notification.get('status')}
id={notification.get("status")}
withDismiss
hidden={this.props.hidden}
onMoveDown={this.handleMoveDown}
@@ -191,20 +197,20 @@ class Notification extends ImmutablePureComponent {
return (
<HotKeys handlers={this.getHandlers()}>
<div className={classNames('notification notification-favourite focusable', { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.favourite, { name: notification.getIn(['account', 'acct']) }), notification.get('created_at'))}>
<div className={classNames("notification notification-favourite focusable", { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.favourite, { name: notification.getIn(["account", "acct"]) }), notification.get("created_at"))}>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<Icon id='star' className='star-icon' fixedWidth />
</div>
<span title={notification.get('created_at')}>
<span title={notification.get("created_at")}>
<FormattedMessage id='notification.favourite' defaultMessage='{name} favorited your status' values={{ name: link }} />
</span>
</div>
<StatusContainer
id={notification.get('status')}
account={notification.get('account')}
id={notification.get("status")}
account={notification.get("account")}
muted
withDismiss
hidden={!!this.props.hidden}
@@ -223,20 +229,20 @@ class Notification extends ImmutablePureComponent {
return (
<HotKeys handlers={this.getHandlers()}>
<div className={classNames('notification notification-reblog focusable', { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.reblog, { name: notification.getIn(['account', 'acct']) }), notification.get('created_at'))}>
<div className={classNames("notification notification-reblog focusable", { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.reblog, { name: notification.getIn(["account", "acct"]) }), notification.get("created_at"))}>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<Icon id='retweet' fixedWidth />
</div>
<span title={notification.get('created_at')}>
<span title={notification.get("created_at")}>
<FormattedMessage id='notification.reblog' defaultMessage='{name} boosted your status' values={{ name: link }} />
</span>
</div>
<StatusContainer
id={notification.get('status')}
account={notification.get('account')}
id={notification.get("status")}
account={notification.get("account")}
muted
withDismiss
hidden={this.props.hidden}
@@ -259,20 +265,20 @@ class Notification extends ImmutablePureComponent {
return (
<HotKeys handlers={this.getHandlers()}>
<div className={classNames('notification notification-status focusable', { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.status, { name: notification.getIn(['account', 'acct']) }), notification.get('created_at'))}>
<div className={classNames("notification notification-status focusable", { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.status, { name: notification.getIn(["account", "acct"]) }), notification.get("created_at"))}>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<Icon id='home' fixedWidth />
</div>
<span title={notification.get('created_at')}>
<span title={notification.get("created_at")}>
<FormattedMessage id='notification.status' defaultMessage='{name} just posted' values={{ name: link }} />
</span>
</div>
<StatusContainer
id={notification.get('status')}
account={notification.get('account')}
id={notification.get("status")}
account={notification.get("account")}
contextType='notifications'
muted
withDismiss
@@ -296,20 +302,20 @@ class Notification extends ImmutablePureComponent {
return (
<HotKeys handlers={this.getHandlers()}>
<div className={classNames('notification notification-update focusable', { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.update, { name: notification.getIn(['account', 'acct']) }), notification.get('created_at'))}>
<div className={classNames("notification notification-update focusable", { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.update, { name: notification.getIn(["account", "acct"]) }), notification.get("created_at"))}>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<Icon id='pencil' fixedWidth />
</div>
<span title={notification.get('created_at')}>
<span title={notification.get("created_at")}>
<FormattedMessage id='notification.update' defaultMessage='{name} edited a post' values={{ name: link }} />
</span>
</div>
<StatusContainer
id={notification.get('status')}
account={notification.get('account')}
id={notification.get("status")}
account={notification.get("account")}
contextType='notifications'
muted
withDismiss
@@ -326,7 +332,7 @@ class Notification extends ImmutablePureComponent {
renderPoll (notification, account) {
const { intl, unread, status } = this.props;
const ownPoll = me === account.get('id');
const ownPoll = me === account.get("id");
const message = ownPoll ? intl.formatMessage(messages.ownPoll) : intl.formatMessage(messages.poll);
if (!status) {
@@ -335,13 +341,13 @@ class Notification extends ImmutablePureComponent {
return (
<HotKeys handlers={this.getHandlers()}>
<div className={classNames('notification notification-poll focusable', { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, message, notification.get('created_at'))}>
<div className={classNames("notification notification-poll focusable", { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, message, notification.get("created_at"))}>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<Icon id='tasks' fixedWidth />
</div>
<span title={notification.get('created_at')}>
<span title={notification.get("created_at")}>
{ownPoll ? (
<FormattedMessage id='notification.own_poll' defaultMessage='Your poll has ended' />
) : (
@@ -351,7 +357,7 @@ class Notification extends ImmutablePureComponent {
</div>
<StatusContainer
id={notification.get('status')}
id={notification.get("status")}
account={account}
contextType='notifications'
muted
@@ -372,18 +378,18 @@ class Notification extends ImmutablePureComponent {
return (
<HotKeys handlers={this.getHandlers()}>
<div className={classNames('notification notification-admin-sign-up focusable', { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.adminSignUp, { name: account.get('acct') }), notification.get('created_at'))}>
<div className={classNames("notification notification-admin-sign-up focusable", { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.adminSignUp, { name: account.get("acct") }), notification.get("created_at"))}>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<Icon id='user-plus' fixedWidth />
</div>
<span title={notification.get('created_at')}>
<span title={notification.get("created_at")}>
<FormattedMessage id='notification.admin.sign_up' defaultMessage='{name} signed up' values={{ name: link }} />
</span>
</div>
<AccountContainer id={account.get('id')} hidden={this.props.hidden} />
<AccountContainer id={account.get("id")} hidden={this.props.hidden} />
</div>
</HotKeys>
);
@@ -396,24 +402,24 @@ class Notification extends ImmutablePureComponent {
return null;
}
const targetAccount = report.get('target_account');
const targetDisplayNameHtml = { __html: targetAccount.get('display_name_html') };
const targetLink = <bdi><Link className='notification__display-name' title={targetAccount.get('acct')} to={`/@${targetAccount.get('acct')}`} dangerouslySetInnerHTML={targetDisplayNameHtml} /></bdi>;
const targetAccount = report.get("target_account");
const targetDisplayNameHtml = { __html: targetAccount.get("display_name_html") };
const targetLink = <bdi><Link className='notification__display-name' title={targetAccount.get("acct")} to={`/@${targetAccount.get("acct")}`} dangerouslySetInnerHTML={targetDisplayNameHtml} /></bdi>;
return (
<HotKeys handlers={this.getHandlers()}>
<div className={classNames('notification notification-admin-report focusable', { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.adminReport, { name: account.get('acct'), target: notification.getIn(['report', 'target_account', 'acct']) }), notification.get('created_at'))}>
<div className={classNames("notification notification-admin-report focusable", { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.adminReport, { name: account.get("acct"), target: notification.getIn(["report", "target_account", "acct"]) }), notification.get("created_at"))}>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<Icon id='flag' fixedWidth />
</div>
<span title={notification.get('created_at')}>
<span title={notification.get("created_at")}>
<FormattedMessage id='notification.admin.report' defaultMessage='{name} reported {target}' values={{ name: link, target: targetLink }} />
</span>
</div>
<Report account={account} report={notification.get('report')} hidden={this.props.hidden} />
<Report account={account} report={notification.get("report")} hidden={this.props.hidden} />
</div>
</HotKeys>
);
@@ -421,31 +427,31 @@ class Notification extends ImmutablePureComponent {
render () {
const { notification } = this.props;
const account = notification.get('account');
const displayNameHtml = { __html: account.get('display_name_html') };
const link = <bdi><Link className='notification__display-name' href={`/@${account.get('acct')}`} title={account.get('acct')} to={`/@${account.get('acct')}`} dangerouslySetInnerHTML={displayNameHtml} /></bdi>;
const account = notification.get("account");
const displayNameHtml = { __html: account.get("display_name_html") };
const link = <bdi><Link className='notification__display-name' href={`/@${account.get("acct")}`} title={account.get("acct")} to={`/@${account.get("acct")}`} dangerouslySetInnerHTML={displayNameHtml} /></bdi>;
switch(notification.get('type')) {
case 'follow':
return this.renderFollow(notification, account, link);
case 'follow_request':
return this.renderFollowRequest(notification, account, link);
case 'mention':
return this.renderMention(notification);
case 'favourite':
return this.renderFavourite(notification, link);
case 'reblog':
return this.renderReblog(notification, link);
case 'status':
return this.renderStatus(notification, link);
case 'update':
return this.renderUpdate(notification, link);
case 'poll':
return this.renderPoll(notification, account);
case 'admin.sign_up':
return this.renderAdminSignUp(notification, account, link);
case 'admin.report':
return this.renderAdminReport(notification, account, link);
switch(notification.get("type")) {
case "follow":
return this.renderFollow(notification, account, link);
case "follow_request":
return this.renderFollowRequest(notification, account, link);
case "mention":
return this.renderMention(notification);
case "favourite":
return this.renderFavourite(notification, link);
case "reblog":
return this.renderReblog(notification, link);
case "status":
return this.renderStatus(notification, link);
case "update":
return this.renderUpdate(notification, link);
case "poll":
return this.renderPoll(notification, account);
case "admin.sign_up":
return this.renderAdminSignUp(notification, account, link);
case "admin.report":
return this.renderAdminReport(notification, account, link);
}
return null;