Skip to content

Commit 8f91730

Browse files
refactor: use void operator for intentional exception ignoring
- Replace NOSONAR suppressions with void operator pattern - void e explicitly marks exception as intentionally unused - Maintains debug logging for troubleshooting - Cleaner approach using language features vs linting suppressions - Exception is expected in CommonJS/Jest environments
1 parent f12ff49 commit 8f91730

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/cloudevents/tools/generator/docs-generator/generate-docs-cli.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,11 @@ try {
145145
process.exit(1);
146146
});
147147
}
148-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
149148
} catch (e) {
150-
// NOSONAR - Intentionally ignoring error when import.meta is not available
151-
// This occurs in CommonJS/Jest environments and is expected behavior
152-
// The module is being imported, not executed directly, so no action needed
149+
// Intentionally ignoring: import.meta not available in CommonJS/Jest environments
150+
// This is expected when the module is imported rather than executed directly
153151
if (process.env.DEBUG) {
154152
console.debug('Module loaded in CommonJS/Jest environment (import.meta not available)');
155153
}
154+
void e; // Mark exception as intentionally unused
156155
}

src/cloudevents/tools/generator/readme-generator/update-readme-cli.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,11 @@ try {
7979
process.exit(1);
8080
});
8181
}
82-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
8382
} catch (e) {
84-
// NOSONAR - Intentionally ignoring error when import.meta is not available
85-
// This occurs in CommonJS/Jest environments and is expected behavior
86-
// The module is being imported, not executed directly, so no action needed
83+
// Intentionally ignoring: import.meta not available in CommonJS/Jest environments
84+
// This is expected when the module is imported rather than executed directly
8785
if (process.env.DEBUG) {
8886
console.debug("Module loaded in CommonJS/Jest environment (import.meta not available)");
8987
}
88+
void e; // Mark exception as intentionally unused
9089
}

0 commit comments

Comments
 (0)