clojure-lsp / clojure-lsp

Clojure & ClojureScript Language Server (LSP) implementation
https://clojure-lsp.io
MIT License
1.15k stars 152 forks source link

Auto-fill `consistent-alias` on clj-kondo on first startup #388

Open ericdallo opened 3 years ago

ericdallo commented 3 years ago

@borkdude suggested that here

borkdude commented 3 years ago

More context:

borkdude @ericdallo idea:
clj-kondo has a :consistent-alias linter, but you have to configure the aliases yourself in how you want to link full namespace names to aliases.
since clojure-lsp scans your entire project, it could figure out what aliases are already used the most for which namespace and then populate this map inside .clj-kondo/config.edn once. (edited) 
New
5:51 PM
ericdallo:emacs: looks a good idea!
5:52 PM
If i have a namespace on this linter for example, str for clojure.string and I write a string/join and require it, it will complain about it, is that right?
5:52 PM
borkdude correct
5:52 PM
ericdallo:emacs: nice, we probably would do that every first time we scan the project?
5:53 PM
I mean, when we do a classpath scan, (new deps or deps changed)
5:53 PM
borkdude yeah and only if the alias isn't already in there
:+1:
1

5:53 PM
and probably also only when you enable it
5:53 PM
ericdallo:emacs: yes, it'd need to be in a disabled feature flag for now