From 4c4c57fe52c386c96251dc4d6affa87f6dff875c Mon Sep 17 00:00:00 2001
From: Benedek Kozma <cyberbeni@gmail.com>
Date: Tue, 15 Oct 2024 10:42:05 +0200
Subject: [PATCH 1/2] Update eslint config to also format tests

---
 Makefile                |  9 -----
 __tests__/main.test.ts  |  6 ++--
 __tests__/tsconfig.json |  8 +++++
 eslint.config.mjs       |  8 +++--
 jest.config.js          | 18 +++++-----
 package.json            | 76 ++++++++++++++++++++---------------------
 tsconfig.json           | 30 ++++++++--------
 7 files changed, 79 insertions(+), 76 deletions(-)
 create mode 100644 __tests__/tsconfig.json

diff --git a/Makefile b/Makefile
index 9a697a27..25bc0935 100644
--- a/Makefile
+++ b/Makefile
@@ -14,12 +14,3 @@ test:
 once-mac:
 	brew reinstall npm
 	brew reinstall yarn
- 
- .PHONY: clean
- clean:
-	rm -f tsconfig.tsbuildinfo
-	rm -rf dist
-
-.PHONY: git-status
-git-status:
-	@[ "$$(git status --porcelain)" = "" ] || ( echo "\033[0;31mError:\033[0m Working directory is dirty."; exit 1 )
diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts
index d462bce6..a044e45f 100644
--- a/__tests__/main.test.ts
+++ b/__tests__/main.test.ts
@@ -1,7 +1,7 @@
 import { SwiftToolInstaller } from '../src/installer'
 
 test('Test Package.resolved v3 parsing', async() => {
-  const installer = new SwiftToolInstaller("https://github.com/nicklockwood/SwiftFormat", "", "" , "", false)
-  const version = installer.parsePackageResolved()
-  expect(version).toBe("ab6844edb79a7b88dc6320e6cee0a0db7674dac3")
+	const installer = new SwiftToolInstaller('https://github.com/nicklockwood/SwiftFormat', '', '' , '', false)
+	const version = installer.parsePackageResolved()
+	expect(version).toBe('ab6844edb79a7b88dc6320e6cee0a0db7674dac3')
 })
