This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-09
Channels
- # announcements (1)
- # architecture (20)
- # aws (22)
- # babashka (41)
- # beginners (191)
- # chlorine-clover (66)
- # cider (19)
- # clj-kondo (54)
- # cljs-dev (15)
- # cljsrn (78)
- # clojars (1)
- # clojure (148)
- # clojure-android (4)
- # clojure-europe (7)
- # clojure-gamedev (15)
- # clojure-germany (6)
- # clojure-losangeles (46)
- # clojure-nl (23)
- # clojure-survey (3)
- # clojure-uk (46)
- # clojurescript (24)
- # conjure (21)
- # cursive (21)
- # data-science (11)
- # datomic (5)
- # events (2)
- # fulcro (28)
- # garden (32)
- # joker (2)
- # kaocha (6)
- # lambdaisland (4)
- # mount (2)
- # off-topic (11)
- # pathom (10)
- # pedestal (13)
- # re-frame (7)
- # shadow-cljs (15)
- # spacemacs (21)
- # specmonstah (1)
- # wasm (1)
- # windows (1)
- # xtdb (37)
Could this be a bug? https://nextjournal.com/helios/clj-kondo-md-repro There's something off with js interop and detecting whether we use or not a required ns
$ plk
ClojureScript 1.10.520
cljs.user=> (require '[clojure.set :as s])
nil
cljs.user=> s
^
WARNING: Use of undeclared Var cljs.user/s at line 1
nil
^ @helios Not sure if I understand your repro. Could you post some real working code using CLJS only?(ns foo
(:require [markdown-it-texmath :as md-texmath]))
(use md-texmath)
will say that markdown-it-texmath is required but never usedif this is about requiring namespaces using use
I'd say this is pretty weird code, especially in CLJS?
https://github.com/clojure/clojurescript/blob/r1.10.597/src/main/clojure/cljs/core.cljc#L3019
if you could go through the trouble setting up a small CLJS project which has this code and I can run this using the clojure CLI, I'd be happy to take a further look
@helios I still don't understand why this code should work at all. Using use
is very rare in CLJS, especially in a threaded expression
because use
requires namespaces and md-texmath
is an alias? normally you use aliases like (md-texmath/foobar)
to refer to a function of a namespace
What I expect to see is something like:
(ns foo
(:require [markdown-it-texmath :as md-texmath]))
(md-texmath/dude)
Okay, i'll investigate a bit further to understand what the snipped with the threading is supposed to do and why it's not blowing up in our codebase
in the example above use
in this case is an instance method of the return value of md
not the clojure use
, it’s threaded cljs style with the dot-dot ..
@andrea712 Is it possible to create a small repro that I can run with e.g. lumo? I can npm install any lib and then run a script with lumo. Should be relatively easy to do
can discuss it with @helios, I’m not an expert in the field but maybe we’d need to make lumo aware of some piece of cljs compiler options about :global-exports
? cc @kommen
@andrea712 using pure CLJS is also fine, as long as I can run it to see what's happening
I just thought lumo would be less work, since you can just run a script, but a small repro repo using no downstream tooling might be better
Never mind, I think this is enough repro:
(require '[foo.lib :as foo])
(def x #js {:use (fn [x] x)})
(.. x (use foo))
@helios @andrea712 Now I remember. Use can or maybe even should use string namespace names for npm libs:
(require '["foo.lib" :as foo])
(def x #js {:use (fn [x] x)})
(.. x (use foo))
Then this won't give false positives anymore.so this works 100% free of errors:
(ns foo
(:require
["markdown-it" :as md]
["markdown-it-texmath" :as md-texmath]
[com.nextjournal.editor.markdown.todo-lists :as todo-lists]
[com.nextjournal.editor.markdown.gh-preamble :as gh-preamble]))
(def mdit (.. (md #js{:linkify true :breaks false :html true})
(use md-texmath)
(use gh-preamble/Plugin)
(use todo-lists/Plugin)))
@borkdude I notice that -main
only returns a non-zero exit status for warnings and errors, which means that linter-kondo
doesn't attempt to parse the response for any info level reports. What's your reasoning behind that, and how do you view info level linters overall?
@seancorfield hmm, flycheck does show info level, regardless of the exit code. exit code non zero usually means something is wrong. when you have no errors or warning, nothing is wrong
I'm sure gerred will take a PR to change it. ^ @seancorfield
Yeah, I might go that route. Was just curious to hear your take on what you expected :info
to be used for.
@gerred How do you feel about linter-kondo
always parsing the output and showing :info
level responses?
(I don't know how they would map into Atom's annotations on lines etc?)
https://github.com/gerred/linter-kondo/issues/4 created as a placeholder for that work.
(my use case is that I'd like to have missing docstring as :info
level so they are still flagged but don't constitute a "failure")
@seancorfield I guess you can just write a shell script named clj-kondo, put that on your path, exit a non-zero exit code and print some clj-kondo like info lines before exiting, just to see how Atom responds to it.
@borkdude linter-kondo
doesn't pick up :info
at all right now so that wouldn't work.
@seancorfield Another thought: I bet there is some generic linter package for Atom in which you can point to an executable or script that returns linting output. Maybe: https://atom.io/packages/linter The output that clj-kondo and joker produce is a generally accepted format
I might take a look when I'm not working on other stuff 🙂