ghivert / sketch

A CSS-in-Gleam package, made to work with frontend, backend, with your favorite framework!
https://hexdocs.pm/sketch/
MIT License
48 stars 6 forks source link

warning: Unused private constructor JsCache #34

Open Guria opened 4 days ago

Guria commented 4 days ago

Currently Gleam reports JsCache type constructor is unused

warning: Unused private constructor
   ┌─ /home/aleksei_gurianov/oss/sketch/sketch/src/sketch.gleam:21:3
   │
21 │   JsCache(cache: style.Cache)
   │   ^^^^^^^^^^^^^^^^^^^^^^^^^^^ This private constructor is never used

Do you have any plans for it or is it just a leftover that could be safely removed?

Guria commented 4 days ago

Sorry, it is question to a gleam lang compiler since it depends on current target used.

Guria commented 4 days ago

https://github.com/gleam-lang/gleam/issues/3808#issuecomment-2466190650

ghivert commented 2 days ago

If you take a look at the JS build, you'll see that constructor is used. It simply is unused on Erlang target. By default, when you're developing locally, the LSP will use the Erlang target, and as such, will display the warning.

At the moment, there's nothing much I can do, you can safely ignore the warning.

Guria commented 2 days ago

Yes, I understand the root cause of the issue. However, I believe this should still be addressed when a solution becomes technically feasible. I've reopened this issue in the library repository since the Gleam core team indicated that this falls under the library author's responsibility. As I mentioned in the linked ticket, having warnings that we need to "safely ignore" undermines the effectiveness of the warning system as a whole. I believe it's crucial to maintain clean compiler logs to preserve the value and purpose of warning messages. When developers become accustomed to ignoring certain warnings, they risk missing important issues that genuinely need attention.