Skip to content

Commit

Permalink
docs: explain which production of ts_project to lint (#76)
Browse files Browse the repository at this point in the history
* docs: explain which production of ts_project to lint

Fixes #74

* fix: typings not typecheck has to be used
  • Loading branch information
alexeagle authored Dec 7, 2023
1 parent 94acce4 commit b877bab
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/eslint.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions lint/eslint.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@ eslint = eslint_aspect(
configs = "@@//path/to:eslintrc",
)
```
### With ts_project
Note, when used with `ts_project` and a custom `transpiler`,
the macro expands to several targets,
see https://github.com/aspect-build/rules_ts/blob/main/docs/transpiler.md#macro-expansion.
Since you want to lint the original TypeScript source files, the `ts_project` rule produced
by the macro is the one you want to lint, so when used with an `eslint_test` you should use
the `[name]_typings` label:
```
ts_project(
name = "my_ts",
transpiler = swc,
...
)
eslint_test(
name = "lint_my_ts",
srcs = [":my_ts_typings"],
)
```
See the [react example](https://github.com/bazelbuild/examples/blob/b498bb106b2028b531ceffbd10cc89530814a177/frontend/react/src/BUILD.bazel#L86-L92)
"""

load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "COPY_FILE_TO_BIN_TOOLCHAINS", "copy_files_to_bin_actions")
Expand Down

0 comments on commit b877bab

Please sign in to comment.