This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-16
Channels
- # babashka (17)
- # calva (35)
- # clerk (31)
- # cljs-dev (3)
- # clojars (1)
- # clojure (16)
- # clojure-europe (4)
- # clojurescript (38)
- # clojutre (2)
- # cursive (8)
- # datomic (16)
- # exercism (5)
- # fulcro (5)
- # gratitude (3)
- # hyperfiddle (55)
- # joyride (1)
- # lsp (40)
- # off-topic (6)
- # portal (64)
- # practicalli (1)
- # reitit (3)
- # releases (1)
- # shadow-cljs (38)
- # sql (1)
- # tools-deps (8)
- # xtdb (9)
Hello here, I’ve been working on this project for days now, suddenly this error shows up. I’m pretty sure there’s no issues with ns declaration, Besides, I am using the Luminous template as my starting leingen templating (Which I use in most cases). Maybe I might be exhausted to figure it out myself right now 😃
Maybe you have copy-pasted something from somewhere into that ns form and that something contains a non-ASCII invisible symbol? Like a non-breaking space or an invisible space.
“from somewhere”?, Even if i had copy-pasted, then its right from other namespace like the :required dependencies, most of the sub-files have similar dependencies.
I think I’ll try the debugging once more. Thanks for the reply @U2FRKM4TW
I really dont think thats the issue.
I also see that :exclude
there that follows :as
. Since you didn't use use
, that :exclude
doesn't make sense.
I located the affected file that i just added today, recreate it, and use calva to auto-import the dependencies. Besides if you create a new file, Calva creates the ns at the top automatically
I used exclude
because there’s collision of a function in cuerdas.core
with clojure.string
which fix the intended purpose
That doesn't make sense. Why would cuerdas.core
collide with clojure.string
in any way? You don't even import clojure.string
.
Perhaps you meant clojure.core
, where parse-long
came from?
But cuerdas.core
, which you import as str
, doesn't even have the parse-long
function.
Yes, I re-created the file and import automatically (without the exclude
still didn’t fix the issue
“MRE”?
1 | (ns editorjs.functions
-------^------------------------------------------------------------------------
null
Invalid namespace declaration
-- Syntax error -------------------
(... ... (:require
["@codexteam/icons" :as icons]
[cuerdas.core :as str :exclude [parse-long]]
[editorjs.general.base :refer [menu-vector plugins]]
[re-frame.core :as rf :refer [dispatch subscribe]]
[reagent.core :as r]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
has extra input
-- Relevant specs -------
:shadow.build.ns-form/ns-form:
(clojure.spec.alpha/cat
:ns
'#{clojure.core/ns}
:name
clojure.core/simple-symbol?
:docstring
(clojure.spec.alpha/? clojure.core/string?)
:meta
(clojure.spec.alpha/? clojure.core/map?)
:clauses
:shadow.build.ns-form/ns-clauses)
-------------------------
Detected 1 error
--------------------------------------------------------------------------------
2 | (:require ["@codexteam/icons" :as icons]
3 | [cuerdas.core :as str :exclude [parse-long]]
4 | [editorjs.general.base :refer [menu-vector plugins]]
5 | [re-frame.core :as rf :refer [dispatch subscribe]]
---------------------------------------------------------------------------
Thats the full error
This particular function.cljs
was working all the way until I added the one file today.
nope. The new file is just like a plugin. I have them many. I build them one after the other. Everything has been going well. Infact, this is about the last plugin from a list of about 10.
All of them share same :required deps
let me show you some few of them
function.cljs
is in the root folder, not in the /plugins/
I can post the full code of a simple plugin (as in my project) for you to check if that can help, cos the project won’t be that easy to reproduce a minimal version as almost all files (except the plugins) depend on each other.
Ah, right. If the project is already public, you can simply push your changes that don't work in a branch and let me know how to get it.
Ok. But befor then, let me try a hack once more to see if it will help, before i can push to remote
I might try running the shadow cljs specs more directly against the ns form, the error message from spec should tell you exactly which spec failed (gives you a path specification you can follow through the tree of code to find which part exactly failed) where the pretty printed output from whatever tooling you are using there is pretty opaque
https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/build/ns_form.clj#L84 the shadow spec here for require classes seems like they must be a simple symbol where you have a string, but hard to tell statically
But i wonder why now, cos i’ve been using the string spec since when i started the project. It’s a node module i imported. Everything has been working smootly until i started working on this file today.
Maybe I’ll remove the file completely and see what happens
This solves the issue for now. Thanks @U2FRKM4TW and @U0NCTKEV8 for your concern
It looks like the shadow spec only allows :exclude
in :refer-clojure
: https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/build/ns_form.clj#L171-L176
As @U2FRKM4TW said, that :exclude
doesn't make any sense: you're not referring in any symbols:
[cuerdas.core :as str :exclude [parse-long]]
You'd be referencing that as (str/parse-long ..)
so it's not going to conflict with anything in that requiring ns.
It may well conflict with the core parse-long
inside cuerdas.core
-- but the solution to that is (:refer-clojure :exclude [parse-long])
to suppress any warnings there.
But that :exclude [parse-long]
is the "extra input" that the spec failure is referring to @U046LLBLNJZ
correct, :exclude
is not allowed there. and even if it was, it would not fix the issue you are trying to fix doing this
Thanks so much for the explanations @U04V70XH6
Same warning