mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 12:51:55 +00:00
chore(bazel): fixup custom eslint test rule after bump to rules_js 2 (#63143)
This regressed in https://github.com/sourcegraph/sourcegraph/pull/63022 where the custom `gather_files_from_js_providers` function that was copied over from rules_js 1.x was including runfiles. Resolves eslint failures seen in https://buildkite.com/sourcegraph/sourcegraph/builds/277072#018fe743-abac-44d8-911b-d5a7ed425413 and observed locally: ``` (07:19:15) INFO: From ESLint client/wildcard/wildcard_lib_eslint-output.txt: | | Oops! Something went wrong! :( | | ESLint: 8.57.0 | | ESLint couldn't find a configuration file. To set up a configuration file for this project, please run: | | npm init @eslint/config | | ESLint looked for configuration files in /tmp/bazel-working-directory/__main__/bazel-out/k8-fastbuild/bin/client/wildcard/src/components/Alert and its ancestors. If it found none, it then looked in your home directory. | | If you think you already have a configuration file or if you need more help, please stop by the ESLint Discord server: https://eslint.org/chat ``` ## Test plan CI (check test logs) ## Changelog
This commit is contained in:
parent
c5f0e9b7ec
commit
27da7890fc
@ -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,
|
||||
@ -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],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user