title: Linting / format rule for a whole project
body: <p>I'm trying to make a rule that lint all my code (every languages that I use on this project).
  But I'm having some hard time making this.</p>
  
  <p>As I said, the best idea that came in my mind to lint the whole project was to create a <code>lint</code> rule and put every linting rules in it (<code>eslint</code> for js &amp; ts, <code>golang/lint</code> for go, etc...).</p>
  
  <p>Here's my current rule:</p>
  
  <pre class="lang-py prettyprint-override"><code># //:rules/lint.bzl
  
  load("@npm//eslint:index.bzl", "eslint")
  
  def _lint(ctx):
    # js / ts
    eslint(
      name = "eslint",
      args = [
        "\"**/*.{ts, js}\"", # I don't think this is going to work, maybe with `location`?
      ],
    )
  
  lint = rule(
    implementation = _lint,
  )
  </code></pre>
  
  <p>And in my root's <code>BUILD.bazel</code>:</p>
  
  <pre class="lang-py prettyprint-override"><code># //:BUILD.bazel
  
  load("//:rules/lint.bzl", "lint")
  
  lint(name = "lint")
  </code></pre>
  
  <p>If I try to <code>bazel run //:lint</code> it throw me this:</p>
  
  <pre><code>ERROR: Cannot run target //:lint: Not executable
  </code></pre>
  
  <p>And with <code>bazel build</code>:</p>
  
  <pre><code>ERROR: /home/anatole/dev/Iris/BUILD.bazel:12:1: in lint rule //:lint:
  Traceback (most recent call last):
          File "/home/anatole/dev/Iris/BUILD.bazel", line 12
                  lint(name = 'lint')
          File "/home/anatole/dev/Iris/rules/lint.bzl", line 4, in _lint
                  eslint(name = "eslint", &lt;1 more arguments&gt;)
          File "/home/anatole/.cache/bazel/_bazel_anatole/dea21c474582f8d9afdfb2cbf2e414cf/external/npm/eslint/index.bzl", line 11, in eslint
                  nodejs_binary(&lt;5 more arguments&gt;)
  rule() can only be called during the loading phase
  ERROR: Analysis of target '//:lint' failed; build aborted: Analysis of target '//:lint' failed; build aborted
  </code></pre>
  
  <p>And I have no idea why because if I directly put the <code>eslint</code> rule in my root's <code>BUILD.bazel</code> it  doesn't throw any error (but there's still this <code>**/*.{ts, js}</code> issue).</p>
  
  <p>Maybe there's a better way to do all this, I'm beginning with Bazel.</p>