When writing a custom hook, can I pass line/col metadata in the ex-data
of an error?
I want to treat this problem as an error, not a warning, but still retain helpful line/col info
Right now when I throw
, it “puts” the error onto the top-level form, but I have the exact line/col info of the real issue
(throw (ex-info "defmutation handlers must take 1 argument"
{:type :fulcro/defmutation
:row row
:col col}))
Something like this
yes, that should work
well, type isn't picked up from ex-data, but row and col are
it probably should, but it isn't the case right now. but you can use reg-finding!
to do what you want
Can reg-finding!
be configured to be a fatal error?
you have to set :level :error
Ahh duh, I see it now
Thank you
note that the user will also have to configure :fulcro/defmutation
in the linter config and set a level for it
I think the :level isn't even relevant from where it's emitted, it's always the one from the config
Hm yea, must be, still can’t quite get it working
I think I’m doing something slightly weird is the problem. Basically, I’m transforming fulcro’s defmutation
into something like this:
(defn my-mutation
[params]
(letfn [(action [env])
(remote [env])]
(action nil)
(remote nil)))
It’s “close enough” to what I want the linting to do, but it’s giving me stray errors like “action is called with 1 arg instead of 0"…I’m trying to override those subsequent/general linters with my own very specific error messages, if that makes senseI don't know these macros to say with confidence if that makes sense.
but in general I think it does
Inside of a reg-finding!
map, how should I qualify :type
keywords? I’m thinking something like this: :clj-kondo.fulcro.defmutation/handler-arity
Originally I had :com.fulcrologic.fulcro.mutations.defmutation/handler-arity
, but that’s not a domain I own, so I shouldn’t be adding keys to it yea? Still figuring out how to namespace keywords generally…
yeah, I think your proposal is reasonable