Skip to content

Commit 3d6f90c

Browse files
authored
feat: add oxlint with correctness defaults (#22682)
1 parent a554fad commit 3d6f90c

57 files changed

Lines changed: 165 additions & 122 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.oxlintrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/nicolo-ribaudo/oxc-project.github.io/refs/heads/json-schema/src/public/.oxlintrc.schema.json",
3+
"rules": {
4+
// Effect uses `function*` with Effect.gen/Effect.fnUntraced that don't always yield
5+
"require-yield": "off",
6+
// SolidJS uses `let ref: T | undefined` for JSX ref bindings assigned at runtime
7+
"no-unassigned-vars": "off"
8+
},
9+
"ignorePatterns": ["**/node_modules", "**/dist", "**/.build", "**/.sst", "**/*.d.ts"]
10+
}

bun.lock

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"dev:web": "bun --cwd packages/app dev",
1212
"dev:console": "ulimit -n 10240 2>/dev/null; bun run --cwd packages/console/app dev",
1313
"dev:storybook": "bun --cwd packages/storybook storybook",
14+
"lint": "oxlint",
1415
"typecheck": "bun turbo typecheck",
1516
"postinstall": "bun run --cwd packages/opencode fix-node-pty",
1617
"prepare": "husky",
@@ -85,6 +86,7 @@
8586
"@typescript/native-preview": "catalog:",
8687
"glob": "13.0.5",
8788
"husky": "9.1.7",
89+
"oxlint": "1.60.0",
8890
"prettier": "3.6.2",
8991
"semver": "^7.6.0",
9092
"sst": "3.18.10",

packages/app/src/components/file-tree.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const FileTreeNode = (
149149
classList={{
150150
"w-full min-w-0 h-6 flex items-center justify-start gap-x-1.5 rounded-md px-1.5 py-0 text-left hover:bg-surface-raised-base-hover active:bg-surface-base-active transition-colors cursor-pointer": true,
151151
"bg-surface-base-active": local.node.path === local.active,
152-
...(local.classList ?? {}),
152+
...local.classList,
153153
[local.class ?? ""]: !!local.class,
154154
[local.nodeClass ?? ""]: !!local.nodeClass,
155155
}}

packages/app/src/components/terminal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ export const Terminal = (props: TerminalProps) => {
634634
tabIndex={-1}
635635
style={{ "background-color": terminalColors().background }}
636636
classList={{
637-
...(local.classList ?? {}),
637+
...local.classList,
638638
"select-text": true,
639639
"size-full px-6 py-3 font-mono relative overflow-hidden": true,
640640
[local.class ?? ""]: !!local.class,

packages/app/src/context/global-sync/child-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ export function createChildStoreManager(input: {
243243
const cached = metaCache.get(directory)
244244
if (!cached) return
245245
const previous = store.projectMeta ?? {}
246-
const icon = patch.icon ? { ...(previous.icon ?? {}), ...patch.icon } : previous.icon
247-
const commands = patch.commands ? { ...(previous.commands ?? {}), ...patch.commands } : previous.commands
246+
const icon = patch.icon ? { ...previous.icon, ...patch.icon } : previous.icon
247+
const commands = patch.commands ? { ...previous.commands, ...patch.commands } : previous.commands
248248
const next = {
249249
...previous,
250250
...patch,

packages/app/src/context/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
344344
return
345345
}
346346

347-
setStore("sessionView", sessionKey, "scroll", (prev) => ({ ...(prev ?? {}), ...next }))
347+
setStore("sessionView", sessionKey, "scroll", (prev) => ({ ...prev, ...next }))
348348
prune(keep)
349349
},
350350
})
@@ -399,7 +399,7 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
399399
local?.icon?.color !== undefined
400400

401401
const base = {
402-
...(metadata ?? {}),
402+
...metadata,
403403
...project,
404404
icon: {
405405
url: metadata?.icon?.url,

packages/console/app/src/routes/zen/util/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export async function handler(
144144
providerInfo.modifyBody({
145145
...createBodyConverter(opts.format, providerInfo.format)(body),
146146
model: providerInfo.model,
147-
...(providerInfo.payloadModifier ?? {}),
147+
...providerInfo.payloadModifier,
148148
...Object.fromEntries(
149149
Object.entries(providerInfo.payloadMappings ?? {})
150150
.map(([k, v]) => [k, input.request.headers.get(v)])

packages/console/core/src/key.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ export namespace Key {
2424
.innerJoin(AuthTable, and(eq(UserTable.accountID, AuthTable.accountID), eq(AuthTable.provider, "email")))
2525
.where(
2626
and(
27-
...[
28-
eq(KeyTable.workspaceID, Actor.workspace()),
27+
eq(KeyTable.workspaceID, Actor.workspace()),
2928
isNull(KeyTable.timeDeleted),
3029
...(Actor.userRole() === "admin" ? [] : [eq(KeyTable.userID, Actor.userID())]),
31-
],
3230
),
3331
)
3432
.orderBy(sql`${KeyTable.name} DESC`),
@@ -84,11 +82,9 @@ export namespace Key {
8482
})
8583
.where(
8684
and(
87-
...[
88-
eq(KeyTable.id, input.id),
85+
eq(KeyTable.id, input.id),
8986
eq(KeyTable.workspaceID, Actor.workspace()),
9087
...(Actor.userRole() === "admin" ? [] : [eq(KeyTable.userID, Actor.userID())]),
91-
],
9288
),
9389
),
9490
)

packages/desktop-electron/src/main/apps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function wslPath(path: string, mode: "windows" | "linux" | null): string
2020
try {
2121
if (path.startsWith("~")) {
2222
const suffix = path.slice(1)
23-
const cmd = `wslpath ${flag} \"$HOME${suffix.replace(/\"/g, '\\"')}\"`
23+
const cmd = `wslpath ${flag} "$HOME${suffix.replace(/"/g, '\\"')}"`
2424
const output = execFileSync("wsl", ["-e", "sh", "-lc", cmd])
2525
return output.toString().trim()
2626
}

0 commit comments

Comments
 (0)