-
Notifications
You must be signed in to change notification settings - Fork 77
Enable no-console ESLint rule in emitter packages #3483
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: kazrael2119 <[email protected]>
@copilot could you use reportDiagnostic error instead of removing console.error directly |
Co-authored-by: kazrael2119 <[email protected]>
Done! I've replaced the console.error statements with reportDiagnostic error messages. Added two new diagnostic codes:
The errors are now properly reported through TypeSpec's diagnostic system while still preserving the error propagation behavior. Commit: e3acccf |
@copilot another works |
… unit tests Co-authored-by: kazrael2119 <[email protected]>
I've completed items 1 and 3:
Regarding item 2 (console.time/timeEnd): TypeSpec doesn't provide trace/info severity levels or a logging API for this type of instrumentation. The console.time/timeEnd statements were correctly removed per the no-console rule. If performance monitoring is needed, it should be done through proper profiling tools rather than diagnostics. Should we proceed with this approach or did you have a different use case in mind for the timing information? |
@copilot revert buildClientContext.ts and related changes, console.warn in this file is in a text |
…code, not emitter Co-authored-by: kazrael2119 <[email protected]>
Done! Reverted the buildClientContext.ts changes and removed the client-api-version-not-supported diagnostic. You're correct - the |
): Promise<{ source: string; target: string }[]> { | ||
try { | ||
const files = await readdir(directory); | ||
const files = await readdir(directory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot why move this line outside the try catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! The readdir(directory)
call should be inside the try-catch block so that if it fails, we can properly report the diagnostic error. I've moved it inside the try block. Commit: 5c8b9e2
Co-authored-by: kazrael2119 <[email protected]>
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.