Comments (8)
Related: clj-kondo/clj-kondo#543
from clj-kondo.lsp.
Ran into this issue trying to create custom React components with hx
macros (https://github.com/Lokeh/hx/tree/master/src/hx)
the linter is complaining about the function name and arguments, since it's not catching them as being used or passed in, respectively.
in the snippet below, for example, both App
and initial-name
param cause lint errors:
(defnc App [{:keys [initial-name]}]
(let [[name] (hooks/useState initial-name)]
[rn/View [rn/Text {:style {:font-weight "bold"}} name]]))
(defn start
{:dev/after-load true}
[]
(expo/render-root (hx/f [App {:initial-name "Hello World!"}])))
is there a way to mitigate this?
currently using this library via vscode-clojure-lint
^scratch that, looks like this also comes bundled in @PEZ calva, so uninstalling clojure-lint
got the clj-kondo config overrides working
from clj-kondo.lsp.
@alidcastano
got the clj-kondo config overrides working
Do I understand correctly that your problem was already fixed and there is no action needed from my side?
from clj-kondo.lsp.
well right now i just disabled the unresolved-symbol
rule which isn't ideal. I'd be preferable to have better support for declaring how macros are initialized/used (or at least disabling warnings per line via comments)
which perhaps there is, and i just need to do more digging into docs - just started using clojure! 😅
from clj-kondo.lsp.
@alidcastano Check out the config docs of clj-kondo:
https://github.com/borkdude/clj-kondo/blob/master/doc/config.md
Example:
foo.cljs:
;; I have to guess your namespace form since you didn't provide it:
(ns foo (:require [bar :refer [defnc]]))
(defnc App [{:keys [initial-name]}]
(let [[name] (hooks/useState initial-name)]
[rn/View [rn/Text {:style {:font-weight "bold"}} name]]))
(defn start
{:dev/after-load true}
[]
(expo/render-root (hx/f [App {:initial-name "Hello World!"}])))
No more warnings when linting bar/defnc
as clojure.core/defn
:
$ clj-kondo --lint /tmp/foo.cljs --config '{:lint-as {bar/defnc clojure.core/defn}}'
linting took 16ms, errors: 0, warnings: 0
You can put these rules in .clj-kondo/config.edn
in your workspace.
from clj-kondo.lsp.
oh yeah, I read the config section just wasn't sure what clojure.core
declaration to alias it to. using defn
makes sense since they basically have the same API.
thanks for the clarification!
from clj-kondo.lsp.
Related: clj-kondo/clj-kondo#253
from clj-kondo.lsp.
I have no plans of implementing this.
from clj-kondo.lsp.
Related Issues (11)
- [vscode-extension] e2e + automate publishing package from circleci or gh-actions HOT 1
- IndexOutOfBoundsException with metadata tag lacking something to tag HOT 1
- vscode clj-kondo extention throws NullPointerException HOT 6
- Open VSX Listing: Signing the Publisher Agreement HOT 1
- Detect orphaned parent process
- README mention non-existent script script/build-server HOT 1
- Add docs to server for getting most recent automatically
- Missplaced docstring warning on a defmethod that shouldn't be there HOT 3
- [vscode] `.clj-kondo/config.edn` is not picked up in a multi-folders workspace HOT 4
- Extension causes high cpu load HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clj-kondo.lsp.