Cljure FAQ

January 30, 2022

Recently I try to learn clojure.

Here are some problem noted that I face when I play in clojure & clojurescript

what is .cljc file

When Clojure or ClojureScript needs to load a namespace, they first look for the platform-specific file (.class then .clj on Clojure and .cljs on ClojureScript) and if not found, then they look for the .cljc file.

Clojure versions >= 1.7, I can name a file foo.cljc if I want it to be available for loading with require or use both from Clojure and Clojurescript.

ref here

custom macro linter error

ref here

define custom config :lint-as treat custom macro as built-in macro:

	  {:lint-as {rum.core/defcs clojure.core/def}
	   :linters {:unresolved-symbol {:exclude [(rum.core/defcs)]}}}

Also note from here:

There is four way to setup linter config:

  1. home dir config in ~/.config/clj-kondo/config.edn (respects XDGCONFIGHOME)
  2. project config: a config.edn file in the .clj-kondo directory
  3. :config-paths in project config.edn: a list of directories that provide additional config
  4. command line --config file or EDN arguments
  5. namespace local config using :clj-kondo/config metadata in the namespace form


Written by Howard Chang , software engineer, programming lover, from Taiwan