Remove useless u flags in regular expressions (#18509)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-12-21 23:44:08 +08:00
1 parent 97f2e81d06
commit c9eb4bcd9e
131 files changed
+388 -405

No files matched your search

+2 -2
View File
@@ -1,11 +1,11 @@
import { Teleport } from "vue";
export default function VersionLink({ version }) {
const match = version.match(/^pr-(\d+)$/u);
const match = version.match(/^pr-(\d+)$/);
let href;
if (match) {
href = `pull/${match[1]}`;
} else if (/\.0$/u.test(version)) {
} else if (/\.0$/.test(version)) {
href = `releases/tag/${version}`;
} else {
href = `blob/main/CHANGELOG.md#${version.replaceAll(".", "")}`;
+1 -1
View File
@@ -48,7 +48,7 @@ function getRandomElement(array) {
}
function camelCase(string) {
return string.replaceAll(/_(\w)/gu, (_, c) => c.toUpperCase());
return string.replaceAll(/_(\w)/g, (_, c) => c.toUpperCase());
}
export default function generateDummyId() {
+1 -1
View File
@@ -123,7 +123,7 @@ function augmentOption(option) {
option.cliName =
"--" +
(option.inverted ? "no-" : "") +
option.name.replaceAll(/(?<=[a-z])(?=[A-Z])/gu, "-").toLowerCase();
option.name.replaceAll(/(?<=[a-z])(?=[A-Z])/g, "-").toLowerCase();
return option;
}
+1 -1
View File
@@ -71,7 +71,7 @@ function formatCLIOptions(cliOptions) {
}
function codeBlock(content, syntax) {
const backtickSequences = content.match(/`+/gu) || [];
const backtickSequences = content.match(/`+/g) || [];
const longestBacktickSequenceLength = Math.max(
...backtickSequences.map(({ length }) => length),
);
+8 -8
View File
@@ -1,5 +1,5 @@
export function fixPrettierVersion(version) {
const match = version.match(/^\d+\.\d+\.\d+-pr.(\d+)$/u);
const match = version.match(/^\d+\.\d+\.\d+-pr.(\d+)$/);
if (match) {
return `pr-${match[1]}`;
}
@@ -53,13 +53,13 @@ export function getCodemirrorMode(parser) {
}
const astAutoFold = {
estree: /^\s*"(loc|start|end|tokens|\w+Comments|comments)":/u,
postcss: /^\s*"(source|input|raws|file)":/u,
html: /^\s*"(\w+Span|valueTokens|tokens|file|tagDefinition)":/u,
mdast: /^\s*"position":/u,
yaml: /^\s*"position":/u,
glimmer: /^\s*"loc":/u,
graphql: /^\s*"loc":/u,
estree: /^\s*"(loc|start|end|tokens|\w+Comments|comments)":/,
postcss: /^\s*"(source|input|raws|file)":/,
html: /^\s*"(\w+Span|valueTokens|tokens|file|tagDefinition)":/,
mdast: /^\s*"position":/,
yaml: /^\s*"position":/,
glimmer: /^\s*"loc":/,
graphql: /^\s*"loc":/,
};
export function getAstAutoFold(parser) {