File
Blob: build/lint_test.bzl
| 1 | load("@npm//:eslint/package_json.bzl", eslint_bin = "bin") |
| 2 | |
| 3 | def lint_test( |
| 4 | name, |
| 5 | eslintrc_json, |
| 6 | tsconfig_json, |
| 7 | srcs, |
| 8 | data = [], |
| 9 | no_copy_to_bin = []): |
| 10 | js_srcs = [src for src in srcs if src.endswith(".ts") or src.endswith(".mts") or src.endswith(".js") or src.endswith(".mjs")] |
| 11 | |
| 12 | eslint_bin.eslint_test( |
| 13 | size = "large", |
| 14 | name = name + "@eslint", |
| 15 | args = [ |
| 16 | "--config $(location {})".format(eslintrc_json), |
| 17 | "--report-unused-disable-directives", |
| 18 | ] + ["$(location " + src + ")" for src in js_srcs], |
| 19 | data = srcs + data + [ |
| 20 | eslintrc_json, |
| 21 | tsconfig_json, |
| 22 | "@workerd//tools:base-tsconfig", |
| 23 | "@workerd//tools:base-eslint", |
| 24 | ], |
| 25 | no_copy_to_bin = no_copy_to_bin, |
| 26 | tags = ["lint"], |
| 27 | target_compatible_with = select({ |
| 28 | "@platforms//os:windows": ["@platforms//:incompatible"], |
| 29 | "//conditions:default": [], |
| 30 | }), |
| 31 | ) |