diff options
author | 2024-02-07 20:43:19 +0800 | |
---|---|---|
committer | 2024-02-07 20:43:19 +0800 | |
commit | 436841e97e0ecbf6e5e1658b2c1e272d7856cdc9 (patch) | |
tree | a8e1744f8fa4ce06420d72381a3659251e0ea9ae /packages/integrations/markdoc/src | |
parent | ce4283331f18c6178654dd705e3cf02efeef004a (diff) | |
download | astro-436841e97e0ecbf6e5e1658b2c1e272d7856cdc9.tar.gz astro-436841e97e0ecbf6e5e1658b2c1e272d7856cdc9.tar.zst astro-436841e97e0ecbf6e5e1658b2c1e272d7856cdc9.zip |
Use eslint-plugin-regexp (#9993)
Diffstat (limited to 'packages/integrations/markdoc/src')
-rw-r--r-- | packages/integrations/markdoc/src/html/css/parse-inline-css-to-react.ts | 2 | ||||
-rw-r--r-- | packages/integrations/markdoc/src/html/css/parse-inline-styles.ts | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/packages/integrations/markdoc/src/html/css/parse-inline-css-to-react.ts b/packages/integrations/markdoc/src/html/css/parse-inline-css-to-react.ts index dd429788a..2e445d35f 100644 --- a/packages/integrations/markdoc/src/html/css/parse-inline-css-to-react.ts +++ b/packages/integrations/markdoc/src/html/css/parse-inline-css-to-react.ts @@ -17,7 +17,7 @@ export function parseInlineCSSToReactLikeObject( function convertCssDirectiveNameToReactCamelCase(original: string): string { // capture group 1 is the character to capitalize, the hyphen is omitted by virtue of being outside the capture group - const replaced = original.replace(/-([a-z0-9])/gi, (_match, char) => { + const replaced = original.replace(/-([a-z\d])/gi, (_match, char) => { return char.toUpperCase(); }); return replaced; diff --git a/packages/integrations/markdoc/src/html/css/parse-inline-styles.ts b/packages/integrations/markdoc/src/html/css/parse-inline-styles.ts index 623b560af..fa3217c89 100644 --- a/packages/integrations/markdoc/src/html/css/parse-inline-styles.ts +++ b/packages/integrations/markdoc/src/html/css/parse-inline-styles.ts @@ -23,9 +23,11 @@ const NEWLINE_REGEX = /\n/g; const WHITESPACE_REGEX = /^\s*/; // declaration -const PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/; +const PROPERTY_REGEX = /^([-#/*\\\w]+(\[[\da-z_-]+\])?)\s*/; const COLON_REGEX = /^:\s*/; -const VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/; +// Disable eslint as we're not sure how to improve this regex yet +// eslint-disable-next-line regexp/no-super-linear-backtracking +const VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*\)|[^};])+)/; const SEMICOLON_REGEX = /^[;\s]*/; // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill |