Форматы вывода
Oxlint поддерживает несколько форматов вывода диагностик. Их можно использовать в CI или в других инструментах.
Формат задаётся опцией --format (или -f) при запуске из CLI.
Доступные форматы
--format=default
Формат по умолчанию, если ничего не указано.
x eslint(no-debugger): `debugger` statement is not allowed
╭─[test.js:5:1]
4 │
5 │ debugger;
· ─────────
6 │
╰────
help: Remove the debugger statement
Found 0 warnings and 1 error.
Finished in 6ms on 1 file with 2 rules using 1 threads.--format=checkstyle
Вывод в XML Checkstyle — его потребляют некоторые CI.
xml
<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
<file name="test.js">
<error line="5" column="1" severity="error" message="`debugger` statement is not allowed" source="eslint(no-debugger)" />
</file>
</checkstyle>--format=github
Для GitHub Actions и аннотаций.
::error file=test.js,line=5,endLine=5,col=1,endColumn=10,title=eslint(no-debugger)::`debugger` statement is not allowed--format=gitlab
Для GitLab CI и Code Quality.
json
[
{
"description": "`debugger` statement is not allowed",
"check_name": "eslint(no-debugger)",
"fingerprint": "9333a3278325994",
"severity": "critical",
"location": {
"path": "test.js",
"lines": {
"begin": 5,
"end": 5
}
}
}
]--format=json
Общий JSON; вместе с --rules — список правил Oxlint в JSON.
json
{
"diagnostics": [
{
"message": "`debugger` statement is not allowed",
"code": "eslint(no-debugger)",
"severity": "error",
"causes": [],
"url": "https://oxc.rs/guide/usage/linter/rules/eslint/no-debugger.html",
"help": "Remove the debugger statement",
"filename": "test.js",
"labels": [
{
"span": {
"offset": 38,
"length": 9,
"line": 5,
"column": 1
}
}
],
"related": []
}
],
"number_of_files": 1,
"number_of_rules": 2,
"threads_count": 1,
"start_time": 0.018611917
}--format=junit
JUnit XML для CI с отчётами JUnit, например GitLab CI или Bitbucket Pipelines.
xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Oxlint" tests="1" failures="0" errors="1">
<testsuite name="test.js" tests="1" disabled="0" errors="1" failures="0">
<testcase name="eslint(no-debugger)">
<error message="`debugger` statement is not allowed">line 5, column 1, `debugger` statement is not allowed</error>
</testcase>
</testsuite>
</testsuites>--format=stylish
Как у ESLint по умолчанию — компактный человекочитаемый вывод.
test.js
5:1 error `debugger` statement is not allowed eslint(no-debugger)
✖ 1 problem (1 error, 0 warnings)--format=unix
Простой однострочный формат.
test.js:5:1: `debugger` statement is not allowed [Error/eslint(no-debugger)]
1 problem