No functions in specified types #67
Replies: 2 comments
-
Although we can't currently check the source of dependencies, a first pass of this rule could be written that's only aware of what's in your project. The question then is whether there's value in being able to do this if you can't check dependencies? You could also have a blacklist; this may not be so useful for solo projects, but larger teams may benefit from this. |
Beta Was this translation helpful? Give feedback.
-
In the 4-5 times I've accidentally added a function to my model/msg type, it's always been due to a package storing a function in some unexpected place. For that reason I don't think there's much value in only checking user code. A black list could work for larger teams but it would still require someone to go through packages and find the types that need to be blacklisted. It seems like too much effort to be worthwhile. |
Beta Was this translation helpful? Give feedback.
-
What the rule should do:
The rule will be provided a list of types and check if any of those types contains a function. Any type referenced by those types must not contain functions either. This is a stopgap solution until Elm supports an equatable typeclass which will automatically enforce this behavior.
Example of things the rule would report:
Model will be marked as an error (assuming we've configured the rule to check for Main.Model).
Msg will be marked as an error (assuming we've configured the rule to check for Main.Msg) because Image (from justgook/elm-image) contains a function. This is largely what this rule is intended for, sparing the user from having to go through the internally defined types in packages checking if there's a function in some unexpected place.
I am looking for:
Beta Was this translation helpful? Give feedback.
All reactions