Skip to content

Commit

Permalink
feat: use graphemer instead of grapheme-splitter (#7069)
Browse files Browse the repository at this point in the history
  • Loading branch information
oceandrama committed Jun 28, 2023
1 parent f74862c commit faea3ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 1 addition & 2 deletions packages/eslint-plugin/package.json
Expand Up @@ -49,7 +49,7 @@
"@typescript-eslint/type-utils": "5.60.1",
"@typescript-eslint/utils": "5.60.1",
"debug": "^4.3.4",
"grapheme-splitter": "^1.0.4",
"graphemer": "^1.4.0",
"ignore": "^5.2.0",
"natural-compare-lite": "^1.4.0",
"semver": "^7.3.7",
Expand All @@ -63,7 +63,6 @@
"@types/prettier": "*",
"chalk": "^5.0.1",
"cross-fetch": "^3.1.5",
"grapheme-splitter": "^1.0.4",
"json-schema": "*",
"markdown-table": "^3.0.2",
"marked": "^4.0.15",
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin/src/util/getStringLength.ts
@@ -1,6 +1,6 @@
import GraphemeSplitter from 'grapheme-splitter';
import Graphemer from 'graphemer';

let splitter: GraphemeSplitter;
let splitter: Graphemer;

function isASCII(value: string): boolean {
return /^[\u0020-\u007f]*$/u.test(value);
Expand All @@ -11,7 +11,7 @@ export function getStringLength(value: string): number {
return value.length;
}

splitter ??= new GraphemeSplitter();
splitter ??= new Graphemer();

return splitter.countGraphemes(value);
}
5 changes: 5 additions & 0 deletions yarn.lock
Expand Up @@ -8343,6 +8343,11 @@ grapheme-splitter@^1.0.4:
resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e"
integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==

graphemer@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6"
integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==

gray-matter@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/gray-matter/-/gray-matter-4.0.3.tgz#e893c064825de73ea1f5f7d88c7a9f7274288798"
Expand Down

0 comments on commit faea3ff

Please sign in to comment.