fix: Use of lookbehind regex crashes Safari, added lint rule to prevent future accidental regression

This commit is contained in:
Tom Moor
2022-04-08 10:16:55 -07:00
parent 58a059ae33
commit 5fb5e69181
4 changed files with 13 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
"plugin:prettier/recommended"
],
"plugins": [
"es",
"@typescript-eslint",
"eslint-plugin-import",
"eslint-plugin-node",
@@ -28,6 +29,7 @@
"curly": 2,
"no-mixed-operators": "off",
"no-useless-escape": "off",
"es/no-regexp-lookbehind-assertions": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{

View File

@@ -287,6 +287,7 @@
"eslint": "^7.6.0",
"eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-es": "^4.1.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.1.0",
"eslint-plugin-node": "^11.1.0",

View File

@@ -46,8 +46,8 @@ export default class Italic extends Mark {
* 1_123_
*/
return [
markInputRule(/(?<=[^_\na-zA-Z0-9]|^)_([^_\n]+)_$/, type),
markInputRule(/(?<=[^*\na-zA-Z0-9]|^)\*([^*\n]+)\*$/, type),
markInputRule(/(?:^|[^_a-zA-Z0-9])(_([^_]+)_)$/, type),
markInputRule(/(?:^|[^*a-zA-Z0-9])(\*([^*]+)\*)$/, type),
];
}

View File

@@ -6726,6 +6726,14 @@ eslint-plugin-es@^3.0.0:
eslint-utils "^2.0.0"
regexpp "^3.0.0"
eslint-plugin-es@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz#f0822f0c18a535a97c3e714e89f88586a7641ec9"
integrity sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==
dependencies:
eslint-utils "^2.0.0"
regexpp "^3.0.0"
eslint-plugin-import@^2.25.3:
version "2.25.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.25.3.tgz#a554b5f66e08fb4f6dc99221866e57cfff824766"