diff --git a/__tests__/tsconfig.json b/__tests__/tsconfig.json
new file mode 100644
index 00000000..8ded4193
--- /dev/null
+++ b/__tests__/tsconfig.json
@@ -0,0 +1,8 @@
+{
+	"extends": "../tsconfig.json",
+	"compilerOptions": {
+		"rootDir": "..",
+		"noEmit": true
+	},
+	"include": ["."]
+}
diff --git a/eslint.config.mjs b/eslint.config.mjs
index df51a9c0..bfd0f478 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -3,7 +3,10 @@ import js from "@eslint/js"
 import ts from "typescript-eslint"
 
 export default ts.config({
-	files: ["src/**/*.ts"],
+	files: [
+		"src/**/*.ts",
+		"__tests__/**/*.ts",
+	],
 	ignores: ["src/vendor/**"],
 	extends: [
 		js.configs.recommended,
@@ -13,7 +16,8 @@ export default ts.config({
 		parser: ts.parser,
 		parserOptions: {
 			sourceType: "script",
-			project: "tsconfig.json"
+			project: true,
+			tsconfigRootDir: "."
 		},
 		globals: {
 			...globals.node
diff --git a/jest.config.js b/jest.config.js
index d170f635..844a6994 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,11 +1,11 @@
 module.exports = {
-  clearMocks: true,
-  moduleFileExtensions: ['js', 'ts'],
-  testEnvironment: 'node',
-  testMatch: ['**/__tests__/*.ts'],
-  testRunner: 'jest-circus/runner',
-  transform: {
-    '^.+\\.ts$': 'ts-jest'
-  },
-  verbose: true
+	clearMocks: true,
+	moduleFileExtensions: ['js', 'ts'],
+	testEnvironment: 'node',
+	testMatch: ['**/__tests__/*.ts'],
+	testRunner: 'jest-circus/runner',
+	transform: {
+		'^.+\\.ts$': 'ts-jest'
+	},
+	verbose: true
 }
\ No newline at end of file
diff --git a/package.json b/package.json
index 8321e2f1..4969e391 100644
--- a/package.json
+++ b/package.json
@@ -1,40 +1,40 @@
 {
-  "name": "install-swift-tool",
-  "description": "Install swift based tools inside a GitHub Action.",
-  "repository": {
-    "type": "git",
-    "url": "github:Cyberbeni/install-swift-tool.git"
-  },
-  "scripts": {
-    "format": "eslint --max-warnings=0 --fix .",
-    "lint": "eslint .",
-    "build": "ncc build --minify --out dist src/main.ts",
-    "test": "jest"
-  },
-  "keywords": [],
-  "author": "Cyberbeni",
-  "license": "MIT",
-  "dependencies": {
-    "@actions/cache": "^3.2.4",
-    "@actions/core": "^1.10.1",
-    "@actions/exec": "^1.1.1",
-    "os": "^0.1.2",
-    "semver": "^7.6.3",
-    "uuid": "^10.0.0"
-  },
-  "devDependencies": {
-    "@eslint/js": "^9.11.1",
-    "@tsconfig/node20": "^20.1.4",
-    "@types/jest": "^29.5.13",
-    "@types/node": "^22.7.4",
-    "@types/semver": "^7.5.8",
-    "@types/uuid": "^10.0.0",
-    "@vercel/ncc": "^0.38.2",
-    "eslint": "^9.11.1",
-    "jest": "^29.7.0",
-    "jest-circus": "^29.7.0",
-    "ts-jest": "^29.2.5",
-    "typescript": "^5.6.2",
-    "typescript-eslint": "^8.8.1"
-  }
+	"name": "install-swift-tool",
+	"description": "Install swift based tools inside a GitHub Action.",
+	"repository": {
+		"type": "git",
+		"url": "github:Cyberbeni/install-swift-tool.git"
+	},
+	"scripts": {
+		"format": "eslint --max-warnings=0 --fix .",
+		"lint": "eslint .",
+		"build": "ncc build --minify --out dist src/main.ts",
+		"test": "jest"
+	},
+	"keywords": [],
+	"author": "Cyberbeni",
+	"license": "MIT",
+	"dependencies": {
+		"@actions/cache": "^3.2.4",
+		"@actions/core": "^1.10.1",
+		"@actions/exec": "^1.1.1",
+		"os": "^0.1.2",
+		"semver": "^7.6.3",
+		"uuid": "^10.0.0"
+	},
+	"devDependencies": {
+		"@eslint/js": "^9.11.1",
+		"@tsconfig/node20": "^20.1.4",
+		"@types/jest": "^29.5.13",
+		"@types/node": "^22.7.4",
+		"@types/semver": "^7.5.8",
+		"@types/uuid": "^10.0.0",
+		"@vercel/ncc": "^0.38.2",
+		"eslint": "^9.11.1",
+		"jest": "^29.7.0",
+		"jest-circus": "^29.7.0",
+		"ts-jest": "^29.2.5",
+		"typescript": "^5.6.2",
+		"typescript-eslint": "^8.8.1"
+	}
 }
diff --git a/tsconfig.json b/tsconfig.json
index 5e90c43e..17dbf958 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,18 +1,18 @@
 {
-  "extends": "@tsconfig/node20/tsconfig.json",
-  "compilerOptions": {
-    // Build:
-    "incremental": false,
-    "rootDir": "./src",
-    "declaration": false,
+	"extends": "@tsconfig/node20/tsconfig.json",
+	"compilerOptions": {
+		// Build:
+		"incremental": false,
+		"rootDir": "./src",
+		"declaration": false,
 
-    // Lint:
-    "strict": true,
-    "noImplicitAny": false,
-    "noFallthroughCasesInSwitch": true,
-    "noImplicitReturns": true,
-    "noUnusedLocals": true,
-    "noUnusedParameters": true
-  },
-  "exclude": ["node_modules", "__tests__"]
+		// Lint:
+		"strict": true,
+		"noImplicitAny": false,
+		"noFallthroughCasesInSwitch": true,
+		"noImplicitReturns": true,
+		"noUnusedLocals": true,
+		"noUnusedParameters": true
+	},
+	"include": ["src"]
 }

From 448d373a1c70d1d974a70c7ef478c57d6cfa4fb9 Mon Sep 17 00:00:00 2001
From: Benedek Kozma <cyberbeni@gmail.com>
Date: Tue, 15 Oct 2024 10:42:53 +0200
Subject: [PATCH 2/2] add newline to end of jest config

---
 jest.config.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jest.config.js b/jest.config.js
index 844a6994..9f90f29b 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -8,4 +8,4 @@ module.exports = {
 		'^.+\\.ts$': 'ts-jest'
 	},
 	verbose: true
-}
\ No newline at end of file
+}