Skip to content

Commit fd3733a

Browse files
committed
fix types eslint config and reenable more strict checks
1 parent d5e3b9c commit fd3733a

24 files changed

+166
-1012
lines changed

build/wd_ts_project.bzl

+28-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,41 @@
11
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
2+
load("@npm//:eslint/package_json.bzl", eslint_bin = "bin")
23

3-
def wd_ts_project(name, srcs, deps, testonly = False):
4+
def wd_ts_project(name, srcs, deps, eslintrc_json = None, testonly = False):
45
"""Bazel rule for a workerd TypeScript project, setting common options"""
56

7+
tsconfig = "//types:tsconfig.json"
8+
69
ts_project(
710
name = name,
811
srcs = srcs,
912
deps = deps,
10-
tsconfig = "//types:tsconfig.json",
13+
tsconfig = tsconfig,
1114
allow_js = True,
1215
composite = True,
1316
source_map = True,
1417
testonly = testonly,
1518
)
19+
20+
if eslintrc_json:
21+
eslint_bin.eslint_test(
22+
size = "large",
23+
name = name + "@eslint",
24+
args = [
25+
"--config $(location {})".format(eslintrc_json),
26+
"--parser-options project:$(location {})".format(tsconfig),
27+
"-f stylish",
28+
"--report-unused-disable-directives",
29+
] + ["$(location " + src + ")" for src in srcs],
30+
data = srcs + deps + [
31+
eslintrc_json,
32+
tsconfig,
33+
"//tools:base-eslint",
34+
"//:prettierrc",
35+
],
36+
tags = ["lint"],
37+
target_compatible_with = select({
38+
"@platforms//os:windows": ["@platforms//:incompatible"],
39+
"//conditions:default": [],
40+
}),
41+
)

build/wd_ts_test.bzl

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ load("@aspect_rules_js//js:defs.bzl", "js_test")
22
load("//:build/typescript.bzl", "js_name", "module_name")
33
load("//:build/wd_ts_project.bzl", "wd_ts_project")
44

5-
def wd_ts_test(src, deps = [], **kwargs):
5+
def wd_ts_test(src, deps = [], eslintrc_json = None, **kwargs):
66
"""Bazel rule to compile and run a TypeScript test"""
77

88
name = module_name(src)
@@ -12,6 +12,7 @@ def wd_ts_test(src, deps = [], **kwargs):
1212
srcs = [src],
1313
deps = deps,
1414
testonly = True,
15+
eslintrc_json = eslintrc_json,
1516
)
1617

1718
js_test(

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"chrome-remote-interface": "^0.33.3",
1919
"esbuild": "^0.25.0",
2020
"eslint": "^9.20.1",
21-
"eslint-plugin-import": "^2.31.0",
2221
"expect-type": "^1.1.0",
2322
"typescript-eslint": "^8.23.0"
2423
},

0 commit comments

Comments
 (0)