-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: clj-kondo defc linter #10
base: master
Are you sure you want to change the base?
Conversation
I have never used clj-kondo, so I have no idea what this is or how it works. It'll likely take some time before I get a chance to figure this out. I like the idea though. |
Sure! I've done a fair bit of work w/ clj-kondo hooks so feel free to ask (here or Clojurians slack) if you have any questions or want any specific functionality. |
This is great and something I've been putting off doing for a long time :) Thank you! Some observations:
After making minor modifications for the first two points above, my project is linted correctly. Thanks again! |
ee72ff4
to
ea6272e
Compare
@zeitstein Thanks for the feedback! I have updated the PR to handle |
ea6272e
to
9e7edd4
Compare
Hey @thheller I wonder if you might reconsider merging this for those of us that do use |
9ed594c
to
be660de
Compare
I ended up updating this to also support
|
Also @thheller if you still aren't familiar with clj-kondo but want to see what this does... In a project with clj-kondo --lint $(clojure -Spath) --dependencies --skip-lint --copy-configs Followed by
And you will get error messages for invalid usage of shadow-grove |
I still have not looked into how clj-kondo works, or rather how it discovers these files. Do they actually need to be in the library .jar itself or just on the classpath? I don't mind merging this, but I'd rather know what I'd get myself into beforehand. Also if anything skip the |
be660de
to
967d5c8
Compare
Introduce a linter for the `defc` macro. It has the following features: - Ensure that a `defc` has a `render` definition - Ensure that only valid hooks can be defined inside defc (ie. `hook`, `render`, `bind`, `event`) - Ensure that events are defined with valid arity - Provide information to clj-kondo so that symbols from `bind` can be linted (eg. unused vars) Ultimately this could be extended with other things (eg. ensuring that definitions are provided for events specified in render functions) but this felt like a good-enough start.
967d5c8
to
caf775b
Compare
@thheller clj-kondo works by looking for |
Introduce a linter for the
defc
macro. It has the following features:defc
has arender
definitionhook
,render
,bind
,event
)bind
can be linted (eg. unused vars)Ultimately this could be extended with other things (eg. ensuring that definitions are provided for events specified in render functions, linting hiccup, ensuring
render
uses<<
, etc.) but this felt like a good-enough start.