From acd8dcd7dd66069051325e9297a9ffb1c80e41fe Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 5 Oct 2023 21:00:17 +0900 Subject: [PATCH] Integrate deno_lint --- .github/workflows/ci.yml | 14 ++++++-------- .vscode/settings.json | 17 +++++++++-------- Makefile.toml | 29 ++++++----------------------- deno.jsonc | 9 +++++++++ flake.nix | 1 + 5 files changed, 31 insertions(+), 39 deletions(-) create mode 100644 deno.jsonc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc67ad3..9bdb09d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,15 +53,13 @@ jobs: if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'renovate[bot]' }} - name: Prevent missing commits after compile run: git add --intent-to-add . && git diff --exit-code + lint: + timeout-minutes: 15 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - uses: denoland/setup-deno@0df5d9c641efdff149993c321fc27c11c5df8623 # v1.1.3 with: - node-version: 16 - cache: npm - - name: Install dependencies - run: npm ci --ignore-scripts - - name: Lint - run: npm run lint:check + deno-version: '1.37.1' # selfup { "regex": "\\d[^']+", "script": "deno --version | head -n 1 | cut -d ' ' -f 2" } + - run: deno lint diff --git a/.vscode/settings.json b/.vscode/settings.json index 4f6d77e..c1debf3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,16 +1,17 @@ { - "typescript.tsdk": "node_modules/typescript/lib", "editor.defaultFormatter": "dprint.dprint", "editor.formatOnSave": true, "[nix]": { "editor.defaultFormatter": "jnoortheen.nix-ide" }, - "json.schemas": [ - { - "fileMatch": [ - "dprint.json" - ], - "url": "https://docs.renovatebot.com/renovate-schema.json" + "nix.enableLanguageServer": true, + "nix.serverPath": "nil", + "nix.serverSettings": { + "nil": { + "formatting": { + "command": ["nixpkgs-fmt"] + } } - ] + }, + "deno.enable": false } diff --git a/Makefile.toml b/Makefile.toml index e95869d..cad8174 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -39,33 +39,16 @@ script = [ "typos . .github .vscode", ] -[tasks.lint-apply] -category = "Tools" -description = "Run linters with changes" -dependencies = [ - # TODO: Remove since dropped eslint - # Do not run parallel, because of dprint is superfast and eslint is slow. So sequential makes useful here. - "format-apply", -] -script = [ - "npm run lint:fix", -] - -[tasks.lint-check] +[tasks.lint] category = "Tools" description = "Run linters without changes" -dependencies = [ - # TODO: Remove since dropped eslint - # Do not run parallel, because of dprint is superfast and eslint is slow. So sequential makes useful here. - "format-check", -] script = [ - "npm run lint:check", + "dprint check", + "deno lint", + "typos . .github .vscode", + "actionlint", ] -[tasks.lint] -alias = "lint-check" - [tasks.test-ts] category = "Tools" description = 'Test typescripts' @@ -90,7 +73,7 @@ script = [ [tasks.check] category = "Tools" description = 'Parallel runner for all tests and linters' -run_task = { name = ["typos-check", "test-ts", "typecheck", "lint-check"], parallel = true } +run_task = { name = ["typos-check", "test-ts", "typecheck", "lint"], parallel = true } [tasks.all] category = "Tools" diff --git a/deno.jsonc b/deno.jsonc new file mode 100644 index 0000000..2c21338 --- /dev/null +++ b/deno.jsonc @@ -0,0 +1,9 @@ +{ + "lint": { + "include": ["."], + "exclude": ["dist/", "node_modules/"], + "rules": { + "tags": ["recommended"] + } + } +} diff --git a/flake.nix b/flake.nix index 9b0d14e..00af6c8 100644 --- a/flake.nix +++ b/flake.nix @@ -32,6 +32,7 @@ bashInteractive nodejs_16 + deno dprint cargo-make nil