Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

build(bazel): fixup custom eslint test rule after bump to rules_js 2 #63143

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions dev/eslint.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,26 @@ def eslint_config_and_lint_root(name = "eslint_config", config_deps = [], root_j
def _custom_eslint_impl(ctx):
copied_srcs = copy_files_to_bin_actions(ctx, ctx.files.srcs)

inputs_depset = depset(
input_targets = [ctx.attr.config] + ctx.attr.deps

input_depsets = [depset(
copied_srcs + [ctx.executable.binary],
transitive = [js_lib_helpers.gather_files_from_js_infos(
targets = [ctx.attr.config] + ctx.attr.deps,
include_sources = False,
targets = input_targets,
include_sources = True, # include sources & transitives sources so the eslint config .js files are picked up
include_types = True, # we have to include types because we need to lint the types.
include_transitive_sources = False,
include_transitive_sources = True, # include sources & transitives sources so the eslint config .js files are picked up
include_transitive_types = True, # we have to include types because we need to lint the types.
include_npm_sources = True,
)],
)
)]

# include runfiles in inputs as well so they can be resolved from the execroot
input_depsets.extend([
target[DefaultInfo].default_runfiles.files
for target in input_targets
if DefaultInfo in target and hasattr(target[DefaultInfo], "default_runfiles")
])

runfiles = js_lib_helpers.gather_runfiles(
ctx = ctx,
Expand Down Expand Up @@ -118,7 +127,7 @@ def _custom_eslint_impl(ctx):
# Generate and run a bash script to wrap the binary
ctx.actions.run_shell(
env = env,
inputs = inputs_depset,
inputs = depset([], transitive = input_depsets),
outputs = [report, exit_code_out],
command = command,
arguments = [args],
Expand Down
Loading