This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-06
Channels
- # announcements (5)
- # aws (28)
- # babashka (4)
- # beginners (163)
- # bristol-clojurians (2)
- # calva (4)
- # cider (18)
- # clj-kondo (30)
- # cljs-dev (28)
- # cljsrn (50)
- # clojure (96)
- # clojure-europe (25)
- # clojure-italy (6)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-sweden (7)
- # clojure-uk (32)
- # clojurescript (39)
- # conjure (74)
- # cursive (12)
- # events (1)
- # fulcro (32)
- # helix (71)
- # jackdaw (2)
- # leiningen (10)
- # off-topic (14)
- # pathom (59)
- # rdf (7)
- # re-frame (6)
- # reitit (28)
- # ring (7)
- # shadow-cljs (207)
- # slack-help (2)
- # spacemacs (3)
- # specter (7)
- # sql (12)
- # tools-deps (14)
- # xtdb (32)
Is there an exclusion list for unused imports?
Also, was there a way to use Clojure metadata to configure clj-kondo?
@fiddlerwoaroof You can provide metadata on the ns
form for per-file configuration overrides.
(ns worldsingles.expectations.mobile.user
{:clj-kondo/config
'{:lint-as
{worldsingles.expectations.mobile.user/patch-notifications
clj-kondo.lint-as/def-catch-all}}}
(:require [clj-time.coerce :as tc]
[clj-time.core :as t]
[clj-time.format :as tf]
...
Note the '
so the symbol names do not get evaluated!
Thanks, I really dislike the friction a separate config file adds
(metadata on ns
can come before the namespace name if you use ^
)
I have a config file in each project, at this point, with just that one override so far.
My current issue is that I have to import a JDBC driver, but I never use it directly and I can't figure out how to hide the warning
Really? Why is that?
Because it's used implicitly when the connection string is parsed
Hmm, maybe I don't need the import
Neither clojure.java.jdbc
nor next.jdbc
need you to import the JDBC drivers.
Cool, I wasn't thinking things through
Fixed your warning for you! 😆
thanks
Heya @borkdude! I am slowly dipping my toes back into rewrite-cljc. It has been a long while since I spent time with my old reliable and helpful clj-kondo. I have missed her and the reunion is delightful. I noticed 2 small things while updating to the latest clj-kondo (remember I have been away for literally months!):
1. clj-kondo --help
does not show cljc
as a valid option for --lang
, should it?
2. I had to add "<stdin>"
to my clj-kondo .config.edn
->`:output` -> :include-files
to get spacemacs to show clj-kondos findings. I now have :output {:include-files ["<stdin>" "^src" "^test" "^script"]}
. If having to include <stdin>
is by design, a note in the docs might be helpful.
Am happy to make PRs for above if there is any work to do.
@lee 1) Yeah, it should. 2) Why are you excluding test files from linting in your editor? Clj-kondo is pretty helpful there too. Scripts: dunno. Maybe just try without the entire include-files thing and start over?
For 2) I have a single clj-kondo config to support CI scripts and my editor. My CI script runs clj-kondo with my project classpath but I only want to see clj-kondo warnings from my project sources. You helped me come up with this solution in the very early days, but that was long ago and maybe there is a better way.
@lee In CI you can add the --config
flag to pass additional config, they will be merged
Hi, I’ve made a try-let
abomination macro that needs to be linted as both a let
and a try
block. How can I configure it? Usage:
(try-let [a (db-connection)
b (might-throw)]
(process a b)
(catch Exception e
(when a (close a))
(when b (close b))
(throw e)))
you can turn off linting with :unresolved-symbol {:exclude [(weird.macros/try-let)]}
Is it possible to extend the analyzer instead with a custom analyzer? I scanned the source briefly and I can’t find a way?
@yonatanel It won't help you but my opinion, after spending a bunch of time trying to get clj-kondo
to "like" some of my macro-based code, is that it's a really good idea to make sure you don't create new syntax via macros that doesn't "match" something that is in Clojure already 🙂 It's made it clear to me just how hard it would be for someone new to my code to be able to read stuff that uses macros that have "unexpected" syntax. I'm seriously rethinking some of the syntax in my Expectations library at this point, after wrestling with clj-kondo
!
First rule of macro club, don't create macro's (unless there is an extremely compelling reason)