diff --git a/bazelisk b/bazelisk new file mode 100755 index 00000000..48a45abd Binary files /dev/null and b/bazelisk differ diff --git a/example/.bazelrc b/example/.bazelrc index a2b5a20c..0b14a7a5 100644 --- a/example/.bazelrc +++ b/example/.bazelrc @@ -19,3 +19,9 @@ startup --windows_enable_symlinks common:linux --action_env=BAZEL_CXXOPTS="-std=c++20" common:windows --action_env=BAZEL_CXXOPTS="/std:c++20" +###################### +# Linters +# https://github.com/aspect-build/rules_lint/blob/v1.7.0/docs/linting.md#4-errors-during-bazel-build +# +build --@aspect_rules_lint//lint:fail_on_violation +build --aspects=//tools/lint:linters.bzl%eslint diff --git a/example/MODULE.bazel b/example/MODULE.bazel index 9e3ccfa3..9a430b62 100644 --- a/example/MODULE.bazel +++ b/example/MODULE.bazel @@ -162,3 +162,23 @@ ruby.bundle_fetch( use_repo(ruby, "bundle", "ruby", "ruby_toolchains") register_toolchains("@ruby_toolchains//:all") + +# Read more about it https://blog.aspect.build/hermetic-c-toolchain +bazel_dep(name = "gcc_toolchain", version = "0.9.0") + +gcc_toolchains = use_extension("@gcc_toolchain//toolchain:module_extensions.bzl", "gcc_toolchains", dev_dependency = True) +gcc_toolchains.toolchain( + name = "gcc_toolchain_x86_64", + extra_ldflags = [ + "-lstdc++", # Need this flag for C++ stdlib https://github.com/f0rmiga/gcc-toolchain/tree/main/docs#c + "-l:libstdc++.a", # This is for static linking https://github.com/f0rmiga/gcc-toolchain/tree/main/docs#linking-c-standard-library + ], + gcc_version = "15.2.0", + target_arch = "x86_64", +) +use_repo(gcc_toolchains, "gcc_toolchain_x86_64") + +register_toolchains( + "@gcc_toolchain_x86_64//:cc_toolchain", + dev_dependency = True, +) diff --git a/example/bazelisk b/example/bazelisk new file mode 100755 index 00000000..48a45abd Binary files /dev/null and b/example/bazelisk differ diff --git a/example/eslint.config.mjs b/example/eslint.config.mjs index 05cac957..e5eae5c1 100644 --- a/example/eslint.config.mjs +++ b/example/eslint.config.mjs @@ -17,6 +17,9 @@ export default tseslint.config( project: true, }, }, + rules: { + "no-unused-vars": "error", + }, }, // Demonstrate override for a subdirectory. // Note that unlike eslint 8 and earlier, it does not resolve to a configuration file diff --git a/example/src/file.ts b/example/src/file.ts index 51ed3a99..3f65edf4 100644 --- a/example/src/file.ts +++ b/example/src/file.ts @@ -2,6 +2,8 @@ import dayjs from "dayjs"; import { Greeter } from "./file-dep"; +const unused = "dsfdsfdsf"; // this is an unused var linting violation + // this is a linting violation, and is auto-fixed under `--fix` const a: string = "a"; console.log(a);