Skip to content

Commit

Permalink
chore: compatibility with rules_js 2 (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle authored May 10, 2024
1 parent 906cb3e commit 011adc6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions example/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

bazel_dep(name = "aspect_rules_lint", version = "0.0.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.6.1")
bazel_dep(name = "aspect_rules_js", version = "1.40.0")
bazel_dep(name = "aspect_rules_ts", version = "2.2.0")
bazel_dep(name = "aspect_rules_js", version = "2.0.0-alpha.4")
bazel_dep(name = "aspect_rules_ts", version = "3.0.0-alpha.0")
bazel_dep(name = "rules_buf", version = "0.2.0")
bazel_dep(name = "bazel_skylib", version = "1.4.2")
bazel_dep(name = "toolchains_llvm", version = "0.10.3")
Expand Down
26 changes: 19 additions & 7 deletions lint/eslint.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,25 @@ def _gather_inputs(ctx, srcs):
inputs = copy_files_to_bin_actions(ctx, srcs)

# Add the config file along with any deps it has on npm packages
inputs.extend(js_lib_helpers.gather_files_from_js_providers(
ctx.attr._config_files + [ctx.attr._workaround_17660, ctx.attr._formatter],
include_transitive_sources = True,
include_declarations = False,
include_npm_linked_packages = True,
).to_list())

if "gather_files_from_js_providers" in dir(js_lib_helpers):
# rules_js 1.x
js_inputs = js_lib_helpers.gather_files_from_js_providers(
ctx.attr._config_files + [ctx.attr._workaround_17660, ctx.attr._formatter],
include_transitive_sources = True,
include_declarations = False,
include_npm_linked_packages = True,
)
else:
# rules_js 2.x
js_inputs = js_lib_helpers.gather_files_from_js_infos(
ctx.attr._config_files + [ctx.attr._workaround_17660, ctx.attr._formatter],
include_sources = True,
include_transitive_sources = True,
include_types = False,
include_transitive_types = False,
include_npm_sources = True,
)
inputs.extend(js_inputs.to_list())
return inputs

def eslint_action(ctx, executable, srcs, report, exit_code = None):
Expand Down

0 comments on commit 011adc6

Please sign in to comment.