Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
73054: bazel, ui: targets to run ui linters r=koorosh a=koorosh

This change implements bazel targets to run the same
linters as with `make ui-lint` except compiling
typings with typescript (has to be implemented as
well).
This change doesn't provide single command to run
all targets as a single command, and it has to be
incorporated with `dev` command.

Related to: cockroachdb#71144

Co-authored-by: Andrii Vorobiov <[email protected]>
  • Loading branch information
craig[bot] and koorosh committed Nov 23, 2021
2 parents a5e32e1 + 9c3a992 commit e85866e
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pkg/ui/workspaces/cluster-ui/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@npm//webpack-cli:index.bzl", webpack = "webpack_cli")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("@npm//@bazel/typescript:index.bzl", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")

# TODO (koorosh): keeping the list of deps up to date is a candidate to be
# autogenerated in scope of `dev generate bazel`.
Expand Down Expand Up @@ -186,3 +187,25 @@ js_library(
":webpack",
],
)

nodejs_binary(
name = "eslint",
data = [
".eslintignore",
".eslintrc.json",
"src",
"@npm//eslint",
],
entry_point = "@npm//:node_modules/eslint/bin/eslint.js",
templated_args = [
"--ext .ts",
"--ext .js",
"--ext .tsx",
"--ignore-path",
"$$(rlocation $(rootpath .eslintignore))",
"-c",
"$$(rlocation $(rootpath .eslintrc.json))",
"--format=codeframe",
"$$(rlocation $(rootpath src))",
],
)
36 changes: 36 additions & 0 deletions pkg/ui/workspaces/db-console/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
load("@npm//webpack-cli:index.bzl", webpack = "webpack_cli")
load("@npm//stylint:index.bzl", "stylint")
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")

# TODO (koorosh): keeping the list of deps up to date is a candidate to be
# autogenerated in scope of `dev generate bazel`.
Expand Down Expand Up @@ -206,3 +208,37 @@ filegroup(
],
),
)

stylint(
name = "stylint",
args = [
"-c $(execpath .stylintrc)",
"$(execpath styl)",
],
data = [
".stylintrc",
"fonts",
"src",
"styl",
] + [":node_modules"],
)

nodejs_binary(
name = "eslint",
data = [
".eslintrc.json",
"ccl",
"src",
"@npm//eslint",
],
entry_point = "@npm//:node_modules/eslint/bin/eslint.js",
templated_args = [
"--ext .ts",
"--ext .js",
"--ext .tsx",
"-c",
"$$(rlocation $(rootpath .eslintrc.json))",
"$$(rlocation $(rootpath src))",
"$$(rlocation $(rootpath ccl))",
],
)

0 comments on commit e85866e

Please sign in to comment.