Skip to content

Support specifying langs for linters #2521

@yenda

Description

@yenda

Is your feature request related to a problem? Please describe.

Yes, there is a var I want to discourage in clj but not in cljs code, so I would like to be able to specify the langs on which a linter applies.

Here is an example, I have this config:

:discouraged-var
           {com.fulcrologic.fulcro-i18n.i18n/with-locale
            {:message "Please use brian.translation/with-locale instead"
             :level :error}}

which lints:

test/brian/i18n_linter_test.clj:8:3: error: Please use brian.translation/with-locale instead
test/brian/i18n_linter_test.cljc:8:3: error: Please use brian.translation/with-locale instead [clj, cljs]
test/brian/i18n_linter_test.cljc:14:6: error: Please use brian.translation/with-locale instead [clj]
test/brian/i18n_linter_test.cljc:20:6: error: Please use brian.translation/with-locale instead [cljs]
test/brian/i18n_linter_test.cljs:7:3: error: Please use brian.translation/with-locale instead

but I would want instead to only lint:

test/brian/i18n_linter_test.clj:8:3: error: Please use brian.translation/with-locale instead
test/brian/i18n_linter_test.cljc:8:3: error: Please use brian.translation/with-locale instead [clj]
test/brian/i18n_linter_test.cljc:14:6: error: Please use brian.translation/with-locale instead [clj]

only applying the linter to clj lang not cljs, including distinction between clj/cljs code in cljc files (which kondo already does with :langs true)

Describe the solution you'd like

Most obvious solution that comes to mind would be to allow for a langs config but any solution that would enable that would be fine by me

:discouraged-var
           {com.fulcrologic.fulcro-i18n.i18n/with-locale
            {:message "Please use brian.translation/with-locale instead"
             :level :error
              :langs [clj}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions