From cbf29bd54669141b1fc97f38889cfcd7917955b1 Mon Sep 17 00:00:00 2001 From: Valtteri Laitinen Date: Mon, 22 Feb 2021 18:10:05 +0200 Subject: [PATCH] style(shell): add trailing newlines (#870) Adds trailing newlines to files generated by the `install` and `add` commands. --- .husky/.gitignore | 2 +- src/commands/add.ts | 2 +- src/commands/install.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.husky/.gitignore b/.husky/.gitignore index c9cdc63b0..31354ec13 100644 --- a/.husky/.gitignore +++ b/.husky/.gitignore @@ -1 +1 @@ -_ \ No newline at end of file +_ diff --git a/src/commands/add.ts b/src/commands/add.ts index 6df246bc1..47e48de90 100644 --- a/src/commands/add.ts +++ b/src/commands/add.ts @@ -15,7 +15,7 @@ function createHookFile(file: string, cmd: string) { throw new Error(`${file} already exists`) } - const data = ['#!/bin/sh', '. "$(dirname "$0")/_/husky.sh"', '', cmd].join( + const data = ['#!/bin/sh', '. "$(dirname "$0")/_/husky.sh"', '', cmd, ''].join( '\n' ) diff --git a/src/commands/install.ts b/src/commands/install.ts index 2717ca19c..fd4e6811f 100644 --- a/src/commands/install.ts +++ b/src/commands/install.ts @@ -26,7 +26,7 @@ export function install(dir = '.husky'): void { fs.mkdirSync(path.join(dir, '_'), { recursive: true }) // Create .husky/.gitignore - fs.writeFileSync(path.join(dir, '.gitignore'), '_', 'utf-8') + fs.writeFileSync(path.join(dir, '.gitignore'), '_\n', 'utf-8') // Copy husky.sh to .husky/_/husky.sh fs.copyFileSync(