Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ trunk check enable {linter}
| HAML | [haml-lint] |
| HTML Templates | [djlint] |
| Java | [google-java-format], [pmd], [semgrep] |
| Javascript | [biome], [deno], [eslint], [prettier], [rome], [semgrep] |
| Javascript | [biome], [deno], [eslint], [oxlint], [prettier], [rome], [semgrep] |
| JSON | [biome], [deno], [eslint], [prettier], [semgrep] |
| Kotlin | [detekt], [ktlint] |
| Kubernetes | [kube-linter] |
Expand All @@ -88,6 +88,7 @@ trunk check enable {linter}
| Terraform | [terraform] (validate and fmt), [checkov], [tflint], [tfsec], [terrascan], [tofu] |
| Terragrunt | [terragrunt] |
| Textproto | [txtpbfmt] |
| Typescript | [deno], [eslint], [oxlint], [prettier], [rome], [semgrep] |
| TOML | [taplo], [toml-tidy] |
| Typescript | [deno], [eslint], [prettier], [rome], [semgrep] |
| YAML | [prettier], [semgrep], [yamlfmt], [yamllint] |
Expand Down Expand Up @@ -149,6 +150,7 @@ trunk check enable {linter}
[opa]: https://www.openpolicyagent.org/docs/latest/cli/
[osv-scanner]: https://trunk.io/linters/security/osv-scanner
[oxipng]: https://github.com/shssoichiro/oxipng#readme
[oxlint]: https://oxc.rs/docs/guide/usage/linter.html
[perlcritic]: https://metacpan.org/pod/Perl::Critic
[perltidy]: https://metacpan.org/dist/Perl-Tidy/view/bin/perltidy
[pinact]: https://github.com/suzuki-shunsuke/pinact#readme
Expand Down
4 changes: 4 additions & 0 deletions linters/oxlint/oxlint.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { linterCheckTest, linterFmtTest } from "tests";

linterCheckTest({ linterName: "oxlint", namedTestPrefixes: ["basic"] });
linterFmtTest({ linterName: "oxlint", namedTestPrefixes: ["format"] });
56 changes: 56 additions & 0 deletions linters/oxlint/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: 0.1
tools:
definitions:
- name: oxlint
runtime: node
package: oxlint
shims: [oxlint]
known_good_version: 1.71.0
- name: oxfmt
runtime: node
package: oxfmt
shims: [oxfmt]
known_good_version: 0.56.0
lint:
definitions:
- name: oxlint
files: [javascript, javascript-xml, typescript, typescript-xml]
main_tool: oxlint
tools: [oxfmt]
description: Fast JavaScript and TypeScript linting and formatting
commands:
- name: lint
output: sarif
run: oxlint --format sarif ${target}
success_codes: [0, 1]
read_output_from: stdout
batch: true
cache_results: true
- name: format
output: rewrite
run: oxfmt --write ${target}
success_codes: [0]
batch: true
cache_results: true
formatter: true
in_place: true
suggest_if: config_present
direct_configs:
- .oxlintrc.json
- .oxlintrc.jsonc
- .oxfmtrc.json
- .oxfmtrc.jsonc
- .prettierignore
- oxlint.config.ts
- oxlint.config.mts
- oxfmt.config.ts
- oxfmt.config.mts
affects_cache:
- .editorconfig
- .eslintignore
- package.json
- tsconfig.json
known_good_version: 1.71.0
version_command:
parse_regex: ${semver}
run: oxlint --version
3 changes: 3 additions & 0 deletions linters/oxlint/test_data/basic.in.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const unused = 1;

console.log("hello");
3 changes: 3 additions & 0 deletions linters/oxlint/test_data/format.in.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const value={name:"trunk",enabled:true};

console.log(value);
58 changes: 58 additions & 0 deletions linters/oxlint/test_data/oxlint_v1.71.0_basic.check.shot
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Testing linter oxlint test basic 1`] = `
{
"issues": [
{
"code": "eslint(no-unused-vars)",
"column": "7",
"file": "test_data/basic.in.ts",
"issueClass": "ISSUE_CLASS_EXISTING",
"level": "LEVEL_MEDIUM",
"line": "1",
"linter": "oxlint",
"message": "Variable 'unused' is declared but never used. Unused variables should start with a '_'.",
"ranges": [
{
"filePath": "test_data/basic.in.ts",
"length": "6",
"offset": "6",
},
],
"targetType": "typescript",
},
],
"lintActions": [
{
"command": "format",
"fileGroupName": "typescript",
"linter": "oxlint",
"paths": [
"test_data/basic.in.ts",
],
"verb": "TRUNK_VERB_FMT",
},
{
"command": "lint",
"fileGroupName": "typescript",
"linter": "oxlint",
"paths": [
"test_data/basic.in.ts",
],
"verb": "TRUNK_VERB_CHECK",
},
{
"command": "lint",
"fileGroupName": "typescript",
"linter": "oxlint",
"paths": [
"test_data/basic.in.ts",
],
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
],
"taskFailures": [],
"unformattedFiles": [],
}
`;
8 changes: 8 additions & 0 deletions linters/oxlint/test_data/oxlint_v1.71.0_format.fmt.shot
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Testing formatter oxlint test format 1`] = `
"const value = { name: "trunk", enabled: true };

console.log(value);
"
`;
Loading