Skip to content

Commit

Permalink
Add deno fmt (#460)
Browse files Browse the repository at this point in the history
Next: add `deno lint`
  • Loading branch information
dapirian authored Sep 5, 2023
1 parent 6c9d715 commit 818836e
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 4 deletions.
3 changes: 3 additions & 0 deletions linters/deno/deno.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { linterFmtTest } from "tests";

linterFmtTest({ linterName: "deno" });
46 changes: 46 additions & 0 deletions linters/deno/plugin.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions linters/deno/test_data/basic.in.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const identity = [
1, 0, 0,
0, 1, 0,
0, 0, 1,
];
16 changes: 16 additions & 0 deletions linters/deno/test_data/deno_v1.36.4_basic.fmt.shot
Original file line number Diff line number Diff line change
@@ -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,
];
"
`;
9 changes: 5 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]<sup><a href="#note-detekt">1</a></sup>, [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] |
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 818836e

Please sign in to comment.