feat: add oxlint with correctness defaults (#22682)

This commit is contained in:
Kit Langton
2026-04-15 20:45:19 -04:00
committed by GitHub
parent a554fad232
commit 3d6f90cb53
57 changed files with 165 additions and 122 deletions
+1 -3
View File
@@ -211,9 +211,7 @@ for (const item of targets) {
execArgv: [`--user-agent=opencode/${Script.version}`, "--use-system-ca", "--"],
windows: {},
},
files: {
...(embeddedFileMap ? { "opencode-web-ui.gen.ts": embeddedFileMap } : {}),
},
files: (embeddedFileMap ? { "opencode-web-ui.gen.ts": embeddedFileMap } : {}),
entrypoints: [
"./src/index.ts",
parserWorker,
+1 -1
View File
@@ -368,7 +368,7 @@ export namespace Agent {
)),
{
role: "user",
content: `Create an agent configuration based on this request: \"${input.description}\".\n\nIMPORTANT: The following identifiers already exist and must NOT be used: ${existing.map((i) => i.name).join(", ")}\n Return ONLY the JSON object, no other text, do not wrap in backticks`,
content: `Create an agent configuration based on this request: "${input.description}".\n\nIMPORTANT: The following identifiers already exist and must NOT be used: ${existing.map((i) => i.name).join(", ")}\n Return ONLY the JSON object, no other text, do not wrap in backticks`,
},
],
model: language,
+1 -3
View File
@@ -40,12 +40,10 @@ async function handlePluginAuth(plugin: { auth: PluginAuth }, provider: string,
} else if (plugin.auth.methods.length > 1) {
const method = await prompts.select({
message: "Login method",
options: [
...plugin.auth.methods.map((x, index) => ({
options: plugin.auth.methods.map((x, index) => ({
label: x.label,
value: index.toString(),
})),
],
})
if (prompts.isCancel(method)) throw new UI.CancelledError()
index = parseInt(method)
+1 -1
View File
@@ -125,7 +125,7 @@ export namespace TuiConfig {
}
}
const keybinds = { ...(acc.result.keybinds ?? {}) }
const keybinds = { ...acc.result.keybinds }
if (process.platform === "win32") {
// Native Windows terminals do not support POSIX suspend, so prefer prompt undo.
keybinds.terminal_suspend = "none"
+1 -1
View File
@@ -9,7 +9,7 @@ export function spawn(cmd: string, argsOrOpts?: string[] | Process.Options, opts
const args = Array.isArray(argsOrOpts) ? [...argsOrOpts] : []
const cfg = Array.isArray(argsOrOpts) ? opts : argsOrOpts
const proc = Process.spawn([cmd, ...args], {
...(cfg ?? {}),
...cfg,
stdin: "pipe",
stdout: "pipe",
stderr: "pipe",
+2 -4
View File
@@ -1,8 +1,7 @@
import type { Hooks, PluginInput } from "@opencode-ai/plugin"
export async function CloudflareWorkersAuthPlugin(_input: PluginInput): Promise<Hooks> {
const prompts = [
...(!process.env.CLOUDFLARE_ACCOUNT_ID
const prompts = (!process.env.CLOUDFLARE_ACCOUNT_ID
? [
{
type: "text" as const,
@@ -11,8 +10,7 @@ export async function CloudflareWorkersAuthPlugin(_input: PluginInput): Promise<
placeholder: "e.g. 1234567890abcdef1234567890abcdef",
},
]
: []),
]
: [])
return {
auth: {
+1 -1
View File
@@ -174,7 +174,7 @@ export namespace PluginMeta {
const entry = store[id]
if (!entry) return
entry.themes = {
...(entry.themes ?? {}),
...entry.themes,
[name]: theme,
}
await Filesystem.writeJson(file, store)
+2 -2
View File
@@ -551,13 +551,13 @@ export namespace Provider {
const aiGatewayHeaders = {
"User-Agent": `opencode/${Installation.VERSION} gitlab-ai-provider/${GITLAB_PROVIDER_VERSION} (${os.platform()} ${os.release()}; ${os.arch()})`,
"anthropic-beta": "context-1m-2025-08-07",
...(providerConfig?.options?.aiGatewayHeaders || {}),
...providerConfig?.options?.aiGatewayHeaders,
}
const featureFlags = {
duo_agent_platform_agentic_chat: true,
duo_agent_platform: true,
...(providerConfig?.options?.featureFlags || {}),
...providerConfig?.options?.featureFlags,
}
return {
@@ -695,7 +695,7 @@ export const SessionRoutes = lazy(() =>
url.searchParams.set("limit", query.limit.toString())
url.searchParams.set("before", page.cursor)
c.header("Access-Control-Expose-Headers", "Link, X-Next-Cursor")
c.header("Link", `<${url.toString()}>; rel=\"next\"`)
c.header("Link", `<${url.toString()}>; rel="next"`)
c.header("X-Next-Cursor", page.cursor)
}
return c.json(page.items)
+1 -1
View File
@@ -497,7 +497,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
const truncated = yield* truncate.output(textParts.join("\n\n"), {}, input.agent)
const metadata = {
...(result.metadata ?? {}),
...result.metadata,
truncated: truncated.truncated,
...(truncated.truncated && { outputPath: truncated.outputPath }),
}
+1 -1
View File
@@ -176,7 +176,7 @@ function dynamic(text: string, ps: boolean) {
}
function prefix(text: string) {
const match = /[?*\[]/.exec(text)
const match = /[?*[]/.exec(text)
if (!match) return text
if (match.index === 0) return
return text.slice(0, match.index)
@@ -41,7 +41,7 @@ test("hasTheme checks theme presence", () => {
test("resolveTheme rejects circular color refs", () => {
const item = structuredClone(DEFAULT_THEMES.opencode)
item.defs = {
...(item.defs ?? {}),
...item.defs,
one: "two",
two: "one",
}
@@ -48,7 +48,7 @@ describe("plugin.loader.shared", () => {
file,
[
"export default async () => {",
` await Bun.write(${JSON.stringify(mark)}, \"called\")`,
` await Bun.write(${JSON.stringify(mark)}, "called")`,
" return {}",
"}",
"",
@@ -78,8 +78,8 @@ describe("plugin.loader.shared", () => {
file,
[
"const run = async () => {",
` const text = await Bun.file(${JSON.stringify(mark)}).text().catch(() => \"\")`,
` await Bun.write(${JSON.stringify(mark)}, text + \"1\")`,
` const text = await Bun.file(${JSON.stringify(mark)}).text().catch(() => "")`,
` await Bun.write(${JSON.stringify(mark)}, text + "1")`,
" return {}",
"}",
"export default run",
@@ -715,7 +715,7 @@ describe("plugin.loader.shared", () => {
"const plugin = {",
' id: "demo.object",',
" server: async () => {",
` await Bun.write(${JSON.stringify(mark)}, \"called\")`,
` await Bun.write(${JSON.stringify(mark)}, "called")`,
" return {}",
" },",
"}",
@@ -833,7 +833,7 @@ export default {
"export default {",
' id: "demo.pure",',
" server: async () => {",
` await Bun.write(${JSON.stringify(mark)}, \"called\")`,
` await Bun.write(${JSON.stringify(mark)}, "called")`,
" return {}",
" },",
"}",
@@ -39,7 +39,7 @@ describe("plugin.workspace", () => {
' name: "plug",',
' description: "plugin workspace adaptor",',
" configure(input) {",
` return { ...input, name: \"plug\", branch: \"plug/main\", directory: ${JSON.stringify(space)} }`,
` return { ...input, name: "plug", branch: "plug/main", directory: ${JSON.stringify(space)} }`,
" },",
" async create(input) {",
` await Bun.write(${JSON.stringify(mark)}, JSON.stringify(input))`,