From 79316a7a03d0d53e5fcf62f84fa886685e7b380f Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Sun, 21 Apr 2024 14:17:24 -0300 Subject: [PATCH] Add prettier config --- .prettierignore | 2 +- package.json | 1 + prettier.config.cjs | 12 ++++++++++++ src/index.ts | 13 ++++++------- 4 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 prettier.config.cjs diff --git a/.prettierignore b/.prettierignore index 11aac20..dee70d2 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,2 @@ +dist pnpm-lock.yaml - diff --git a/package.json b/package.json index 1df1938..89b2ca9 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "scripts": { "build": "tsup", "format": "prettier --write .", + "check-fmt": "prettier --check .", "lint": "eslint src/**/*.ts", "package": "ncc build", "all": "pnpm run format && pnpm run lint && pnpm run build && pnpm run package" diff --git a/prettier.config.cjs b/prettier.config.cjs new file mode 100644 index 0000000..ea184ad --- /dev/null +++ b/prettier.config.cjs @@ -0,0 +1,12 @@ +/** @type {import('prettier').Config} */ +module.exports = { + plugins: [require.resolve("@trivago/prettier-plugin-sort-imports")], + semi: true, + singleQuote: false, + tabWidth: 2, + trailingComma: "all", + useTabs: false, + // Import sorting + importOrderSeparation: true, + importOrderSortSpecifiers: true, +}; diff --git a/src/index.ts b/src/index.ts index 169b441..6aa67ff 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,15 +1,14 @@ +import * as core from "@actions/core"; +import { IdsToolbox } from "detsys-ts"; +import got from "got"; +import * as http from "http"; +import { SpawnOptions, exec, spawn } from "node:child_process"; +import { openSync, readFileSync } from "node:fs"; import * as fs from "node:fs/promises"; import * as os from "node:os"; import * as path from "node:path"; -import { spawn, exec, SpawnOptions } from "node:child_process"; -import { openSync, readFileSync } from "node:fs"; import { inspect, promisify } from "node:util"; -import * as http from "http"; - -import * as core from "@actions/core"; import { Tail } from "tail"; -import got from "got"; -import { IdsToolbox } from "detsys-ts"; const ENV_CACHE_DAEMONDIR = "MAGIC_NIX_CACHE_DAEMONDIR";