[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,6 +1,6 @@
import PropTypes from 'prop-types';
import PropTypes from "prop-types";
import { FormattedMessage } from 'react-intl';
import { FormattedMessage } from "react-intl";
export const SearchSection = ({ title, onClickMore, children }) => (
<div className='search-results__section'>
@@ -1,15 +1,15 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import PropTypes from "prop-types";
import { PureComponent } from "react";
import { FormattedMessage } from 'react-intl';
import { FormattedMessage } from "react-intl";
import classNames from 'classnames';
import classNames from "classnames";
import { Blurhash } from 'mastodon/components/blurhash';
import { accountsCountRenderer } from 'mastodon/components/hashtag';
import { RelativeTimestamp } from 'mastodon/components/relative_timestamp';
import { ShortNumber } from 'mastodon/components/short_number';
import { Skeleton } from 'mastodon/components/skeleton';
import { Blurhash } from "mastodon/components/blurhash";
import { accountsCountRenderer } from "mastodon/components/hashtag";
import { RelativeTimestamp } from "mastodon/components/relative_timestamp";
import { ShortNumber } from "mastodon/components/short_number";
import { Skeleton } from "mastodon/components/skeleton";
export default class Story extends PureComponent {
@@ -39,17 +39,17 @@ export default class Story extends PureComponent {
const { thumbnailLoaded } = this.state;
return (
<a className={classNames('story', { expanded })} href={url} target='blank' rel='noopener'>
<a className={classNames("story", { expanded })} href={url} target='blank' rel='noopener'>
<div className='story__details'>
<div className='story__details__publisher'>{publisher ? <span lang={lang}>{publisher}</span> : <Skeleton width={50} />}{publishedAt && <> · <RelativeTimestamp timestamp={publishedAt} /></>}</div>
<div className='story__details__title' lang={lang}>{title ? title : <Skeleton />}</div>
<div className='story__details__shared'>{author && <><FormattedMessage id='link_preview.author' defaultMessage='By {name}' values={{ name: <strong>{author}</strong> }} /> · </>}{typeof sharedTimes === 'number' ? <ShortNumber value={sharedTimes} renderer={accountsCountRenderer} /> : <Skeleton width={100} />}</div>
<div className='story__details__shared'>{author && <><FormattedMessage id='link_preview.author' defaultMessage='By {name}' values={{ name: <strong>{author}</strong> }} /> · </>}{typeof sharedTimes === "number" ? <ShortNumber value={sharedTimes} renderer={accountsCountRenderer} /> : <Skeleton width={100} />}</div>
</div>
<div className='story__thumbnail'>
{thumbnail ? (
<>
<div className={classNames('story__thumbnail__preview', { 'story__thumbnail__preview--hidden': thumbnailLoaded })}><Blurhash hash={blurhash} /></div>
<div className={classNames("story__thumbnail__preview", { "story__thumbnail__preview--hidden": thumbnailLoaded })}><Blurhash hash={blurhash} /></div>
<img src={thumbnail} onLoad={this.handleImageLoad} alt={thumbnailDescription} title={thumbnailDescription} lang={lang} />
</>
) : <Skeleton />}
@@ -1,32 +1,32 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import PropTypes from "prop-types";
import { PureComponent } from "react";
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { defineMessages, injectIntl, FormattedMessage } from "react-intl";
import { Helmet } from 'react-helmet';
import { NavLink, Switch, Route } from 'react-router-dom';
import { Helmet } from "react-helmet";
import { NavLink, Switch, Route } from "react-router-dom";
import { connect } from 'react-redux';
import { connect } from "react-redux";
import Column from 'mastodon/components/column';
import ColumnHeader from 'mastodon/components/column_header';
import Search from 'mastodon/features/compose/containers/search_container';
import { trendsEnabled } from 'mastodon/initial_state';
import Column from "mastodon/components/column";
import ColumnHeader from "mastodon/components/column_header";
import Search from "mastodon/features/compose/containers/search_container";
import { trendsEnabled } from "mastodon/initial_state";
import Links from './links';
import SearchResults from './results';
import Statuses from './statuses';
import Suggestions from './suggestions';
import Tags from './tags';
import Links from "./links";
import SearchResults from "./results";
import Statuses from "./statuses";
import Suggestions from "./suggestions";
import Tags from "./tags";
const messages = defineMessages({
title: { id: 'explore.title', defaultMessage: 'Explore' },
searchResults: { id: 'explore.search_results', defaultMessage: 'Search results' },
title: { id: "explore.title", defaultMessage: "Explore" },
searchResults: { id: "explore.search_results", defaultMessage: "Search results" },
});
const mapStateToProps = state => ({
layout: state.getIn(['meta', 'layout']),
isSearching: state.getIn(['search', 'submitted']) || !trendsEnabled,
layout: state.getIn(["meta", "layout"]),
isSearching: state.getIn(["search", "submitted"]) || !trendsEnabled,
});
class Explore extends PureComponent {
@@ -57,7 +57,7 @@ class Explore extends PureComponent {
return (
<Column bindToDocument={!multiColumn} ref={this.setRef} label={intl.formatMessage(messages.title)}>
<ColumnHeader
icon={isSearching ? 'search' : 'hashtag'}
icon={isSearching ? "search" : "hashtag"}
title={intl.formatMessage(isSearching ? messages.searchResults : messages.title)}
onClick={this.handleHeaderClick}
multiColumn={multiColumn}
@@ -95,14 +95,14 @@ class Explore extends PureComponent {
<Route path='/explore/tags' component={Tags} />
<Route path='/explore/links' component={Links} />
<Route path='/explore/suggestions' component={Suggestions} />
<Route exact path={['/explore', '/explore/posts', '/search']}>
<Route exact path={["/explore", "/explore/posts", "/search"]}>
<Statuses multiColumn={multiColumn} />
</Route>
</Switch>
<Helmet>
<title>{intl.formatMessage(messages.title)}</title>
<meta name='robots' content={isSearching ? 'noindex' : 'all'} />
<meta name='robots' content={isSearching ? "noindex" : "all"} />
</Helmet>
</>
)}
@@ -1,20 +1,20 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import PropTypes from "prop-types";
import { PureComponent } from "react";
import { FormattedMessage } from 'react-intl';
import { FormattedMessage } from "react-intl";
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import ImmutablePropTypes from "react-immutable-proptypes";
import { connect } from "react-redux";
import { fetchTrendingLinks } from 'mastodon/actions/trends';
import { DismissableBanner } from 'mastodon/components/dismissable_banner';
import { LoadingIndicator } from 'mastodon/components/loading_indicator';
import { fetchTrendingLinks } from "mastodon/actions/trends";
import { DismissableBanner } from "mastodon/components/dismissable_banner";
import { LoadingIndicator } from "mastodon/components/loading_indicator";
import Story from './components/story';
import Story from "./components/story";
const mapStateToProps = state => ({
links: state.getIn(['trends', 'links', 'items']),
isLoading: state.getIn(['trends', 'links', 'isLoading']),
links: state.getIn(["trends", "links", "items"]),
isLoading: state.getIn(["trends", "links", "isLoading"]),
});
class Links extends PureComponent {
@@ -57,18 +57,18 @@ class Links extends PureComponent {
{isLoading ? (<LoadingIndicator />) : links.map((link, i) => (
<Story
key={link.get('id')}
key={link.get("id")}
expanded={i === 0}
lang={link.get('language')}
url={link.get('url')}
title={link.get('title')}
publisher={link.get('provider_name')}
publishedAt={link.get('published_at')}
author={link.get('author_name')}
sharedTimes={link.getIn(['history', 0, 'accounts']) * 1 + link.getIn(['history', 1, 'accounts']) * 1}
thumbnail={link.get('image')}
thumbnailDescription={link.get('image_description')}
blurhash={link.get('blurhash')}
lang={link.get("language")}
url={link.get("url")}
title={link.get("title")}
publisher={link.get("provider_name")}
publishedAt={link.get("published_at")}
author={link.get("author_name")}
sharedTimes={link.getIn(["history", 0, "accounts"]) * 1 + link.getIn(["history", 1, "accounts"]) * 1}
thumbnail={link.get("image")}
thumbnailDescription={link.get("image_description")}
blurhash={link.get("blurhash")}
/>
))}
</div>
@@ -1,32 +1,32 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import PropTypes from "prop-types";
import { PureComponent } from "react";
import { injectIntl, defineMessages, FormattedMessage } from 'react-intl';
import { injectIntl, defineMessages, FormattedMessage } from "react-intl";
import { Helmet } from 'react-helmet';
import { Helmet } from "react-helmet";
import { List as ImmutableList } from 'immutable';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import { List as ImmutableList } from "immutable";
import ImmutablePropTypes from "react-immutable-proptypes";
import { connect } from "react-redux";
import { submitSearch, expandSearch } from 'mastodon/actions/search';
import { ImmutableHashtag as Hashtag } from 'mastodon/components/hashtag';
import { Icon } from 'mastodon/components/icon';
import ScrollableList from 'mastodon/components/scrollable_list';
import Account from 'mastodon/containers/account_container';
import Status from 'mastodon/containers/status_container';
import { submitSearch, expandSearch } from "mastodon/actions/search";
import { ImmutableHashtag as Hashtag } from "mastodon/components/hashtag";
import { Icon } from "mastodon/components/icon";
import ScrollableList from "mastodon/components/scrollable_list";
import Account from "mastodon/containers/account_container";
import Status from "mastodon/containers/status_container";
import { SearchSection } from './components/search_section';
import { SearchSection } from "./components/search_section";
const messages = defineMessages({
title: { id: 'search_results.title', defaultMessage: 'Search for {q}' },
title: { id: "search_results.title", defaultMessage: "Search for {q}" },
});
const mapStateToProps = state => ({
isLoading: state.getIn(['search', 'isLoading']),
results: state.getIn(['search', 'results']),
q: state.getIn(['search', 'searchTerm']),
submittedType: state.getIn(['search', 'type']),
isLoading: state.getIn(["search", "isLoading"]),
results: state.getIn(["search", "results"]),
q: state.getIn(["search", "searchTerm"]),
submittedType: state.getIn(["search", "type"]),
});
const INITIAL_PAGE_LIMIT = 10;
@@ -45,7 +45,7 @@ const renderAccounts = accounts => hidePeek(accounts).map(id => (
));
const renderHashtags = hashtags => hidePeek(hashtags).map(hashtag => (
<Hashtag key={hashtag.get('name')} hashtag={hashtag} />
<Hashtag key={hashtag.get("name")} hashtag={hashtag} />
));
const renderStatuses = statuses => hidePeek(statuses).map(id => (
@@ -65,17 +65,17 @@ class Results extends PureComponent {
dispatch: PropTypes.func.isRequired,
q: PropTypes.string,
intl: PropTypes.object,
submittedType: PropTypes.oneOf(['accounts', 'statuses', 'hashtags']),
submittedType: PropTypes.oneOf(["accounts", "statuses", "hashtags"]),
};
state = {
type: this.props.submittedType || 'all',
type: this.props.submittedType || "all",
};
static getDerivedStateFromProps(props, state) {
if (props.submittedType !== state.type) {
return {
type: props.submittedType || 'all',
type: props.submittedType || "all",
};
}
@@ -91,7 +91,7 @@ class Results extends PureComponent {
dispatch(submitSearch());
}
this.setState({ type: 'all' });
this.setState({ type: "all" });
};
handleSelectAccounts = () => {
@@ -99,11 +99,11 @@ class Results extends PureComponent {
// If we originally searched for something else (but not everything),
// we need to resubmit the query for this specific type
if (submittedType !== 'accounts') {
dispatch(submitSearch('accounts'));
if (submittedType !== "accounts") {
dispatch(submitSearch("accounts"));
}
this.setState({ type: 'accounts' });
this.setState({ type: "accounts" });
};
handleSelectHashtags = () => {
@@ -111,11 +111,11 @@ class Results extends PureComponent {
// If we originally searched for something else (but not everything),
// we need to resubmit the query for this specific type
if (submittedType !== 'hashtags') {
dispatch(submitSearch('hashtags'));
if (submittedType !== "hashtags") {
dispatch(submitSearch("hashtags"));
}
this.setState({ type: 'hashtags' });
this.setState({ type: "hashtags" });
};
handleSelectStatuses = () => {
@@ -123,16 +123,16 @@ class Results extends PureComponent {
// If we originally searched for something else (but not everything),
// we need to resubmit the query for this specific type
if (submittedType !== 'statuses') {
dispatch(submitSearch('statuses'));
if (submittedType !== "statuses") {
dispatch(submitSearch("statuses"));
}
this.setState({ type: 'statuses' });
this.setState({ type: "statuses" });
};
handleLoadMoreAccounts = () => this._loadMore('accounts');
handleLoadMoreStatuses = () => this._loadMore('statuses');
handleLoadMoreHashtags = () => this._loadMore('hashtags');
handleLoadMoreAccounts = () => this._loadMore("accounts");
handleLoadMoreStatuses = () => this._loadMore("statuses");
handleLoadMoreHashtags = () => this._loadMore("hashtags");
_loadMore (type) {
const { dispatch } = this.props;
@@ -142,7 +142,7 @@ class Results extends PureComponent {
handleLoadMore = () => {
const { type } = this.state;
if (type !== 'all') {
if (type !== "all") {
this._loadMore(type);
}
};
@@ -152,56 +152,56 @@ class Results extends PureComponent {
const { type } = this.state;
// We request 1 more result than we display so we can tell if there'd be a next page
const hasMore = type !== 'all' ? results.get(type, ImmutableList()).size > INITIAL_PAGE_LIMIT && results.get(type).size % INITIAL_PAGE_LIMIT === 1 : false;
const hasMore = type !== "all" ? results.get(type, ImmutableList()).size > INITIAL_PAGE_LIMIT && results.get(type).size % INITIAL_PAGE_LIMIT === 1 : false;
let filteredResults;
const accounts = results.get('accounts', ImmutableList());
const hashtags = results.get('hashtags', ImmutableList());
const statuses = results.get('statuses', ImmutableList());
const accounts = results.get("accounts", ImmutableList());
const hashtags = results.get("hashtags", ImmutableList());
const statuses = results.get("statuses", ImmutableList());
switch(type) {
case 'all':
filteredResults = (accounts.size + hashtags.size + statuses.size) > 0 ? (
<>
{accounts.size > 0 && (
<SearchSection key='accounts' title={<><Icon id='users' fixedWidth /><FormattedMessage id='search_results.accounts' defaultMessage='Profiles' /></>} onClickMore={this.handleLoadMoreAccounts}>
{accounts.take(INITIAL_DISPLAY).map(id => <Account key={id} id={id} />)}
</SearchSection>
)}
case "all":
filteredResults = (accounts.size + hashtags.size + statuses.size) > 0 ? (
<>
{accounts.size > 0 && (
<SearchSection key='accounts' title={<><Icon id='users' fixedWidth /><FormattedMessage id='search_results.accounts' defaultMessage='Profiles' /></>} onClickMore={this.handleLoadMoreAccounts}>
{accounts.take(INITIAL_DISPLAY).map(id => <Account key={id} id={id} />)}
</SearchSection>
)}
{hashtags.size > 0 && (
<SearchSection key='hashtags' title={<><Icon id='hashtag' fixedWidth /><FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' /></>} onClickMore={this.handleLoadMoreHashtags}>
{hashtags.take(INITIAL_DISPLAY).map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)}
</SearchSection>
)}
{hashtags.size > 0 && (
<SearchSection key='hashtags' title={<><Icon id='hashtag' fixedWidth /><FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' /></>} onClickMore={this.handleLoadMoreHashtags}>
{hashtags.take(INITIAL_DISPLAY).map(hashtag => <Hashtag key={hashtag.get("name")} hashtag={hashtag} />)}
</SearchSection>
)}
{statuses.size > 0 && (
<SearchSection key='statuses' title={<><Icon id='quote-right' fixedWidth /><FormattedMessage id='search_results.statuses' defaultMessage='Posts' /></>} onClickMore={this.handleLoadMoreStatuses}>
{statuses.take(INITIAL_DISPLAY).map(id => <Status key={id} id={id} />)}
</SearchSection>
)}
</>
) : [];
break;
case 'accounts':
filteredResults = renderAccounts(accounts);
break;
case 'hashtags':
filteredResults = renderHashtags(hashtags);
break;
case 'statuses':
filteredResults = renderStatuses(statuses);
break;
{statuses.size > 0 && (
<SearchSection key='statuses' title={<><Icon id='quote-right' fixedWidth /><FormattedMessage id='search_results.statuses' defaultMessage='Posts' /></>} onClickMore={this.handleLoadMoreStatuses}>
{statuses.take(INITIAL_DISPLAY).map(id => <Status key={id} id={id} />)}
</SearchSection>
)}
</>
) : [];
break;
case "accounts":
filteredResults = renderAccounts(accounts);
break;
case "hashtags":
filteredResults = renderHashtags(hashtags);
break;
case "statuses":
filteredResults = renderStatuses(statuses);
break;
}
return (
<>
<div className='account__section-headline'>
<button onClick={this.handleSelectAll} className={type === 'all' ? 'active' : undefined}><FormattedMessage id='search_results.all' defaultMessage='All' /></button>
<button onClick={this.handleSelectAccounts} className={type === 'accounts' ? 'active' : undefined}><FormattedMessage id='search_results.accounts' defaultMessage='Profiles' /></button>
<button onClick={this.handleSelectHashtags} className={type === 'hashtags' ? 'active' : undefined}><FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' /></button>
<button onClick={this.handleSelectStatuses} className={type === 'statuses' ? 'active' : undefined}><FormattedMessage id='search_results.statuses' defaultMessage='Posts' /></button>
<button onClick={this.handleSelectAll} className={type === "all" ? "active" : undefined}><FormattedMessage id='search_results.all' defaultMessage='All' /></button>
<button onClick={this.handleSelectAccounts} className={type === "accounts" ? "active" : undefined}><FormattedMessage id='search_results.accounts' defaultMessage='Profiles' /></button>
<button onClick={this.handleSelectHashtags} className={type === "hashtags" ? "active" : undefined}><FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' /></button>
<button onClick={this.handleSelectStatuses} className={type === "statuses" ? "active" : undefined}><FormattedMessage id='search_results.statuses' defaultMessage='Posts' /></button>
</div>
<div className='explore__search-results' data-nosnippet>
@@ -1,22 +1,22 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import PropTypes from "prop-types";
import { PureComponent } from "react";
import { FormattedMessage } from 'react-intl';
import { FormattedMessage } from "react-intl";
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import ImmutablePropTypes from "react-immutable-proptypes";
import { connect } from "react-redux";
import { debounce } from 'lodash';
import { debounce } from "lodash";
import { fetchTrendingStatuses, expandTrendingStatuses } from 'mastodon/actions/trends';
import { DismissableBanner } from 'mastodon/components/dismissable_banner';
import StatusList from 'mastodon/components/status_list';
import { getStatusList } from 'mastodon/selectors';
import { fetchTrendingStatuses, expandTrendingStatuses } from "mastodon/actions/trends";
import { DismissableBanner } from "mastodon/components/dismissable_banner";
import StatusList from "mastodon/components/status_list";
import { getStatusList } from "mastodon/selectors";
const mapStateToProps = state => ({
statusIds: getStatusList(state, 'trending'),
isLoading: state.getIn(['status_lists', 'trending', 'isLoading'], true),
hasMore: !!state.getIn(['status_lists', 'trending', 'next']),
statusIds: getStatusList(state, "trending"),
isLoading: state.getIn(["status_lists", "trending", "isLoading"], true),
hasMore: !!state.getIn(["status_lists", "trending", "next"]),
});
class Statuses extends PureComponent {
@@ -1,18 +1,18 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import PropTypes from "prop-types";
import { PureComponent } from "react";
import { FormattedMessage } from 'react-intl';
import { FormattedMessage } from "react-intl";
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import ImmutablePropTypes from "react-immutable-proptypes";
import { connect } from "react-redux";
import { fetchSuggestions } from 'mastodon/actions/suggestions';
import { LoadingIndicator } from 'mastodon/components/loading_indicator';
import AccountCard from 'mastodon/features/directory/components/account_card';
import { fetchSuggestions } from "mastodon/actions/suggestions";
import { LoadingIndicator } from "mastodon/components/loading_indicator";
import AccountCard from "mastodon/features/directory/components/account_card";
const mapStateToProps = state => ({
suggestions: state.getIn(['suggestions', 'items']),
isLoading: state.getIn(['suggestions', 'isLoading']),
suggestions: state.getIn(["suggestions", "items"]),
isLoading: state.getIn(["suggestions", "isLoading"]),
});
class Suggestions extends PureComponent {
@@ -44,7 +44,7 @@ class Suggestions extends PureComponent {
return (
<div className='explore__suggestions scrollable' data-nosnippet>
{isLoading ? <LoadingIndicator /> : suggestions.map(suggestion => (
<AccountCard key={suggestion.get('account')} id={suggestion.get('account')} />
<AccountCard key={suggestion.get("account")} id={suggestion.get("account")} />
))}
</div>
);
@@ -1,19 +1,19 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import PropTypes from "prop-types";
import { PureComponent } from "react";
import { FormattedMessage } from 'react-intl';
import { FormattedMessage } from "react-intl";
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import ImmutablePropTypes from "react-immutable-proptypes";
import { connect } from "react-redux";
import { fetchTrendingHashtags } from 'mastodon/actions/trends';
import { DismissableBanner } from 'mastodon/components/dismissable_banner';
import { ImmutableHashtag as Hashtag } from 'mastodon/components/hashtag';
import { LoadingIndicator } from 'mastodon/components/loading_indicator';
import { fetchTrendingHashtags } from "mastodon/actions/trends";
import { DismissableBanner } from "mastodon/components/dismissable_banner";
import { ImmutableHashtag as Hashtag } from "mastodon/components/hashtag";
import { LoadingIndicator } from "mastodon/components/loading_indicator";
const mapStateToProps = state => ({
hashtags: state.getIn(['trends', 'tags', 'items']),
isLoadingHashtags: state.getIn(['trends', 'tags', 'isLoading']),
hashtags: state.getIn(["trends", "tags", "items"]),
isLoadingHashtags: state.getIn(["trends", "tags", "isLoading"]),
});
class Tags extends PureComponent {
@@ -55,7 +55,7 @@ class Tags extends PureComponent {
{banner}
{isLoading ? (<LoadingIndicator />) : hashtags.map(hashtag => (
<Hashtag key={hashtag.get('name')} hashtag={hashtag} />
<Hashtag key={hashtag.get("name")} hashtag={hashtag} />
))}
</div>
);