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

new rule to cover console_log_state #1131

Open
rallets opened this issue Mar 17, 2025 · 2 comments
Open

new rule to cover console_log_state #1131

rallets opened this issue Mar 17, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@rallets
Copy link

rallets commented Mar 17, 2025

Description

Hi, I'm wondering if there is a plan to include a rule to avoid console_log_state warnings at runtime

Ref: https://svelte.dev/docs/svelte/runtime-warnings#Client-warnings-console_log_state

Thank you

@rallets rallets added the enhancement New feature or request label Mar 17, 2025
@baseballyama
Copy link
Member

Since runes can also be defined in external files, it seems challenging to determine whether an argument passed to console.log is a rune.
Therefore, I feel it’s difficult to implement this as an ESLint rule. What do you think?

@rallets
Copy link
Author

rallets commented Mar 18, 2025

Thanks to taking a look to this. I didn't know it could have been so complex to detect runes. I thought the rune-detection was already part of the eslint plugin framework.
However I think it could cover a good number of cases if the console.log can detect runes defined in the same file (.svelte file or svelte.ts file).
And what about detecting if an argument is a proxied class?

A perfect rue doesn't exist maybe, but at least can help developers to detect early some common misuses, especially during migrations (like in my case). A later refactoring could be challenging and time consuming, as it requires rewriting part of the code.
I like eslint rules because they point to the docs and you learn always something new.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants