Skip to content

Commit 5ee8a30

Browse files
committed
fix(lint): Bump lint deps, fix errors
1 parent ff96bd0 commit 5ee8a30

6 files changed

Lines changed: 362 additions & 448 deletions

File tree

package-lock.json

Lines changed: 348 additions & 430 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
],
2424
"devDependencies": {
2525
"@types/jest": "^26.0.0",
26-
"@types/node": "^14.0.6",
27-
"@typescript-eslint/eslint-plugin": "^2.31.0",
28-
"@typescript-eslint/parser": "^2.31.0",
26+
"@types/node": "^14.11.8",
27+
"@typescript-eslint/eslint-plugin": "^4.4.1",
28+
"@typescript-eslint/parser": "^4.4.1",
2929
"coveralls": "*",
30-
"eslint": "^7.0.0",
30+
"eslint": "^7.11.0",
3131
"eslint-config-prettier": "^6.0.0",
3232
"eslint-plugin-node": "^11.1.0",
33-
"jest": "^26.0.1",
33+
"jest": "^26.5.3",
3434
"prettier": "^2.0.5",
3535
"ts-jest": "^26.1.0",
3636
"typescript": "^4.0.2"

scripts/benchmark.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
/* eslint-disable node/no-missing-import */
12
import * as entities from "../";
23
import he from "he";
3-
// @ts-ignore
4-
import htmlEscaper from "html-escaper";
54
import parseEntities from "parse-entities";
65
import * as htmlEntities from "html-entities";
76

@@ -10,8 +9,6 @@ const RUNS = 1e7;
109
const encoders: [string, (str: string) => string][] = [
1110
["entities", (str: string) => entities.encodeHTML(str)],
1211
["he", (str: string) => he.encode(str)],
13-
// Only escapes the source.
14-
// ["html-escaper", (str: string) => htmlEscaper.escape(str)],
1512
[
1613
"html-entities",
1714
(str: string) => htmlEntities.AllHtmlEntities.encode(str),
@@ -21,22 +18,21 @@ const encoders: [string, (str: string) => string][] = [
2118
const decoders: [string, (str: string) => string][] = [
2219
["entities", (str: string) => entities.decodeHTML(str)],
2320
["he", (str: string) => he.decode(str)],
24-
// html-escaper does not produce correct output
25-
// ["html-escaper", (str: string) => htmlEscaper.unescape(str)],
2621
["parse-entities", (str: string) => parseEntities(str)],
2722
[
2823
"html-entities",
2924
(str: string) => htmlEntities.AllHtmlEntities.decode(str),
3025
],
3126
];
3227

33-
// Note: Not shown on the README, as `entities` differs in behavior from other libraries.
34-
// `entities` produces ASCII output, while other libraries only escape characters.
28+
/*
29+
* Note: Not shown on the README, as `entities` differs in behavior from other libraries.
30+
* `entities` produces ASCII output, while other libraries only escape characters.
31+
*/
3532
const escapers: [string, (str: string) => string][] = [
3633
["entities", (str: string) => entities.encodeXML(str)],
3734
["he", (str: string) => he.escape(str)],
38-
["html-escaper", (str: string) => htmlEscaper.escape(str)],
39-
// html-entities cannot escape, so we use its simplest mode.
35+
// Html-entities cannot escape, so we use its simplest mode.
4036
["html-entities", (str: string) => htmlEntities.XmlEntities.encode(str)],
4137
];
4238

src/decode_codepoint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import decodeMap from "./maps/decode.json";
22

33
// Modified version of https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119
4-
export default function decodeCodePoint(codePoint: number) {
4+
export default function decodeCodePoint(codePoint: number): string {
55
if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
66
return "\uFFFD";
77
}

src/encode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function getInverse(inverse: MapType, re: RegExp) {
7878

7979
const reXmlChars = getInverseReplacer(inverseXML);
8080

81-
export function escape(data: string) {
81+
export function escape(data: string): string {
8282
return data
8383
.replace(reXmlChars, singleCharReplacer)
8484
.replace(reNonASCII, singleCharReplacer);

tsconfig.eslint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"extends": "./tsconfig.json",
3-
"include": ["src"],
3+
"include": ["src", "scripts"],
44
"exclude": []
55
}

0 commit comments

Comments
 (0)