Skip to content

Commit

Permalink
Merge pull request #1021 from metabrainz/fix-lint-errors
Browse files Browse the repository at this point in the history
Fix linting errors and warnings
  • Loading branch information
MonkeyDo authored Sep 21, 2023
2 parents 41122a8 + 583ab54 commit 3a3ceb6
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/client/components/input/drag-and-drop-image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import PropTypes from 'prop-types';
import React from 'react';


const {useCallback} = React;

/**
Expand Down
21 changes: 17 additions & 4 deletions src/client/components/pages/revision.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,31 @@ class RevisionPage extends React.Component {
let deleteBadge = null;
if (diff.isDeletion) {
if (diff.entityRevision.isMerge) {
mergeBadge = <Badge pill className="merged margin-right-0-5 text-light" title={`This ${diff.entity.type} was merged in this revision`}>Merged</Badge>;
mergeBadge = (
<Badge
pill className="merged margin-right-0-5 text-light"
title={`This ${diff.entity.type} was merged in this revision`}
>Merged
</Badge>);
}
else {
deleteBadge =
<Badge pill className="deletion margin-right-0-5 text-light" title={`This ${diff.entity.type} was deleted in this revision`}>- Deleted</Badge>;
deleteBadge = (
<Badge
pill className="deletion margin-right-0-5 text-light"
title={`This ${diff.entity.type} was deleted in this revision`}
>- Deleted
</Badge>);
}
}
return (
<div key={diff.entity.bbid}>
<h3>
{diff.isNew &&
<Badge pill className="new margin-right-0-5 text-light" title={`This ${diff.entity.type} was created in this revision`}>+ New</Badge>}
<Badge
pill className="new margin-right-0-5 text-light"
title={`This ${diff.entity.type} was created in this revision`}
>+ New
</Badge>}
{mergeBadge}
{deleteBadge}
<EntityLink
Expand Down
7 changes: 4 additions & 3 deletions src/client/entity-editor/work-section/work-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
} from './actions';
import {Col, Form, OverlayTrigger, Row, Tooltip} from 'react-bootstrap';
import type {List, Map} from 'immutable';
import Select, {OptionProps, components} from 'react-select';
import Select, {components} from 'react-select';
import {faArrowTurnUp, faQuestionCircle} from '@fortawesome/free-solid-svg-icons';

import type {Dispatch} from 'redux';
Expand All @@ -45,7 +45,8 @@ type WorkType = {
parentId: number,
childOrder: number,
deprecated: boolean,
depth?: number, // added for display
// added for display
depth?: number,
};

type LanguageOption = {
Expand Down Expand Up @@ -102,7 +103,7 @@ function sortWorkTypes(
return sortedArray;
}

function workTypeSelectMenuOption(props: OptionProps<WorkType, false>) {
function workTypeSelectMenuOption(props: Select.OptionProps<WorkType, false>) {
const {data, label} = props;
const {depth, id, description} = data;
let indentationClass;
Expand Down
6 changes: 3 additions & 3 deletions src/client/helpers/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ export function dateObjectToISOString(value: DateObject) {
export function stringToHTMLWithLinks(content: string) {
// eslint-disable-next-line max-len, no-useless-escape
const urlRegex = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%~*@\.\w_]*)#?(?:[\.\!\/\\:\w]*))?)/g;
content = content.replace(
const replacedContent = content.replace(
urlRegex,
(url) => `<a href="${url.startsWith('www.') ? 'https://' + url : url}" target="_blank">${url}</a>`
(url) => `<a href="${url.startsWith('www.') ? `https://${url}` : url}" target="_blank">${url}</a>`
);
const sanitizedHtml = DOMPurify.sanitize(content, {ADD_ATTR: ['target']});
const sanitizedHtml = DOMPurify.sanitize(replacedContent, {ADD_ATTR: ['target']});
// eslint-disable-next-line react/no-danger
return <span dangerouslySetInnerHTML={{__html: sanitizedHtml}}/>;
}
Expand Down
1 change: 0 additions & 1 deletion src/client/unified-form/submit-tab/summary.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {Badge, ListGroup} from 'react-bootstrap';
import {Entity, State, SummarySectionProps, SummarySectionStateProps} from '../interface/type';
import Immutable from 'immutable';
import React from 'react';
Expand Down
1 change: 0 additions & 1 deletion src/server/helpers/diffFormatters/authorCredit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

import * as base from './base';
import * as set from './set';


Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ router.get('/', async (req, res, next) => {
if (query) {
// get 1 more results to check nextEnabled
const searchResponse = await search.searchByName(orm, query, _snakeCase(type), size + 1, from);
const {results: entities, total} = searchResponse;
const {results: entities} = searchResponse;
searchResults = {
initialResults: entities.filter(entity => !isNil(entity)),
query
Expand Down

0 comments on commit 3a3ceb6

Please sign in to comment.