This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-08
Channels
- # announcements (5)
- # babashka (46)
- # beginners (206)
- # boot (1)
- # bristol-clojurians (1)
- # calva (9)
- # chlorine-clover (27)
- # cider (1)
- # clara (10)
- # clj-kondo (105)
- # cljsrn (2)
- # clojars (1)
- # clojure (104)
- # clojure-europe (6)
- # clojure-nl (2)
- # clojure-uk (18)
- # clojurescript (44)
- # conjure (10)
- # core-async (34)
- # cursive (28)
- # data-science (6)
- # datomic (14)
- # emacs (44)
- # events (1)
- # figwheel-main (1)
- # fulcro (13)
- # graphql (9)
- # helix (12)
- # kaocha (2)
- # meander (4)
- # off-topic (2)
- # pathom (1)
- # quil (1)
- # re-frame (21)
- # shadow-cljs (49)
- # spacemacs (6)
- # xtdb (8)
hello, I'm getting this error on a project:
Unexpected error. Please report an issue.
java.lang.IllegalArgumentException: /scrollparent.transit.json is not a relative path
at $as_relative_path.invokeStatic(io.clj:414)
at $file.invokeStatic(io.clj:426)
at $file.invoke(io.clj:418)
Ideas on what may be going on?Is that perhaps part of a top-level def
that has side-effect-y stuff in it? (hard to tell without more of the stacktrace)
after some debugging I found the issue is when you have a :require
on cljs that uses a root link, eg: (:require ["/something" :as js-local-thing])
when I replaced with ../something
it works
Oh wow... I didn't know paths were a thing in cljs requires!
another thing that I'm having, when I run clj-kondo --lint src
on my project, its not reporting unsorted namespaces, but when I save the file from my editor and it triggers from that, the error is reported, both using same config, is there something I'm missing here?
and funny enough, when I run in the CI it triggers the errors for unsorted namespaces :man-shrugging:
on this, its not just the unsorted imports, some redundant do also did show up on CI, but not on my machine via clj-kondo --lint src
, but those also show in my editor when I save a file
and still about unsorted imports, currently clj-kondo is sorting based on the real ns name, not in what is written, so when we have string requires from cljs, its working as if they were symbols (and expecting them to be in the middle), but I like that JS imports (from strings) appear at the top, also sorting libs like ns-org will also put the strings first, @borkdude do you think we can make this setting configurable, so I can choose to have the string requires at top?
example:
; this is what I consider organized
(ns devcards.render
(:require
["react" :as react]
[devcards.util :as d-u]
[reagent.core :as r]
[relemma.util :as u]))
; this is what clj-kondo considers organized
(ns devcards.render
(:require
[devcards.util :as d-u]
["react" :as react]
[reagent.core :as r]
[relemma.util :as u]))
@wilkerlucio please upgrade, you are using and old version. The local path require issue has been fixed. Also the issue about str/replace you posted on Github
oh, cool! @borkdude I did the install yesterday from homebrew, maybe the recipe there is not on latest?
clj-kondo v2020.01.13
@wilkerlucio How did you install. From which brew thing? https://github.com/borkdude/homebrew-brew/blob/master/clj-kondo.rb borkdude/brew/clj-kondo 2020.02.15 -> 2020.05.02 ==> Upgrading borkdude/brew/clj-kondo 2020.02.15 -> 2020.05.02
I think I followed the instructions, but maybe I just did brew install clj-kondo
I don't think so. Maybe your issue was the issue that Github had yesterday. Can you uninstall it and do it over?
@borkdude just figured out my problem, in the project that Im working there was already a clj-kondo install from NPM, and when I was running from that folder was picking that instead of the system installation
but about the local path thing, clj-kondo still complains about bad ordering when string requires are on top
this is getting me a lint error:
(ns devcards.render
(:require-macros
[devcards.core :refer [defcard]])
(:require
["react" :as react]
[devcards.util :as d-u]
[reagent.core :as r]
[relemma.util :as u]))
I need to change some config?
about the sorting: don't know - David Nolen told me that strings are allowed in require only to support things that you can't express using symbols. In that sense they are no different. But clj-kondo does treats string requires as JS library requires, so you can use the namespace objects. I don't think it should affect the sorting.
yeah, but would be nice if clj-kondo could respect the pure string checking there, I because tools like nsorg will put those first
also, I like that the separation gets clear about what is JS and what is CLJ (altough is purely a convention)
do you think its hard to support that? I wonder if clj-kondo currenty can tell the difference, I would be willing to work on that if you think its a feasable (and you want the feature :))
one problem is that different editors might have different opinions on sorting. if you can verify that e.g. Emacs / clojure-mode does the same thing for string requires, Atom, VSCode, etc, then it might start to make sense. But right now I'm not so certain of that.
I'm thinking of adding this as a configurable thing
@wilkerlucio Have you tried a separate require?
oh man, I would rather not if possible, thats hundreds of files to change 😛
would you be willing to take it if was a configurable feature? like :unsorted-required-namespaces {:level :warning :strings-first? true}
I'm on IntelliJ
nsorg is a separated tool I run from lein, that sorts all namespaces
The right order is: issue, hammock time/discussion, then PR. Maybe @helios also has an opinion on this, he created that linter.
sure, just checking if it something you thing its interesting to consider
do you know if the information about the original definition (if its a string or a symbol) is available at the linter call for this?
cool 🙂 gonna open the issue for discussion
Hey 👋:skin-tone-2: , I’m trying to setup the LSP server in InteliJ, but i get timeouts (see screenshot).
Also manually running java -jar ~/bin/clj-kondo-lsp-server-2020.05.02-standalone.jar
yields nothing on openjdk 1.8.0_232
. How would i go about debugging this 😬
I also tried 2020.04.05
I didn't tried that, but the setup with FileWatchers worked very well here on IntelliJ
The filewatcher setup is working correctly indeed, but i was intrigued for the lsp impl for a personal project 😬
It's funny because recently there was the exact opposite conversation: nobody could make the filewatchers work, so LSP was preferred 😉
@UHJH8MG6S You can enable logging in the LSP plugin
Hi I’m pretty new to clj-kondo and specifically using it for a Clojurescript project. For now I’ve copied the setup of clj-kondo itself. If anyone wants to give feedback on this pull request that would be very much appreciated https://github.com/athensresearch/athens/pull/38 It’s also for a good cause (an opensource tool for open knowledge)😎
Hi Jeroen. Using the config from clj-kondo itself doesn't make much sense to me as that is used for linting clj-kondo itself. I would just start with a clean slate and add config when needed
Thanks Michiel :)
All options are documented here: https://github.com/borkdude/clj-kondo/blob/master/doc/config.md
echt heel tof die pods. En met jvm helemaal precies wat ik nodig heb straks voor bijvoorbeeld die filewatcher
zag dat je emailadres publiek staat op je github (ook als je niet ingelogd bent). Weet niet of dat je bedoeling was
CLJS does not support multiple requires 😞 https://clojurians.slack.com/archives/CHY97NXE2/p1588920691162900
@wilkerlucio Now I remember: for reader conditionals we just ignored the clauses with respect to sorting. Would that also be good for string requires?
that's a interesting question, I can't remember a time that I used string requires on .cljc, but I see this example in Fulcro: https://github.com/fulcrologic/fulcro/blob/bdb34022d0d51e150b3a3ee1e45a7cdc5ebdea2b/src/main/com/fulcrologic/fulcro/routing/legacy_ui_routers.cljc#L1-L17
No, I mean: ignore string requires with regards to sorting like we do with reader conditionals, not the combination of those two
so, IMO, I like the #? itself to be ignored, but if possible, check the sorting inside, having sam the string consideration (please note this example of fulcro is not actually sorted, but the strings are on top)'
clj-kondo ignores reader conditionals for sorting because the order in which tooling sorts your ns requires is quite undefined
oh, ignore could be an option, feels like group, but if possible I would like better to have the option to enforce it
its so awesome to have kondo on the pipeline getting those 🙂
do you have concerns about adding this complexity to the lint?
I'm more concerned with adding config that's only useful to one person while the second person needs something slightly different and there will be another option
oh, sgtm, I wonder if I'm the first trying to use it with cljs like this (or first talking about it with you :P), or if other people are sorting into the current kondo way
yeah, defaults make a difference for sure
and thanks again for the tool, I had a nice surprise when I see that the notifications got highlighted inline on the editor in intellij, every file watcher extension that I used in the past just did a external read-only console, kudos on that
one idea in my mind, do you think makes sense to use clj-kondo as a base for writing a code formatter? I played with SCI and read a bit on edamame, but I'm not sure for a code formatter which would be make more sense, if any
I recently found this one: https://github.com/greglook/cljstyle
nice, I didn't knew about this one, thanks for the hint
I'm enjoying cljstyle, but one thing though, they sort the namespaces in the way clj-kondo expects -.-
so it might be better to just ignore them with regards to sorting, so there won't be any tooling conflicts
yeah, I'm down to send a PR there
not nescessary for this case, but is it possible to have custom linters on my own source path and make kondo use them?