diff --git a/linters/deno/deno.test.ts b/linters/deno/deno.test.ts new file mode 100644 index 000000000..d1c62b2e3 --- /dev/null +++ b/linters/deno/deno.test.ts @@ -0,0 +1,3 @@ +import { linterFmtTest } from "tests"; + +linterFmtTest({ linterName: "deno" }); diff --git a/linters/deno/plugin.yaml b/linters/deno/plugin.yaml new file mode 100644 index 000000000..4badb7f13 --- /dev/null +++ b/linters/deno/plugin.yaml @@ -0,0 +1,46 @@ +version: 0.1 +downloads: + - name: deno + downloads: + - os: + macos: apple-darwin + cpu: + x86_64: x86_64 + arm_64: aarch64 + url: https://github.com/denoland/deno/releases/download/v${version}/deno-${cpu}-${os}.zip + - os: + linux: unknown-linux-gnu + windows: pc-windows-msvc + cpu: + x86_64: x86_64 + url: https://github.com/denoland/deno/releases/download/v${version}/deno-${cpu}-${os}.zip +tools: + definitions: + - name: deno + download: deno + known_good_version: 1.36.4 + shims: + - name: deno + target: deno +lint: + definitions: + - name: deno + files: [javascript, typescript, markdown, json] + commands: + - name: format + output: rewrite + run: deno fmt ${target} + success_codes: [0, 1] + cache_results: true + formatter: true + batch: true + in_place: true + tools: [deno] + suggest_if: config_present + direct_configs: + - deno.json + - deno.jsonc + known_good_version: 1.36.4 + version_command: + parse_regex: deno ${semver} .* + run: deno --version diff --git a/linters/deno/test_data/basic.in.js b/linters/deno/test_data/basic.in.js new file mode 100644 index 000000000..f4002e9b7 --- /dev/null +++ b/linters/deno/test_data/basic.in.js @@ -0,0 +1,5 @@ +export const identity = [ + 1, 0, 0, + 0, 1, 0, + 0, 0, 1, +]; diff --git a/linters/deno/test_data/deno_v1.36.4_basic.fmt.shot b/linters/deno/test_data/deno_v1.36.4_basic.fmt.shot new file mode 100644 index 000000000..400844d0b --- /dev/null +++ b/linters/deno/test_data/deno_v1.36.4_basic.fmt.shot @@ -0,0 +1,16 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Testing formatter deno test basic 1`] = ` +"export const identity = [ + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, +]; +" +`; diff --git a/readme.md b/readme.md index 528ebe69c..2f9abdf0e 100644 --- a/readme.md +++ b/readme.md @@ -53,12 +53,12 @@ trunk check enable {linter} | HAML | [haml-lint] | | HTML Templates | [djlint] | | Java | [google-java-format], [pmd], [semgrep] | -| Javascript | [eslint], [prettier], [rome], [semgrep] | -| JSON | [eslint], [prettier], [semgrep] | +| Javascript | [deno], [eslint], [prettier], [rome], [semgrep] | +| JSON | [deno], [eslint], [prettier], [semgrep] | | Kotlin | [detekt]1, [ktlint] | | Kubernetes | [kube-linter] | | Lua | [stylua] | -| Markdown | [markdownlint], [remark-lint] | +| Markdown | [deno], [markdownlint], [remark-lint] | | Nix | [nixpkgs-fmt] | | package.json | [sort-package-json] | | Perl | [perlcritic], [perltidy] | @@ -78,7 +78,7 @@ trunk check enable {linter} | Terragrunt | [terragrunt] | | Textproto | [txtpbfmt] | | TOML | [taplo] | -| Typescript | [eslint], [prettier], [rome], [semgrep] | +| Typescript | [deno], [eslint], [prettier], [rome], [semgrep] | | YAML | [prettier], [semgrep], [yamllint] | [actionlint]: https://github.com/rhysd/actionlint#readme @@ -98,6 +98,7 @@ trunk check enable {linter} [codespell]: https://github.com/codespell-project/codespell#readme [cspell]: https://github.com/streetsidesoftware/cspell#readme [cue-fmt]: https://cuelang.org/ +[deno]: https://deno.land/manual [detekt]: https://github.com/detekt/detekt#readme [djlint]: https://github.com/Riverside-Healthcare/djlint#readme [dotenv-linter]: https://github.com/dotenv-linter/dotenv-linter#readme