From 3161f9b4c67a4e990190f3fb6967fe88e2434422 Mon Sep 17 00:00:00 2001 From: Mathias Lykkegaard Lorenzen Date: Sun, 18 Feb 2024 10:43:24 +0100 Subject: [PATCH] ci: add linting (#242) * ci: add linting * fix: don't auto-fix import order * fix: lockfile * chore: update eslint * fix: disable import order --- .eslintrc.json | 3 +- .github/workflows/build.yml | 26 ++++----- .vscode/settings.json | 13 ++--- package.json | 6 +-- src/discover.ts | 2 +- src/watch.ts | 6 +-- yarn.lock | 102 ++++++++++++++++++------------------ 7 files changed, 77 insertions(+), 81 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index b308d1d4..374a1289 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,6 +3,7 @@ "rules": { "import/no-named-as-default": "off", "no-console": "off", - "@typescript-eslint/ban-ts-comment": "off" + "@typescript-eslint/ban-ts-comment": "off", + "import/order": "off" } } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71f196d5..0e6df915 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,9 @@ name: Build on: push: - branches: [ "main" ] + branches: [main] pull_request: - branches: [ "main" ] + branches: [main] jobs: build: @@ -13,18 +13,20 @@ jobs: strategy: matrix: node-version: [20.x] - + steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: npm - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' + - run: yarn install --frozen-lockfile - - run: yarn install --frozen-lockfile + - run: yarn run compile - - run: yarn run compile + - run: yarn run lint - - run: yarn test + - run: yarn test diff --git a/.vscode/settings.json b/.vscode/settings.json index 7482292c..efa8e5d3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,17 +8,10 @@ }, // Turn off tsc task auto detection since we have the necessary tasks as npm scripts "typescript.tsc.autoDetect": "off", - "cSpell.words": ["execa"], - "vitest.exclude": [ - "**/out/**", - "**/src/**", - "**/samples/**", - "**/node_modules/**", - "**/dist/**", - "**/cypress/**", - "**/.{idea,git,cache,output,temp}/**" - ], "[typescript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" + }, + "editor.codeActionsOnSave": { + "source.organizeImports": "never" } } diff --git a/package.json b/package.json index 466a0f15..13afb023 100644 --- a/package.json +++ b/package.json @@ -160,13 +160,13 @@ "@types/semver": "^7.3.9", "@types/vscode": "^1.77.0", "@types/ws": "^8.5.10", - "@typescript-eslint/eslint-plugin": "^6.19.0", - "@typescript-eslint/parser": "^6.19.0", + "@typescript-eslint/eslint-plugin": "^7.0.1", + "@typescript-eslint/parser": "^7.0.1", "@vitest/ws-client": "^1.2.0", "@vscode/test-electron": "^2.1.2", "@vue/reactivity": "^3.2.33", "@vueuse/core": "^8.4.2", - "eslint": "^8.9.0", + "eslint": "^8.56.0", "fs-extra": "^10.0.1", "fuse.js": "^6.6.2", "get-port": "^6.1.2", diff --git a/src/discover.ts b/src/discover.ts index 8d121bbf..e7241d13 100644 --- a/src/discover.ts +++ b/src/discover.ts @@ -1,5 +1,5 @@ -import minimatch from 'minimatch' import path, { sep } from 'path' +import minimatch from 'minimatch' import type { ResolvedConfig } from 'vitest' import * as vscode from 'vscode' import type { TestData } from './TestData' diff --git a/src/watch.ts b/src/watch.ts index b22b2a1f..0d48b6c9 100644 --- a/src/watch.ts +++ b/src/watch.ts @@ -361,8 +361,8 @@ export function syncTestStatusToVsCode( if (finished) { for (const log of task.logs ?? []) { // LF to CRLF https://code.visualstudio.com/api/extension-guides/testing#test-output - const output = log.content.replace(/(?