From 4cc710364343612ddeeb358bc3d994ce472c9deb Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Fri, 12 Jul 2024 15:33:20 -0500 Subject: [PATCH 1/2] no-void --- eslint.config.mjs | 1 + packages/repo-tools/src/postinstall.mts | 28 ++++++++++------------ packages/rule-tester/src/RuleTester.ts | 2 +- packages/website/src/hooks/useClipboard.ts | 1 - 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 9f64059dbfea..8e0a624ad0f9 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -206,6 +206,7 @@ export default tseslint.config( 'error', { commentPattern: '.*intentional fallthrough.*' }, ], + 'no-void': ['error', { allowAsStatement: true }], 'one-var': ['error', 'never'], 'prefer-arrow-callback': 'error', diff --git a/packages/repo-tools/src/postinstall.mts b/packages/repo-tools/src/postinstall.mts index 0e18ff390ebc..5484b65e4428 100644 --- a/packages/repo-tools/src/postinstall.mts +++ b/packages/repo-tools/src/postinstall.mts @@ -28,21 +28,19 @@ if (process.env.SKIP_POSTINSTALL) { process.exit(0); } -void (async function (): Promise { - // make sure we're running from the workspace root - const { - default: { workspaceRoot }, - } = await import('@nx/devkit'); - process.chdir(workspaceRoot); +// make sure we're running from the workspace root +const { + default: { workspaceRoot }, +} = await import('@nx/devkit'); +process.chdir(workspaceRoot); - // Install git hooks - await $`yarn husky install`; +// Install git hooks +await $`yarn husky install`; - if (!process.env.SKIP_POSTINSTALL_BUILD) { - // Clean any caches that may be invalid now - await $`yarn clean`; +if (!process.env.SKIP_POSTINSTALL_BUILD) { + // Clean any caches that may be invalid now + await $`yarn clean`; - // Build all the packages ready for use - await $`yarn build`; - } -})(); + // Build all the packages ready for use + await $`yarn build`; +} diff --git a/packages/rule-tester/src/RuleTester.ts b/packages/rule-tester/src/RuleTester.ts index ae926072ab03..89fcff556af2 100644 --- a/packages/rule-tester/src/RuleTester.ts +++ b/packages/rule-tester/src/RuleTester.ts @@ -971,7 +971,7 @@ export class RuleTester extends TestFramework { const expectsSuggestions = Array.isArray(error.suggestions) ? error.suggestions.length > 0 : Boolean(error.suggestions); - const hasSuggestions = message.suggestions !== void 0; + const hasSuggestions = message.suggestions !== undefined; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const messageSuggestions = message.suggestions!; diff --git a/packages/website/src/hooks/useClipboard.ts b/packages/website/src/hooks/useClipboard.ts index 0a98af33b91b..c97ecf383141 100644 --- a/packages/website/src/hooks/useClipboard.ts +++ b/packages/website/src/hooks/useClipboard.ts @@ -8,7 +8,6 @@ export function useClipboard(code: () => string): useClipboardResult { const [copied, setCopied] = useDebouncedToggle(false); const copy = useCallback(() => { - // eslint-disable-next-line @typescript-eslint/no-floating-promises void navigator.clipboard.writeText(code()).then(() => { setCopied(true); }); From 0f09c58767e30e895c0ba1029560ed8adbb2c483 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Sun, 14 Jul 2024 17:53:14 -0500 Subject: [PATCH 2/2] revert --- packages/repo-tools/src/postinstall.mts | 28 +++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/repo-tools/src/postinstall.mts b/packages/repo-tools/src/postinstall.mts index 5484b65e4428..0e18ff390ebc 100644 --- a/packages/repo-tools/src/postinstall.mts +++ b/packages/repo-tools/src/postinstall.mts @@ -28,19 +28,21 @@ if (process.env.SKIP_POSTINSTALL) { process.exit(0); } -// make sure we're running from the workspace root -const { - default: { workspaceRoot }, -} = await import('@nx/devkit'); -process.chdir(workspaceRoot); +void (async function (): Promise { + // make sure we're running from the workspace root + const { + default: { workspaceRoot }, + } = await import('@nx/devkit'); + process.chdir(workspaceRoot); -// Install git hooks -await $`yarn husky install`; + // Install git hooks + await $`yarn husky install`; -if (!process.env.SKIP_POSTINSTALL_BUILD) { - // Clean any caches that may be invalid now - await $`yarn clean`; + if (!process.env.SKIP_POSTINSTALL_BUILD) { + // Clean any caches that may be invalid now + await $`yarn clean`; - // Build all the packages ready for use - await $`yarn build`; -} + // Build all the packages ready for use + await $`yarn build`; + } +})();