Skip to content
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

Unresolved var (in combination with defroutes?) #1468

Closed
dharrigan opened this issue Nov 22, 2021 · 1 comment
Closed

Unresolved var (in combination with defroutes?) #1468

dharrigan opened this issue Nov 22, 2021 · 1 comment
Projects

Comments

@dharrigan
Copy link
Contributor

dharrigan commented Nov 22, 2021

version
clj-kondo v2021.10.19

macro usage

Configuration file is part of the project, in the .clj-kondo directory

platform

native version, but also ripples through from clojure-lsp

❯ uname -a                
Linux daffy 5.15.3-arch1-1 #1 SMP PREEMPT Thu, 18 Nov 2021 22:23:08 +0000 x86_64 GNU/Linux

editor

neovim with conjure

problem

I'm observing a problem in that clj-kondo is reporting unused-var, even 'tho it is used (and the config defines the defroutes macro). The problem only seems to manifest if there is a function defined before the defroutes macro.

If you comment out lines 6-9 in a/routes.clj, delete the .clj-kondo/.cache directory, then redo the lint check, all is fine.

repro

Please clone this repo. If you run clj-kondo --lint src in the root directory, you should observe this:

❯ clj-kondo --lint src                   
src/online/harrigan/api/router.clj:17:22: warning: Unresolved var: a-routes/public-routes
linting took 32ms, errors: 0, warnings: 1

config

Contained within the project.

expected behavior

It should not report unresolved-var.

Let me know if I can be of further assistance.

@borkdude borkdude added this to Needs triage in clj-kondo via automation Nov 22, 2021
@borkdude borkdude moved this from Needs triage to In progress in clj-kondo Jan 7, 2022
@borkdude
Copy link
Member

borkdude commented Jan 7, 2022

@dharrigan Finally figured it out. The :lint-as configuration has to be on the top level, not under :linters.

@borkdude borkdude closed this as completed Jan 7, 2022
clj-kondo automation moved this from In progress to Done Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
clj-kondo
  
Done
Development

No branches or pull requests

2 participants