Arbitrary `:meta` expression AST nodes for a linter

I’m building some tooling that performs static analysis of Julia code, which is similar to eslint in some ways. It’s currently using Expr and Expronicon.jl for parsing and pattern matching with MLStyle.jl. Let’s call it CodeQuality.

I want to add expression-local exception mechanism for CodeQuality. Something like eslint’s ignore comment directives: // eslint-disable-next-line no-console.

Since Julia discards comment information when parsing to Expr, I cannot use comments easily, so I should probably hook more directly into JuliaSyntax to look into whitespace and that’s quite of a challenge at the moment.

What I’m trying to achieve, is some custom Expr(:meta, ...) to be easily inserted into the target package, which should not depend on CodeQuality at all.

Something like

@codequality_ignore UnreferencedUsing using Foo: bar     # bar is used in the module but CodeQuality catches it as unreferenced

It could be achieved with something similar to Julia internal macros:

julia> @macroexpand @inline f(x) = x^2
:(f(x) = begin
          $(Expr(:meta, :inline))
          #= REPL[1]:1 =#
          x ^ 2
      end)

But it would require @codequality_ignore to be defined in the module where it’s being used, and that requires a hard dependency to CodeQuality, which I’m trying to avoid.

Is anyone aware of some Julia internal macro that adds arbitrary Expr(:meta, ...) expressions, or something similar? Like, ignored, meta-only AST nodes?