From f2096c75fbffe80ab85e72a9fe3b7382bf6209f9 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Thu, 11 Dec 2025 17:48:02 +0000 Subject: [PATCH 1/3] feat(lint): configure unicorn/prefer-top-level-await rule - Disable top-level await in library code (src/) to ensure compatibility with consumers who may not support ES modules with top-level await - Enable top-level await in examples/ for cleaner, more readable scripts - Add examples override with no-console off for script-style files --- .oxlintrc.jsonc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.oxlintrc.jsonc b/.oxlintrc.jsonc index a3e0883..ceac526 100644 --- a/.oxlintrc.jsonc +++ b/.oxlintrc.jsonc @@ -130,6 +130,11 @@ // =================== // Enforce top-level type specifier style "import/consistent-type-specifier-style": ["error", "top-level"], + // =================== + // Unicorn Rules + // =================== + // Disable top-level await in src (library code should not use top-level await) + "unicorn/prefer-top-level-await": "off", // Ensure imports are at the top "import/first": "error", // Disallow duplicate imports @@ -154,5 +159,13 @@ "typescript/no-floating-promises": "warn", }, }, + { + // Examples should use top-level await for cleaner code + "files": ["examples/**/*.ts"], + "rules": { + "no-console": "off", + "unicorn/prefer-top-level-await": "error", + }, + }, ], } From a5e0cb00bd2ab30a25d06cd556ea493f8ccd704d Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Thu, 11 Dec 2025 17:49:36 +0000 Subject: [PATCH 2/3] feat(lint): enforce ESM style with unicorn/prefer-module - Add unicorn/prefer-module rule globally to enforce ESM patterns - Disallows __dirname/__filename in favour of import.meta.url - Disallows require() in favour of import --- .oxlintrc.jsonc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.oxlintrc.jsonc b/.oxlintrc.jsonc index ceac526..b5ab92b 100644 --- a/.oxlintrc.jsonc +++ b/.oxlintrc.jsonc @@ -135,6 +135,8 @@ // =================== // Disable top-level await in src (library code should not use top-level await) "unicorn/prefer-top-level-await": "off", + // Enforce ESM style (import.meta.url instead of __dirname, etc.) + "unicorn/prefer-module": "error", // Ensure imports are at the top "import/first": "error", // Disallow duplicate imports From 6cfb0ea14aa002865047e91bc0a87baf9edf1885 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Thu, 11 Dec 2025 17:52:35 +0000 Subject: [PATCH 3/3] Revert "feat(lint): enforce ESM style with unicorn/prefer-module" This reverts commit a5e0cb00bd2ab30a25d06cd556ea493f8ccd704d. --- .oxlintrc.jsonc | 2 -- 1 file changed, 2 deletions(-) diff --git a/.oxlintrc.jsonc b/.oxlintrc.jsonc index b5ab92b..ceac526 100644 --- a/.oxlintrc.jsonc +++ b/.oxlintrc.jsonc @@ -135,8 +135,6 @@ // =================== // Disable top-level await in src (library code should not use top-level await) "unicorn/prefer-top-level-await": "off", - // Enforce ESM style (import.meta.url instead of __dirname, etc.) - "unicorn/prefer-module": "error", // Ensure imports are at the top "import/first": "error", // Disallow duplicate imports