Skip to content

Commit

Permalink
refactor: pre-commit all files
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle committed Oct 12, 2023
1 parent 496572a commit 72d28a0
Show file tree
Hide file tree
Showing 13 changed files with 980 additions and 315 deletions.
8 changes: 4 additions & 4 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
bcr_test_module:
module_path: 'e2e/smoke'
module_path: "e2e/smoke"
matrix:
platform: ['debian10', 'macos', 'ubuntu2004', 'windows']
platform: ["debian10", "macos", "ubuntu2004", "windows"]
tasks:
run_tests:
name: 'Run test module'
name: "Run test module"
platform: ${{ platform }}
test_targets:
- '//...'
- "//..."
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ default_language_version:
repos:
# Check formatting and lint for starlark code
- repo: https://github.com/keith/pre-commit-buildifier
rev: 4.0.1.1
rev: 6.3.3
hooks:
- id: buildifier
- id: buildifier-lint
Expand Down
3 changes: 3 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"Bazel dependencies"

module(
name = "aspect_rules_lint",
version = "0.0.0",
Expand All @@ -13,8 +14,10 @@ bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "rules_go", version = "0.39.1", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.31.0", dev_dependency = True)
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependency = True)

bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
bazel_dep(name = "rules_buf", version = "0.1.1")

# Needed due to rules_proto leaking the dependency
bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf")

Expand Down
6 changes: 3 additions & 3 deletions example/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env node */
module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint/eslint-plugin'],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint/eslint-plugin"],
root: true,
};
12 changes: 9 additions & 3 deletions example/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ compile_pip_requirements(

npm_link_all_packages(name = "node_modules")

exports_files(["buf.yaml", ".flake8"], visibility = ["//visibility:public"])
exports_files(
[
"buf.yaml",
".flake8",
],
visibility = ["//visibility:public"],
)

# We can test that it works with:
# bazel run :flake8 -- --help
Expand All @@ -27,7 +33,7 @@ js_library(
name = "eslintrc",
srcs = [".eslintrc.cjs"],
deps = [
":node_modules/@typescript-eslint/eslint-plugin",
":node_modules/@typescript-eslint/parser",
":node_modules/@typescript-eslint/eslint-plugin",
":node_modules/@typescript-eslint/parser",
],
)
13 changes: 6 additions & 7 deletions example/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"Bazel dependencies"
bazel_dep(name = "aspect_rules_lint", dev_dependency = True, version = "0.0.0")

bazel_dep(name = "aspect_rules_lint", version = "0.0.0", dev_dependency = True)
bazel_dep(name = "aspect_bazel_lib", version = "1.31.2", dev_dependency = True)
bazel_dep(name = "aspect_rules_js", version = "1.32.2", dev_dependency = True)
bazel_dep(name = "aspect_rules_ts", version = "1.3.3", dev_dependency = True)
bazel_dep(name = "rules_python", version = "0.26.0", dev_dependency = True)
bazel_dep(name = "bazel_skylib", dev_dependency = True, version = "1.4.1")
bazel_dep(name = "bazel_skylib", version = "1.4.1", dev_dependency = True)

# Needed due to rules_proto leaking the dependency
bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
Expand All @@ -19,13 +21,10 @@ rules_ts_ext = use_extension(
"ext",
dev_dependency = True,
)

rules_ts_ext.deps()

use_repo(rules_ts_ext, "npm_typescript")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)

npm.npm_translate_lock(
name = "npm",
npmrc = "//:.npmrc",
Expand All @@ -34,19 +33,19 @@ npm.npm_translate_lock(
"@typescript-eslint/eslint-plugin": [""],
},
)

use_repo(npm, "npm")

python_version = "3.9"

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = python_version,
)

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
python_version = python_version,
hub_name = "pip",
python_version = python_version,
requirements_lock = "//:requirements.txt",
)
use_repo(pip, "pip")
2 changes: 1 addition & 1 deletion example/lint.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"Define linter aspects"

load("@aspect_rules_lint//lint:eslint.bzl", "eslint_aspect")
load("@aspect_rules_lint//lint:buf.bzl", "buf_lint_aspect")
load("@aspect_rules_lint//lint:eslint.bzl", "eslint_aspect")
load("@aspect_rules_lint//lint:flake8.bzl", "flake8_aspect")

buf = buf_lint_aspect(
Expand Down
Loading

0 comments on commit 72d28a0

Please sign in to comment.