Skip to content

Commit

Permalink
chore(deps): remove linkifyjs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Oct 2, 2023
1 parent 59e289d commit fe44217
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 42 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"@types/html-to-text": "^8.1.1",
"@types/js-cookie": "^3.0.2",
"@types/jsonwebtoken": "^9.0.0",
"@types/linkifyjs": "^2.1.4",
"@types/lodash": "^4.14.185",
"@types/md5": "^2.3.2",
"@types/minimist": "^1.2.2",
Expand Down Expand Up @@ -148,7 +147,6 @@
"jsonwebtoken": "^9.0.0",
"knex": "^2.4.2",
"lerna": "^6.0.0",
"linkifyjs": "^2.1.9",
"lodash": "^4.17.20",
"mathjax-full": "^3.1.0",
"md5": "^2.3.0",
Expand Down
2 changes: 0 additions & 2 deletions packages/@ourworldindata/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"d3": "^6.1.1",
"dayjs": "^1.11.5",
"json8-pointer": "^1.0.6",
"linkifyjs": "^2.1.9",
"lodash": "^4.17.20",
"mobx": "^5.15.7",
"mobx-react": "5",
Expand All @@ -37,7 +36,6 @@
"@types/d3": "^6",
"@types/d3-format": "^2",
"@types/jest": "^29.0.3",
"@types/linkifyjs": "^2.1.4",
"@types/lodash": "^4.14.185",
"@types/parsimmon": "^1.10.6",
"@types/react": "^16.14.23",
Expand Down
12 changes: 2 additions & 10 deletions packages/@ourworldindata/utils/src/TextWrap/TextWrap.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEmpty, max, stripHTML, linkify } from "../Util.js"
import { isEmpty, max, stripHTML } from "../Util.js"
import { Bounds, FontFamily } from "../Bounds.js"
import { computed } from "mobx"
import React from "react"
Expand All @@ -12,8 +12,6 @@ interface TextWrapProps {
fontSize: FontSize
fontWeight?: number
rawHtml?: boolean
/** Wrap URL-like text in <a> tag. Only works when rendering HTML. */
linkifyText?: boolean
}

interface WrapLine {
Expand Down Expand Up @@ -157,18 +155,12 @@ export class TextWrap {
return (
<span>
{lines.map((line, index) => {
const content = this.props.rawHtml ? (
const content = props.rawHtml ? (
<span
dangerouslySetInnerHTML={{
__html: line.text,
}}
/>
) : props.linkifyText ? (
<span
dangerouslySetInnerHTML={{
__html: linkify(line.text),
}}
/>
) : (
<span>{line.text}</span>
)
Expand Down
3 changes: 0 additions & 3 deletions packages/@ourworldindata/utils/src/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ import dayjs from "./dayjs.js"
import { formatLocale, FormatLocaleObject } from "d3-format"
import striptags from "striptags"
import parseUrl from "url-parse"
import linkifyHtml from "linkifyjs/html.js"
import {
SortOrder,
Integer,
Expand Down Expand Up @@ -888,8 +887,6 @@ export function keyMap<Key, Value>(
return result
}

export const linkify = (str: string): string => linkifyHtml(str)

export const oneOf = <T>(value: unknown, options: T[], defaultOption: T): T => {
for (const option of options) {
if (value === option) return option
Expand Down
1 change: 0 additions & 1 deletion packages/@ourworldindata/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ export {
rollingMap,
groupMap,
keyMap,
linkify,
oneOf,
intersectionOfSets,
unionOfSets,
Expand Down
24 changes: 0 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4955,7 +4955,6 @@ __metadata:
"@types/d3": ^6
"@types/d3-format": ^2
"@types/jest": ^29.0.3
"@types/linkifyjs": ^2.1.4
"@types/lodash": ^4.14.185
"@types/parsimmon": ^1.10.6
"@types/react": ^16.14.23
Expand All @@ -4968,7 +4967,6 @@ __metadata:
eslint-plugin-react-hooks: ^4.6.0
jest: ^29.0.3
json8-pointer: ^1.0.6
linkifyjs: ^2.1.9
lodash: ^4.17.20
mobx: ^5.15.7
mobx-react: 5
Expand Down Expand Up @@ -5997,15 +5995,6 @@ __metadata:
languageName: node
linkType: hard

"@types/linkifyjs@npm:^2.1.4":
version: 2.1.4
resolution: "@types/linkifyjs@npm:2.1.4"
dependencies:
"@types/react": "*"
checksum: 8381e7b9590b4f59fd1d690c827a34f212d1e55e3463b4750ab6ff16f6bf29e2b66d552f2eb95a3f353a1cbf2740be59fbdebb1efb53b8392795728c2e9e6a50
languageName: node
linkType: hard

"@types/lodash@npm:^4.14.185":
version: 4.14.185
resolution: "@types/lodash@npm:4.14.185"
Expand Down Expand Up @@ -13875,7 +13864,6 @@ __metadata:
"@types/js-cookie": ^3.0.2
"@types/js-yaml": ^4.0.5
"@types/jsonwebtoken": ^9.0.0
"@types/linkifyjs": ^2.1.4
"@types/lodash": ^4.14.185
"@types/md5": ^2.3.2
"@types/minimist": ^1.2.2
Expand Down Expand Up @@ -13958,7 +13946,6 @@ __metadata:
jsonwebtoken: ^9.0.0
knex: ^2.4.2
lerna: ^6.0.0
linkifyjs: ^2.1.9
lodash: ^4.17.20
mathjax-full: ^3.1.0
md5: ^2.3.0
Expand Down Expand Up @@ -16792,17 +16779,6 @@ __metadata:
languageName: node
linkType: hard

"linkifyjs@npm:^2.1.9":
version: 2.1.9
resolution: "linkifyjs@npm:2.1.9"
peerDependencies:
jquery: ">= 1.11.0"
react: ">= 0.14.0"
react-dom: ">= 0.14.0"
checksum: 0ddb6eca62464f01075a0c9f9faf916e29ea67b4dd58e79157d34925a1ce647a705ec5a047573fabfbc15df9fa56e0d1c755e641ee425015217e940420a55556
languageName: node
linkType: hard

"listr-silent-renderer@npm:^1.1.1":
version: 1.1.1
resolution: "listr-silent-renderer@npm:1.1.1"
Expand Down

0 comments on commit fe44217

Please sign in to comment.