Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support double quote string enum #122

Merged
merged 5 commits into from
Sep 23, 2024
Merged

fix: support double quote string enum #122

merged 5 commits into from
Sep 23, 2024

Conversation

MarshallOfSound
Copy link
Member

@MarshallOfSound MarshallOfSound commented Sep 23, 2024

Fixes #97
Fixes #98

The comment in #98 was correct, the regex method here isn't great and is one of the few regex smells we have left in this module. This rewrites our string enum extractor as a token-parser state-machine thing. Hope the comments I left are helpful, I'll note that this method already had really solid tests that helped me catch edge cases and this PR adds even more.

@MarshallOfSound MarshallOfSound requested a review from a team as a code owner September 23, 2024 01:01
ckerr
ckerr previously approved these changes Sep 23, 2024
Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on adding the "

Also +1 on removing | here; doesn't look like we have any docs that use that notation

@MarshallOfSound MarshallOfSound dismissed ckerr’s stale review September 23, 2024 02:05

dismissing as I fundamentally changed the entire PR after the initial approval

@MarshallOfSound
Copy link
Member Author

The diff compared to current Electron main:

diff --git a/electron.d.ts.old b/electron.d.ts
index 4410ccb4bc..f79ddb47af 100644
--- a/electron.d.ts.old
+++ b/electron.d.ts
@@ -2883,7 +2883,7 @@ declare namespace Electron {
      * setting this, the window is still a normal window, not a toolbox window which
      * can not be focused on.
      */
-    setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
+    setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver' | 'dock', relativeLevel?: number): void;
     /**
      * Sets the properties for the window's taskbar button.
      *
@@ -5492,7 +5492,7 @@ declare namespace Electron {
      * setting this, the window is still a normal window, not a toolbox window which
      * can not be focused on.
      */
-    setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
+    setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver' | 'dock', relativeLevel?: number): void;
     /**
      * Sets the properties for the window's taskbar button.
      *
@@ -18513,7 +18513,7 @@ declare namespace Electron {
      * `strict-origin-when-cross-origin`. Defaults to
      * `strict-origin-when-cross-origin`.
      */
-    referrerPolicy?: string;
+    referrerPolicy?: ('""' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'unsafe-url' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin');
     /**
      * can be `default`, `no-store`, `reload`, `no-cache`, `force-cache` or
      * `only-if-cached`.

Seems correct

@MarshallOfSound MarshallOfSound merged commit 4c9ad8f into main Sep 23, 2024
3 checks passed
@MarshallOfSound MarshallOfSound deleted the enum-double branch September 23, 2024 13:38
Copy link

🎉 This PR is included in version 1.2.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants