Fork me on GitHub
#clj-kondo
<
2020-04-18
>
Chris O’Donnell12:04:16

I'm seeing some odd behavior with a :lint-as rule. In my config, I have {:lint-as {com.fulcrologic.fulcro.components/defsc clojure.core/defn}}. Oddly enough, I get an unused namespace warning for df with the form

(defn Home [_this _]
  {:lifecycle-method (df/load! "foo")}
  (dom/div {} "Home"))
but not with
(defsc Home [_this _]
  {:lifecycle-method (df/load! "foo")}
  (dom/div {} "Home"))
Interestingly, I uncovered this because I was getting an unused namespace warning for df with
(defsc Home [_this _]
  {:query []
   :ident nil
   :initial-state nil
   :route-segment []
   :will-enter (fn [app _]
                 (df/load! app [:component/id :created-gift-lists]
                   ui.gift-list/CreatedGiftLists))}
  (dom/div {} "Home"))
However, this warning goes away if I delete any of the keys from the component options map (other than :will-enter of course).

borkdude12:04:44

@codonnell Maybe it's because clj-kondo tries to parse the first map in defn as a pre-post map

Chris O’Donnell12:04:12

Ah, that's a good thought.

borkdude12:04:50

but it's a bug nonetheless probably

Chris O’Donnell12:04:08

Happy to make a github issue if that would be helpful

borkdude12:04:12

yes please

👍 4
Chris O’Donnell13:04:13

Sure thing, thanks for all the work you've put into clj-kondo! 🙂

FlavaDave16:04:54

having trouble getting kondo to work I installed with homebrew and ~/.lein/profiles.clj looks like

{:user
 {:dependencies [[clj-kondo "RELEASE"]]
  :aliases {"clj-kondo" ["run" "-m" "clj-kondo.main"]}}}
lein clj-kondo --lint src works and returns errors in command line, but there is no linting going on in my editor.

borkdude16:04:34

@dgonsalves22 I don't recommend running clj-kondo with leiningen for editor integration. Installing the binary is a much faster and better experience

FlavaDave16:04:50

ok. I installed with brew and it is in bin/. is that not what i should be doing?

borkdude16:04:17

@dgonsalves22 If you installed it with brew, and it's on your path, then you're set. But it depends on your editor if you enable the right plugin, etc. What editor are you using?

borkdude16:04:40

@dgonsalves22 Also the people in #spacemacs are really helpful about clj-kondo

👍 4
lvh17:04:39

Hi! I'm trying to disable a particular checker for some source files (my tests touch private vars and that's intentional/OK), and I figured a separate config file would work. It seems to work locally on my machine, but DeLaGuardo/clojure-lint-action@v1 appears to be ignoring the command line option: https://github.com/latacora/wernicke/runs/598161720?check_suite_focus=true

borkdude18:04:36

Maybe ask @U04V4KLKC if he can support additional command line args. Or roll your own thing. See https://github.com/borkdude/clj-kondo/blob/master/doc/ci-integration.md#linter-output-integration

delaguardo19:04:13

Hi) cli args should work as expected. I'll check this tomorrow

delaguardo13:04:20

@lvh please check DeLaGuardo/clojure-lint-action@master I changed how the options passed to runner internally. Now it should respect your configuration

lvh17:04:52

this didn't fix the issue for me

lvh17:04:53

I considered trying a YAML vector of args instead of a single string but if that was the issue, --lint src working wouldn't make sense either

lvh17:04:00

(base) lvh@cannon ~/s/L/wernicke $ clj-kondo --lint test
test/latacora/wernicke/cli_test.clj:24:18: error: #'latacora.wernicke.cli/exit! is private
linting took 29ms, errors: 1, warnings: 0
(base) lvh@cannon ~/s/L/wernicke $ clj-kondo --config .clj-kondo/test-config.edn --lint test
linting took 33ms, errors: 0, warnings: 0

lvh17:04:03

(that's locally, works fine)

FlavaDave18:04:50

@borkdude just to follow up. My previous issues were definitely spacemacs related and not kondo related. Thought you would like to know.

👍 4
borkdude18:04:02

@lvh To disable this linter in specific namespaces you can use one of these two ways:

(ns foo)

(defn- foo [])
(foo)

(ns bar
  {:clj-kondo/config {:linters {:private-call {:level :off}}}} ;; 1
  (:require [foo]))

(foo/foo)   ;; 1
(#'foo/foo) ;; 2

borkdude14:04:17

@lvh Did this work for you?

lvh17:04:30

hey! yeah I managed to work around the bug in the github action w/ this, thank you!