Enforce buildifier on CircleCI
Remove legacy Skylint configuration
PiperOrigin-RevId: 226241224
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 33b3318..150c499 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -111,10 +111,19 @@
steps:
- checkout:
<<: *post_checkout
- - run: .circleci/setup_cache.sh
- - run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- - *setup-bazel-remote-cache
- - run: yarn skylint
+
+ - run: yarn install
+
+ # Run the skylark linter to check our Bazel rules
+ # Note, this is not yet enforced, because
+ # - buildifier doesn't exit non-zero in the presence of lint warnings: https://github.com/bazelbuild/buildtools/issues/470
+ # - false positive for rule docstrings: https://github.com/bazelbuild/buildtools/issues/471
+ - run: 'yarn bazel:lint ||
+ (echo -e "\n.bzl files have lint errors. Please run ''yarn bazel:lint-fix''"; exit 1)'
+
+ # Enforce that BUILD files are formatted.
+ - run: 'yarn bazel:format -mode=check ||
+ (echo "BUILD files not formatted. Please run ''yarn bazel:format''" ; exit 1)'
workflows:
version: 2
diff --git a/examples/googmodule/BUILD.bazel b/examples/googmodule/BUILD.bazel
index 5ed37cb..6bc149c 100644
--- a/examples/googmodule/BUILD.bazel
+++ b/examples/googmodule/BUILD.bazel
@@ -8,7 +8,6 @@
tsconfig = "tsconfig.json",
)
-
es5_consumer(
name = "es5_output",
deps = [":googmodule"],
diff --git a/internal/common/module_mappings.bzl b/internal/common/module_mappings.bzl
index 06bca05..d085d72 100644
--- a/internal/common/module_mappings.bzl
+++ b/internal/common/module_mappings.bzl
@@ -22,7 +22,6 @@
"""Module mappings.
"""
-
def _get_deps(attrs, names):
return [
d
diff --git a/internal/common/tsconfig.bzl b/internal/common/tsconfig.bzl
index 971bd83..0b1fcda 100644
--- a/internal/common/tsconfig.bzl
+++ b/internal/common/tsconfig.bzl
@@ -134,6 +134,7 @@
# See javascript/typescript/compiler/tsc_wrapped.ts:BazelOptions.
# Unlike compiler_options, the paths here are relative to the rootDir,
# not the location of the tsconfig.json file.
+ # @unsorted-dict-items preserve historical order for golden tests
bazel_options = {
"workspaceName": ctx.workspace_name,
"target": str(ctx.label),
@@ -175,6 +176,7 @@
target_language_level = "es5" if devmode_manifest or has_node_runtime else "es2015"
# Keep these options in sync with those in playground/playground.ts.
+ # @unsorted-dict-items preserve historical order for golden tests
compiler_options = {
# De-sugar to this language level
"target": target_language_level,
@@ -266,6 +268,7 @@
compiler_options["traceResolution"] = True
compiler_options["diagnostics"] = True
+ # @unsorted-dict-items preserve historical order for golden tests
return {
"compilerOptions": compiler_options,
"bazelOptions": bazel_options,
diff --git a/internal/tsetse/tests/check_return_value/BUILD b/internal/tsetse/tests/check_return_value/BUILD
index 1e7188d..502aa27 100644
--- a/internal/tsetse/tests/check_return_value/BUILD
+++ b/internal/tsetse/tests/check_return_value/BUILD
@@ -16,7 +16,6 @@
licenses(["notice"]) # Apache 2.0
-
error_message = "TS21222: return value is unused.\\n\\tSee http://tsetse.info/check-return-value"
ts_library(
diff --git a/internal/tsetse/tests/equals_nan/BUILD b/internal/tsetse/tests/equals_nan/BUILD
index db8a287..6fad147 100644
--- a/internal/tsetse/tests/equals_nan/BUILD
+++ b/internal/tsetse/tests/equals_nan/BUILD
@@ -16,7 +16,6 @@
licenses(["notice"]) # Apache 2.0
-
ts_library(
name = "positives",
testonly = 1,
diff --git a/internal/tsetse/tests/must_use_promises/BUILD b/internal/tsetse/tests/must_use_promises/BUILD
index cc73c8a..9f88bd5 100644
--- a/internal/tsetse/tests/must_use_promises/BUILD
+++ b/internal/tsetse/tests/must_use_promises/BUILD
@@ -16,7 +16,6 @@
licenses(["notice"]) # Apache 2.0
-
error_message = "TS21225: All Promises in async functions must either be awaited or used in an expression."
ts_library(
diff --git a/package.json b/package.json
index 77ac9cd..607e203 100644
--- a/package.json
+++ b/package.json
@@ -53,9 +53,6 @@
"e2e-package_typescript_3.1_no_npm": "cd internal/e2e/package_typescript_3.1_no_npm; bazel test ...",
"e2e-package_typescript_karma": "cd internal/e2e/package_typescript_karma; bazel test ...",
"e2e-ts_auto_deps": "cd internal/e2e/ts_auto_deps; bazel run @build_bazel_rules_typescript//ts_auto_deps -- -recursive && bazel build simple",
- "preskylint": "bazel build --noshow_progress @io_bazel//src/tools/skylark/java/com/google/devtools/skylark/skylint:Skylint",
- "//": "disable deprecated-api skylint check because we must make legacy-style providers for TS interop in google3",
- "skylint": "find . -type f -name \"*.bzl\" ! -path \"*/node_modules/*\" | xargs $(bazel info bazel-bin)/external/io_bazel/src/tools/skylark/java/com/google/devtools/skylark/skylint/Skylint --disable-checks=deprecated-api",
"skydoc": "bazel build //docs && unzip -o -d docs/api bazel-bin/docs/docs-skydoc.zip",
"version": "node ./on-version.js && git stage package.bzl",
"bazel:format": "find . -type f \\( -name \"*.bzl\" -or -name WORKSPACE -or -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs buildifier -v --warnings=args-order,attr-cfg,attr-license,attr-non-empty,attr-output-default,attr-single-file,constant-glob,ctx-actions,ctx-args,depset-iteration,depset-union,dict-concatenation,duplicated-name,filetype,git-repository,http-archive,integer-division,load,load-on-top,native-build,native-package,out-of-order-load,output-group,package-name,package-on-top,positional-args,redefined-variable,repository-name,same-origin-load,string-iteration,unsorted-dict-items,unused-variable",