Quellcode durchsuchen

[misc] Disallow regex lookbehind during linting

GitOrigin-RevId: e4f4d9ac1f9b0dcc6572cf1b32304575c9bb0ac4
Mathias Jakobsen vor 3 Jahren
Ursprung
Commit
608bca2610
1 geänderte Dateien mit 5 neuen und 0 gelöschten Zeilen
  1. 5 0
      services/web/.eslintrc

+ 5 - 0
services/web/.eslintrc

@@ -133,6 +133,11 @@
           {
           {
             "selector": "AssignmentExpression[left.object.object.name='window'][left.object.property.name='location'][left.property.name='href']",
             "selector": "AssignmentExpression[left.object.object.name='window'][left.object.property.name='location'][left.property.name='href']",
             "message": "Modify location via useLocation instead of calling window.location methods directly"
             "message": "Modify location via useLocation instead of calling window.location methods directly"
+          },
+          // prohibit using lookbehinds due to incidents with Safari simply crashing when the script is parsed
+          {
+            "selector": "Literal[regex.pattern=/\\(\\?<[!=]/]",
+            "message": "Lookbehind is not supported in older Safari versions."
           }
           }
         ]
         ]
       }
       }