Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(website): migrate from lzstring.ts to lz-string package #6727

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"json-schema-to-typescript": "^11.0.1",
"json5": "^2.2.1",
"konamimojisplosion": "^0.5.1",
"lzstring.ts": "^2.0.2",
"lz-string": "^1.5.0",
"prettier": "*",
"prism-react-renderer": "^1.3.3",
"react": "^18.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/website/plugins/generated-rule-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as fs from 'fs';
import type { JSONSchema7 } from 'json-schema';
import type { JSONSchema } from 'json-schema-to-typescript';
import { compile } from 'json-schema-to-typescript';
import * as lz from 'lzstring.ts';
import * as lz from 'lz-string';
import type * as mdast from 'mdast';
import { EOL } from 'os';
import * as path from 'path';
Expand Down Expand Up @@ -417,7 +417,7 @@ export const generatedRuleDocs: Plugin = () => {
};

function convertToPlaygroundHash(eslintrc: string): string {
return lz.LZString.compressToEncodedURIComponent(eslintrc);
return lz.compressToEncodedURIComponent(eslintrc);
}

function nodeIsHeading(node: unist.Node): node is mdast.Heading {
Expand Down
6 changes: 3 additions & 3 deletions packages/website/src/components/hooks/useHashState.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { toJsonConfig } from '@site/src/components/config/utils';
import * as lz from 'lzstring.ts';
import * as lz from 'lz-string';
import { useCallback, useEffect, useState } from 'react';

import { hasOwnProperty } from '../lib/has-own-property';
import { shallowEqual } from '../lib/shallowEqual';
import type { ConfigModel } from '../types';

function writeQueryParam(value: string): string {
return lz.LZString.compressToEncodedURIComponent(value);
return lz.compressToEncodedURIComponent(value);
}

function readQueryParam(value: string | null, fallback: string): string {
return value
? lz.LZString.decompressFromEncodedURIComponent(value) ?? fallback
? lz.decompressFromEncodedURIComponent(value) ?? fallback
: fallback;
}

Expand Down
12 changes: 5 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9817,12 +9817,10 @@ lru-queue@^0.1.0:
dependencies:
es5-ext "~0.10.2"

lzstring.ts@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/lzstring.ts/-/lzstring.ts-2.0.2.tgz#1d269bd6ab423713f31e614f67018110ed860129"
integrity sha512-SEDSYQ3gNrGOdqWcXDO6OU/j3E/ff0WfndKOED4WV0oxDzgf4vijuIwbEE/m0f1LGuTbwH3jVHcwrLdRbQqh3A==
dependencies:
tslib "^1.10.0"
lz-string@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941"
integrity sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==

magic-string@0.25.9, magic-string@^0.25.0, magic-string@^0.25.7:
version "0.25.9"
Expand Down Expand Up @@ -13527,7 +13525,7 @@ tsconfig-paths@^4.1.2:
minimist "^1.2.6"
strip-bom "^3.0.0"

tslib@^1.10.0, tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0:
tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
Expand Down