Fork me on GitHub
#clojurescript
<
2023-04-16
>
Nasiru Ibrahim19:04:32

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 😃

p-himik19:04:33

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.

Nasiru Ibrahim19:04:05

“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.

Nasiru Ibrahim19:04:36

I think I’ll try the debugging once more. Thanks for the reply @U2FRKM4TW

Nasiru Ibrahim20:04:02

I really dont think thats the issue.

p-himik20:04:45

I also see that :exclude there that follows :as. Since you didn't use use, that :exclude doesn't make sense.

Nasiru Ibrahim20:04:07

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

Nasiru Ibrahim20:04:52

I used exclude because there’s collision of a function in cuerdas.core with clojure.string which fix the intended purpose

p-himik20:04:50

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.

p-himik20:04:07

Have you tried removing that :exclude [parse-long]?

Nasiru Ibrahim20:04:46

Yes, I re-created the file and import automatically (without the exclude still didn’t fix the issue

p-himik20:04:57

That's more than weird. Can you post an MRE somewhere?

Nasiru Ibrahim20:04:32

“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]]
---------------------------------------------------------------------------

Nasiru Ibrahim20:04:15

Thats the full error

p-himik20:04:26

Minimum Reproducible Example.

Nasiru Ibrahim20:04:37

This particular function.cljs was working all the way until I added the one file today.

p-himik20:04:41

So the editorjs.functions is not in the new file? What's in the new file then?

Nasiru Ibrahim20:04:17

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

Nasiru Ibrahim20:04:43

let me show you some few of them

Nasiru Ibrahim20:04:33

function.cljs is in the root folder, not in the /plugins/

p-himik20:04:12

Yeah, I don't think I can be of much help here without an MRE.

Nasiru Ibrahim20:04:24

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.

p-himik20:04:50

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.

Nasiru Ibrahim20:04:22

Ok. But befor then, let me try a hack once more to see if it will help, before i can push to remote

hiredman20:04:09

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

hiredman20:04:21

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

p-himik20:04:58

The ::lib spec allows strings.

Nasiru Ibrahim20:04:33

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.

Nasiru Ibrahim20:04:59

Maybe I’ll remove the file completely and see what happens

Nasiru Ibrahim21:04:09

This solves the issue for now. Thanks @U2FRKM4TW and @U0NCTKEV8 for your concern

👍 2
seancorfield21:04:09

As @U2FRKM4TW said, that :exclude doesn't make any sense: you're not referring in any symbols:

[cuerdas.core :as str :exclude [parse-long]]

seancorfield21:04:07

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.

seancorfield21:04:25

But that :exclude [parse-long] is the "extra input" that the spec failure is referring to @U046LLBLNJZ

❤️ 2
2
🙏 2
thheller21:04:07

correct, :exclude is not allowed there. and even if it was, it would not fix the issue you are trying to fix doing this

Nasiru Ibrahim23:04:31

Thanks so much for the explanations @U04V70XH6