Repository: JoshuaKGoldberg/create-typescript-app (ts)

Issue:
🐛 Bug: Use root-level slashes for root-level directories in .gitignore and .prettierignore
### Bug Report Checklist

- [X] I have tried restarting my IDE and the issue persists.
- [X] I have pulled the latest `main` branch of the repository.
- [X] I have [searched for related issues](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aissue) and found none that matched my issue.

### Expected

For [`.gitignore`](https://git-scm.com/docs/gitignore#_pattern_format) and `.prettierignore` (which uses `.gitignore` syntax per https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore), some root-level directories should be ignored: e.g. `lib/`. Nested directories that happen to match the name should not be ignored: e.g. `src/lib/`.

### Actual

Right now, the files just include lines like `lib/`. Those match `lib/`, `src/lib/`, `src/other-nested-dir/lib/`, etc.

### Additional Info

Splitting out of #1670.

Note that `node_modules/` _should_ be kept to matching all directories.

💖  

Pull request description:
fix: use root-level slashes in .gitignore and .prettierignore
## PR Checklist

- [x] Addresses an existing open issue: fixes #1693
- [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken

## Overview

Per https://git-scm.com/docs/gitignore#_pattern_format, uses preceding `/` slashes to indicate directories and files that should only be matched at the root. Which is all of them.

The Git docs also noted that a trailing `/` makes the pattern only match directories. Since these are known directory names that won't be swapped with files accidentally, I took out any trailing `/`s to keep the files as small as possible.

Aside: Per https://lore.kernel.org/git/pull.1720.git.git.1715705582609.gitgitgadget@gmail.com, I'm pretty sure the Git docs have a small typo. But per https://lore.kernel.org/git/xmqqseyk2hce.fsf@gitster.g I don't know that it'll get resolved soon.

💖 

Patch:
diff --git a/.gitignore b/.gitignore
index 32ffbca..cd60c28 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
-coverage*/
-lib/
-node_modules/
+/coverage*
+/lib
+/node_modules
diff --git a/.prettierignore b/.prettierignore
index 608dd8d..40d3256 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,5 +1,5 @@
-.all-contributorsrc
-.husky/
-coverage*/
-lib/
-pnpm-lock.yaml
+/.all-contributorsrc
+/.husky
+/coverage*
+/lib
+/pnpm-lock.yaml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d39d2b4..40d71d8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+# [1.75.0](https://github.com/JoshuaKGoldberg/create-typescript-app/compare/v1.74.1...v1.75.0) (2024-11-26)
+
+### Features
+
+- remove now-unnecessary disable of jsdoc/lines-before-block ([#1701](https://github.com/JoshuaKGoldberg/create-typescript-app/issues/1701)) ([6ea503c](https://github.com/JoshuaKGoldberg/create-typescript-app/commit/6ea503c81be19f1696a9efcb840b9e9f05a2c9a2)), closes [#1698](https://github.com/JoshuaKGoldberg/create-typescript-app/issues/1698)
+
 ## [1.74.1](https://github.com/JoshuaKGoldberg/create-typescript-app/compare/v1.74.0...v1.74.1) (2024-11-26)
 
 ### Bug Fixes
diff --git a/package.json b/package.json
index 8da05be..41f0417 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
 	"name": "create-typescript-app",
-	"version": "1.74.1",
+	"version": "1.75.0",
 	"description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 💝",
 	"repository": {
 		"type": "git",
diff --git a/src/steps/writing/creation/createDotGitignore.ts b/src/steps/writing/creation/createDotGitignore.ts
index 3321ba8..e0cd5ed 100644
--- a/src/steps/writing/creation/createDotGitignore.ts
+++ b/src/steps/writing/creation/createDotGitignore.ts
@@ -3,8 +3,8 @@ import { formatIgnoreFile } from "./formatters/formatIgnoreFile.js";
 
 export function createDotGitignore(options: Pick<Options, "excludeTests">) {
 	return formatIgnoreFile([
-		...(options.excludeTests ? [] : ["coverage/"]),
-		"lib/",
-		"node_modules/",
+		...(options.excludeTests ? [] : ["/coverage"]),
+		"/lib",
+		"/node_modules",
 	]);
 }
diff --git a/src/steps/writing/creation/rootFiles.ts b/src/steps/writing/creation/rootFiles.ts
index fd0ab23..e86b0f3 100644
--- a/src/steps/writing/creation/rootFiles.ts
+++ b/src/steps/writing/creation/rootFiles.ts
@@ -27,11 +27,11 @@ export async function createRootFiles(options: Options) {
 		}),
 		".nvmrc": `20.12.2\n`,
 		".prettierignore": formatIgnoreFile([
-			...(options.excludeAllContributors ? [] : [".all-contributorsrc"]),
-			".husky/",
-			...(options.excludeTests ? [] : ["coverage/"]),
-			"lib/",
-			"pnpm-lock.yaml",
+			...(options.excludeAllContributors ? [] : ["/.all-contributorsrc"]),
+			"/.husky",
+			...(options.excludeTests ? [] : ["/coverage"]),
+			"/lib",
+			"/pnpm-lock.yaml",
 		]),
 		".prettierrc.json": await formatJson({
 			$schema: "http://json.schemastore.org/prettierrc",


Test patch:
diff --git a/script/__snapshots__/migrate-test-e2e.ts.snap b/script/__snapshots__/migrate-test-e2e.ts.snap
index af25592..83eeb3d 100644
--- a/script/__snapshots__/migrate-test-e2e.ts.snap
+++ b/script/__snapshots__/migrate-test-e2e.ts.snap
@@ -31,22 +31,22 @@ exports[`expected file changes > .gitignore 1`] = `
 "--- a/.gitignore
 +++ b/.gitignore
 @@ ... @@
--coverage*/
-+coverage/
- lib/
- node_modules/"
+-/coverage*
++/coverage
+ /lib
+ /node_modules"
 `;
 
 exports[`expected file changes > .prettierignore 1`] = `
 "--- a/.prettierignore
 +++ b/.prettierignore
 @@ ... @@
- .all-contributorsrc
- .husky/
--coverage*/
-+coverage/
- lib/
- pnpm-lock.yaml"
+ /.all-contributorsrc
+ /.husky
+-/coverage*
++/coverage
+ /lib
+ /pnpm-lock.yaml"
 `;
 
 exports[`expected file changes > README.md 1`] = `
diff --git a/src/steps/writing/creation/createDotGitignore.test.ts b/src/steps/writing/creation/createDotGitignore.test.ts
index c887e4b..1ce565f 100644
--- a/src/steps/writing/creation/createDotGitignore.test.ts
+++ b/src/steps/writing/creation/createDotGitignore.test.ts
@@ -7,9 +7,9 @@ describe("createDotGitignore", () => {
 		const actual = createDotGitignore({ excludeTests: false });
 
 		expect(actual).toMatchInlineSnapshot(`
-			"coverage/
-			lib/
-			node_modules/
+			"/coverage
+			/lib
+			/node_modules
 			"
 		`);
 	});
@@ -18,8 +18,8 @@ describe("createDotGitignore", () => {
 		const actual = createDotGitignore({ excludeTests: true });
 
 		expect(actual).toMatchInlineSnapshot(`
-			"lib/
-			node_modules/
+			"/lib
+			/node_modules
 			"
 		`);
 	});