Skip to content

Commit 81ecf75

Browse files
DonIsaacDon Isaac
andauthored
ci: repair lint setup and run it in CI (oven-sh#15720)
Co-authored-by: Don Isaac <don@bun.sh>
1 parent a3cbf97 commit 81ecf75

File tree

16 files changed

+85
-34
lines changed

16 files changed

+85
-34
lines changed

.github/workflows/lint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
env:
8+
BUN_VERSION: "1.1.38"
9+
OXLINT_VERSION: "0.15.0"
10+
11+
jobs:
12+
lint-js:
13+
name: "Lint JavaScript"
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Setup Bun
18+
uses: ./.github/actions/setup-bun
19+
with:
20+
bun-version: ${{ env.BUN_VERSION }}
21+
- name: Lint
22+
run: bunx oxlint --config oxlint.json --quiet --format github
23+
24+
25+
26+

bench/hot-module-reloading/css-stress-test/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ReactDOM from "react-dom";
22
import { Main } from "./main";
33

4-
const Base = ({}) => {
4+
const Base = () => {
55
const name = typeof location !== "undefined" ? decodeURIComponent(location.search.substring(1)) : null;
66
return <Main productName={name} />;
77
};

bench/snippets/urlsearchparams.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ bench("new URLSearchParams(obj)", () => {
1010
"Content-Length": "123",
1111
"User-Agent": "node-fetch/1.0",
1212
"Accept-Encoding": "gzip,deflate",
13-
"Content-Length": "0",
1413
"Content-Range": "bytes 0-9/10",
1514
});
1615
});

oxlint.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/refs/heads/main/npm/oxlint/configuration_schema.json",
3+
"categories": {
4+
"correctness": "warn" // TODO: gradually fix bugs and turn this to error
5+
},
6+
"rules": {
7+
"const-comparisons": "off", // TODO: there's a bug when comparing private identifiers. Re-enable once it's fixed.
8+
"no-cond-assign": "error",
9+
"no-const-assign": "error",
10+
"no-debugger": "error",
11+
"no-dupe-class-members": "error",
12+
"no-dupe-keys": "error",
13+
"no-empty-pattern": "error",
14+
"import/no-duplicates": "error",
15+
16+
"no-useless-escape": "off" // there's a lot of these. Should be fixed eventually.
17+
},
18+
"ignorePatterns": [
19+
"vendor",
20+
"build",
21+
"test/snapshots/**",
22+
"bench/react-hello-world/*.js",
23+
24+
"test/js/node/**/parallel/**",
25+
"test/js/node/test/fixtures", // full of JS with intentional syntax errors
26+
"test/snippets/**",
27+
"test/regression/issue/14477/*.tsx",
28+
"test/js/**/*bad.js",
29+
"test/bundler/transpiler/decorators.test.ts", // uses `arguments` as decorator
30+
"test/bundler/native-plugin.test.ts", // parser doesn't handle import metadata
31+
"test/bundler/transpiler/with-statement-works.js" // parser doesn't allow `with` statement
32+
],
33+
"overrides": [
34+
{
35+
"files": ["test/**", "examples/**", "packages/bun-internal/test/runners/**"],
36+
"rules": {
37+
"no-unused-vars": "off",
38+
"no-unused-private-class-members": "off",
39+
"no-unnecessary-await": "off"
40+
}
41+
},
42+
{
43+
"files": ["test/**", "bench/**"],
44+
"rules": {
45+
"no-shadow-restricted-names": "off",
46+
"no-empty-file": "off",
47+
"no-unnecessary-await": "off"
48+
}
49+
}
50+
]
51+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
"fmt": "bun run prettier",
5050
"fmt:cpp": "bun run clang-format",
5151
"fmt:zig": "bun run zig-format",
52-
"lint": "eslint './**/*.d.ts' --cache",
53-
"lint:fix": "eslint './**/*.d.ts' --cache --fix",
52+
"lint": "oxlint --config oxlint.json",
53+
"lint:fix": "oxlint --config oxlint.json --fix",
5454
"test": "node scripts/runner.node.mjs --exec-path ./build/debug/bun-debug",
5555
"test:release": "node scripts/runner.node.mjs --exec-path ./build/release/bun",
5656
"banned": "bun packages/bun-internal-test/src/linter.ts",

packages/bun-wasm/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,20 @@ const Wasi = {
6666
return Date.now();
6767
},
6868
environ_sizes_get() {
69-
debugger;
7069
return 0;
7170
},
7271
environ_get(__environ: unknown, environ_buf: unknown) {
73-
debugger;
7472
return 0;
7573
},
7674

7775
fd_close(fd: number) {
78-
debugger;
7976
return 0;
8077
},
8178
proc_exit() {},
8279

8380
fd_seek(fd: number, offset_bigint: bigint, whence: unknown, newOffset: unknown) {
84-
debugger;
8581
},
8682
fd_write(fd: unknown, iov: unknown, iovcnt: unknown, pnum: unknown) {
87-
debugger;
8883
},
8984
};
9085

src/bun.js/api/sockets.classes.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ function generate(ssl) {
182182
fn: "reload",
183183
length: 1,
184184
},
185-
bytesWritten: {
186-
getter: "getBytesWritten",
187-
},
188185
setServername: {
189186
fn: "setServername",
190187
length: 1,

src/js/internal/primordials.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ export default {
112112
DatePrototypeToString: uncurryThis(Date.prototype.toString),
113113
ErrorCaptureStackTrace,
114114
ErrorPrototypeToString: uncurryThis(Error.prototype.toString),
115-
FunctionPrototypeToString: uncurryThis(Function.prototype.toString),
116115
JSONStringify: JSON.stringify,
117116
MapPrototypeGetSize: getGetter(Map, "size"),
118117
MapPrototypeEntries: uncurryThis(Map.prototype.entries),

src/js/node/http2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2419,7 +2419,7 @@ class ServerHttp2Session extends Http2Session {
24192419
// throwNotImplemented("ServerHttp2Stream.prototype.origin()");
24202420
}
24212421

2422-
constructor(socket: TLSSocket | Socket, options?: Http2ConnectOptions, server: Http2Server) {
2422+
constructor(socket: TLSSocket | Socket, options?: Http2ConnectOptions, server?: Http2Server) {
24232423
super();
24242424
this[kServer] = server;
24252425
this.#connected = true;

src/js/node/net.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,6 @@ class Server extends EventEmitter {
13421342
});
13431343
} else {
13441344
this._handle = Bun.listen({
1345-
exclusive,
13461345
port,
13471346
hostname,
13481347
tls,

0 commit comments

Comments
 (0)