Skip to content

Commit b57fc39

Browse files
committed
chore: release v0.7.5
1 parent 5fe9bfb commit b57fc39

File tree

4 files changed

+105
-98
lines changed

4 files changed

+105
-98
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "unplugin-oxlint",
33
"type": "module",
4-
"version": "0.7.4",
4+
"version": "0.7.5",
55
"description": "A universal bundler plugin for integrating the Oxlint linter into your project.",
66
"author": "tmg0",
77
"license": "MIT",
@@ -79,7 +79,7 @@
7979
"test": "vitest"
8080
},
8181
"peerDependencies": {
82-
"oxlint": "^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.10.0 || ^0.11.0 || ^0.14.0 || ^0.15.0 || ^0.16.0"
82+
"oxlint": "^0.18.0"
8383
},
8484
"dependencies": {
8585
"chokidar": "^4.0.3",
@@ -100,8 +100,8 @@
100100
"@types/fs-extra": "^11.0.4",
101101
"@types/node": "^22.15.31",
102102
"esbuild": "^0.25.5",
103-
"eslint-plugin-oxlint": "^0.16.12",
104-
"oxlint": "^0.16.12",
103+
"eslint-plugin-oxlint": "^0.18.1",
104+
"oxlint": "^0.18.1",
105105
"tsdown": "^0.12.7",
106106
"typescript": "^5.8.3",
107107
"vitest": "^3.2.3"

pnpm-lock.yaml

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

src/core/oxlint.ts

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -71,37 +71,36 @@ export async function runOxlintCommand(ids: string | string[], ctx: OxlintContex
7171
}
7272

7373
const results: LintResult[] = []
74-
const outputs = destr<OxlintOutput[]>(format(stdout))
75-
76-
if (Array.isArray(outputs)) {
77-
for await (const { filename } of outputs) {
78-
if (contentRecord[filename])
79-
continue
80-
const c = await fse.readFile(filename, { encoding: 'utf8' })
81-
contentRecord[filename] = c
82-
}
83-
84-
outputs.forEach(({ code, filename, severity, message, labels }) => {
85-
const [{ span }] = labels
86-
const lines = contentRecord[filename].slice(0, span.offset).split('\n')
87-
const line = lines.length
88-
const column = lines[lines.length - 1].length + 1
89-
const { content } = detectOxlintMessage(message)
90-
const ruleId = code.match(/\(([^)]+)\)/)?.[1] ?? ''
91-
const result: LintResult = {
92-
filename,
93-
linter: 'oxlint',
94-
severity,
95-
message: content,
96-
ruleId,
97-
line,
98-
column,
99-
}
100-
results.push(result)
101-
ctx.insertLintResult(filename, result)
102-
})
74+
const outputs = destr<OxlintOutput | OxlintOutput['diagnostics']>(format(stdout))
75+
const diagnostics = Array.isArray(outputs) ? outputs : outputs.diagnostics
76+
77+
for await (const { filename } of diagnostics) {
78+
if (contentRecord[filename])
79+
continue
80+
const c = await fse.readFile(filename, { encoding: 'utf8' })
81+
contentRecord[filename] = c
10382
}
10483

84+
diagnostics.forEach(({ code, filename, severity, message, labels }) => {
85+
const [{ span }] = labels
86+
const lines = contentRecord[filename].slice(0, span.offset).split('\n')
87+
const line = lines.length
88+
const column = lines[lines.length - 1].length + 1
89+
const { content } = detectOxlintMessage(message)
90+
const ruleId = code.match(/\(([^)]+)\)/)?.[1] ?? ''
91+
const result: LintResult = {
92+
filename,
93+
linter: 'oxlint',
94+
severity,
95+
message: content,
96+
ruleId,
97+
line,
98+
column,
99+
}
100+
results.push(result)
101+
ctx.insertLintResult(filename, result)
102+
})
103+
105104
return results
106105
}
107106

src/core/types.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,21 @@ export interface OxlintOutputLabel {
5555
}
5656

5757
export interface OxlintOutput {
58-
message: string
59-
code: string
60-
severity: 'warning' | 'error'
61-
causes: string[]
62-
filename: string
63-
related: string[]
64-
labels: OxlintOutputLabel[]
58+
diagnostics: {
59+
message: string
60+
code: string
61+
severity: 'warning' | 'error'
62+
causes: string[]
63+
url: string
64+
help: string
65+
filename: string
66+
related: string[]
67+
labels: OxlintOutputLabel[]
68+
}[]
69+
number_of_files: number
70+
number_of_rules: number
71+
threads_count: number
72+
start_time: number
6573
}
6674

6775
export interface LintResult {

0 commit comments

Comments
 (0)