This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-18
Channels
- # announcements (6)
- # babashka (16)
- # beginners (194)
- # calva (20)
- # cider (34)
- # clj-kondo (38)
- # clojure (89)
- # clojure-europe (10)
- # clojure-finland (15)
- # clojure-italy (2)
- # clojure-nl (15)
- # clojure-sg (7)
- # clojure-spec (15)
- # clojure-uk (86)
- # clojurebridge (1)
- # clojurescript (60)
- # community-development (11)
- # conjure (13)
- # core-async (48)
- # core-typed (3)
- # cursive (22)
- # datascript (8)
- # datomic (40)
- # duct (11)
- # emacs (3)
- # figwheel-main (22)
- # fulcro (45)
- # graphql (1)
- # helix (9)
- # hoplon (15)
- # hugsql (7)
- # jobs-discuss (47)
- # juxt (7)
- # kaocha (21)
- # luminus (1)
- # malli (13)
- # meander (2)
- # off-topic (52)
- # parinfer (19)
- # re-frame (66)
- # reagent (1)
- # reitit (3)
- # ring-swagger (1)
- # rum (2)
- # shadow-cljs (72)
- # spacemacs (5)
- # sql (4)
- # timbre (5)
- # tools-deps (15)
- # vim (5)
- # vrac (7)
hello, one curiosity, when you have many projects and would like to keep the lint configuration consistent between then, is there a nice way to keep a single file serving many projects?
@wilkerlucio I recommend writing a babashka script to generate/update your project configs. Clj-kondo has an API function called merge-configs which can also be used for this and can be invoked as a pod function
@borkdude with 468, it's about linting a single function, it's about linting the whole file. Eg implementing my own version of unused refers, or something like that. Generating an arbitrary message for anywhere in the file.
I'm considering switching entirely to rewrite-clj node based transformations instead of converting them to sexprs and parse the transformed sexpr as rewrite-clj nodes again as it's quite difficult to preserve location metadata, for the "macroexpand" feature
it's a bit unfortunate since working with sexprs is more ergonomic than rewrite-clj nodes... but preserving location information is really important for clj-kondo
Colin Fleming posted a response: https://clojureverse.org/t/feedback-wanted-on-new-clj-kondo-macroexpansion-feature/6043/10?u=borkdude
I think he just affirmed my belief that it's good to not use sexprs but work directly with the source nodes in that response
Hey folks. Can I bounce a wild idea off someone? I’ve come over JavaScript in the last year and trying to find the Clojure-ish way to walk the AST to find where some of my function calls use third-party libraries. I heard about the analysis output from clj-kondo on Jacek Schae’s podcast, but it seem to have a way to connect the variable usage (call site) to the function that calls it. Does that sound right? I probably need to find something to work with the AST, eh?
Thanks in advance for thinking about it, and a huge thanks to Michiel for sharing all your tools. ❤️
@sean.poulter Using the analysis output you can see where a third party library is called: https://github.com/borkdude/clj-kondo/tree/master/analysis
Yea, I’ve found the call sites that way which is awesome.
I don’t think we can find the enclosing function though. I’ve got to walk the call stack to figure out where that third-party code is called from our public APIs.
there are at least a few tools making visual representations of this using the analysis data, so it should be possible
Here’s an entry from the var-usages
:
{ filename: 'src/my/components/widgets/list/views.cljs',
row: 14,
col: 6,
from: 'my.components.widgets.list.views',
to: 'other.components',
name: 'Flow',
'from-var': 'widget' }
Oh…. oh. 😐
Yea… macros!
The macros have me all confused. Thanks!
Can I add from-var
to https://github.com/borkdude/clj-kondo/tree/master/analysis for you?
All good.
Cool. I’ll put something up in the next day or two after work. 🤓
thanks a lot. there are a few cool tools built on top of this: https://github.com/borkdude/clj-kondo/issues/836
these two: https://github.com/SevereOverfl0w/vizns https://github.com/benedekfazekas/morpheus visualize the analysis output in interesting ways
@sean.poulter I'm also building something like this: https://twitter.com/borkdude/status/1273384546269040646/photo/1 so you can write a hook and make a custom linter once clj-kondo analyses the usage of a function. but it won't be released soon probably
Neat.
Wow, thanks. I can use Morpheus to solve my “where is this stuff used?” question too! 👏
Wow. That’s neat too! Thanks! 😀
This is one of those “I wish I could hang out and watch how (person) works” moments. That’s some really neat tooling we weren’t aware of.
anyone want to add clj-kondo to this? https://github.com/github/super-linter https://github.com/github/super-linter/issues/111