From 9743e97cd37c78e75d6803f41caaa8e0df3ec6d8 Mon Sep 17 00:00:00 2001 From: David Apirian Date: Tue, 5 Sep 2023 16:02:18 -0700 Subject: [PATCH 1/4] --- linters/deno/deno.test.ts | 12 ++++++ linters/deno/plugin.yaml | 42 +++++++++++++++++++ linters/deno/test_data/basic.in.js | 5 +++ .../test_data/deno_v1.36.4_basic.fmt.shot | 16 +++++++ 4 files changed, 75 insertions(+) create mode 100644 linters/deno/deno.test.ts create mode 100644 linters/deno/plugin.yaml create mode 100644 linters/deno/test_data/basic.in.js create mode 100644 linters/deno/test_data/deno_v1.36.4_basic.fmt.shot diff --git a/linters/deno/deno.test.ts b/linters/deno/deno.test.ts new file mode 100644 index 000000000..86fbd0053 --- /dev/null +++ b/linters/deno/deno.test.ts @@ -0,0 +1,12 @@ +import { linterCheckTest, linterFmtTest } from "tests"; +// Uncomment and use if your tool is a linter +// linterCheckTest({ linterName: "deno" }); + +// Uncomment and use if your tool is a formatter +linterFmtTest({ linterName: "deno" }); + +// Guidelines for configuring tests: +// - By default, linters and formatters will only run on files with syntax `.in.` +// - You can customize test setup using the `preCheck` callback (see git_diff_check.test.ts and golangci_lint.test.ts) +// - You can specify additional customization using the `customLinterCheckTest and customLinterFmtTest` helpers +// - Additional information on test setup can be found in tests/readme.md diff --git a/linters/deno/plugin.yaml b/linters/deno/plugin.yaml new file mode 100644 index 000000000..ac7ba0063 --- /dev/null +++ b/linters/deno/plugin.yaml @@ -0,0 +1,42 @@ +version: 0.1 +downloads: + - name: deno + downloads: + - os: + macos: apple-darwin + linux: unknown-linux-gnu + windows: windows-msvc + cpu: + x86_64: x86_64 + arm_64: aarch64 + 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, +]; +" +`; From 880aafdd3e82f7021ff074017b9f06521db9d224 Mon Sep 17 00:00:00 2001 From: David Apirian Date: Tue, 5 Sep 2023 16:06:30 -0700 Subject: [PATCH 2/4] --- readme.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 From e809823b4922ae6616f166dd036350c32e0fae08 Mon Sep 17 00:00:00 2001 From: David Apirian Date: Tue, 5 Sep 2023 16:08:39 -0700 Subject: [PATCH 3/4] --- linters/deno/deno.test.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/linters/deno/deno.test.ts b/linters/deno/deno.test.ts index 86fbd0053..d1c62b2e3 100644 --- a/linters/deno/deno.test.ts +++ b/linters/deno/deno.test.ts @@ -1,12 +1,3 @@ -import { linterCheckTest, linterFmtTest } from "tests"; -// Uncomment and use if your tool is a linter -// linterCheckTest({ linterName: "deno" }); +import { linterFmtTest } from "tests"; -// Uncomment and use if your tool is a formatter linterFmtTest({ linterName: "deno" }); - -// Guidelines for configuring tests: -// - By default, linters and formatters will only run on files with syntax `.in.` -// - You can customize test setup using the `preCheck` callback (see git_diff_check.test.ts and golangci_lint.test.ts) -// - You can specify additional customization using the `customLinterCheckTest and customLinterFmtTest` helpers -// - Additional information on test setup can be found in tests/readme.md From 3ec957e6e044f2a044ff1a95d8c7cb0117e2b031 Mon Sep 17 00:00:00 2001 From: David Apirian Date: Tue, 5 Sep 2023 16:13:04 -0700 Subject: [PATCH 4/4] --- linters/deno/plugin.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/linters/deno/plugin.yaml b/linters/deno/plugin.yaml index ac7ba0063..4badb7f13 100644 --- a/linters/deno/plugin.yaml +++ b/linters/deno/plugin.yaml @@ -4,12 +4,16 @@ downloads: downloads: - os: macos: apple-darwin - linux: unknown-linux-gnu - windows: windows-msvc 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