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

Issue:
🐛 Bug: Knip config files don't need !s
### 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

This template shouldn't include unnecessary `!`s in `knip.json` files.

### Actual

It does, still, for some reason that has been lost to time.

https://github.com/JoshuaKGoldberg/create-typescript-app/blob/5bd6122ec257fd13f8e81492b00f634a21649ac4/knip.json#L3

https://github.com/JoshuaKGoldberg/create-typescript-app/blob/5bd6122ec257fd13f8e81492b00f634a21649ac4/knip.json#L6

I'll go ahead and remove those.

### Additional Info

Prototyped in #1839.

💖 

Pull request description:
fix: don't include ! in Knip files
## PR Checklist

- [x] Addresses an existing open issue: fixes #1852
- [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

💖 

Patch:
diff --git a/knip.json b/knip.json
index 011f1bc..57c4f15 100644
--- a/knip.json
+++ b/knip.json
@@ -1,7 +1,7 @@
 {
 	"$schema": "https://unpkg.com/knip@5.41.1/schema.json",
-	"entry": ["script/*e2e.js", "src/index.ts!", "src/**/*.test.*"],
+	"entry": ["script/*e2e.js", "src/index.ts", "src/**/*.test.*"],
 	"ignoreDependencies": ["all-contributors-cli", "cspell-populate-words"],
 	"ignoreExportsUsedInFile": { "interface": true, "type": true },
-	"project": ["src/**/*.ts!", "script/**/*.js"]
+	"project": ["src/**/*.ts", "script/**/*.js"]
 }
diff --git a/src/next/blocks/blockKnip.ts b/src/next/blocks/blockKnip.ts
index fadbb20..d727d5e 100644
--- a/src/next/blocks/blockKnip.ts
+++ b/src/next/blocks/blockKnip.ts
@@ -53,12 +53,12 @@ export const blockKnip = base.createBlock({
 			files: {
 				"knip.json": JSON.stringify({
 					$schema: `https://unpkg.com/knip@${getPackageDependency("knip")}/schema.json`,
-					entry: ["src/index.ts!"],
+					entry: ["src/index.ts"],
 					ignoreExportsUsedInFile: {
 						interface: true,
 						type: true,
 					},
-					project: ["src/**/*.ts!"],
+					project: ["src/**/*.ts"],
 				}),
 			},
 		};
diff --git a/src/next/blocks/blockMarkdownlint.ts b/src/next/blocks/blockMarkdownlint.ts
index 0f1cd90..c3e9a75 100644
--- a/src/next/blocks/blockMarkdownlint.ts
+++ b/src/next/blocks/blockMarkdownlint.ts
@@ -1,5 +1,6 @@
 import { z } from "zod";
 
+import { formatIgnoreFile } from "../../steps/writing/creation/formatters/formatIgnoreFile.js";
 import { base } from "../base.js";
 import { blockCSpell } from "./blockCSpell.js";
 import { blockDevelopmentDocs } from "./blockDevelopmentDocs.js";
@@ -66,14 +67,14 @@ export const blockMarkdownlint = base.createBlock({
 					"first-line-h1": false,
 					"no-inline-html": false,
 				}),
-				".markdownlintignore": [
-					".github/CODE_OF_CONDUCT.md",
-					"CHANGELOG.md",
-					"node_modules/",
-					...ignores,
-				]
-					.sort()
-					.join("\n"),
+				".markdownlintignore": formatIgnoreFile(
+					[
+						".github/CODE_OF_CONDUCT.md",
+						"CHANGELOG.md",
+						"node_modules/",
+						...ignores,
+					].sort(),
+				),
 			},
 			scripts: [
 				{
diff --git a/src/next/blocks/blockPrettier.ts b/src/next/blocks/blockPrettier.ts
index bce284e..628a556 100644
--- a/src/next/blocks/blockPrettier.ts
+++ b/src/next/blocks/blockPrettier.ts
@@ -1,5 +1,6 @@
 import { z } from "zod";
 
+import { formatIgnoreFile } from "../../steps/writing/creation/formatters/formatIgnoreFile.js";
 import { base } from "../base.js";
 import { blockCSpell } from "./blockCSpell.js";
 import { blockDevelopmentDocs } from "./blockDevelopmentDocs.js";
@@ -96,9 +97,9 @@ pnpm format --write
 					".gitignore": "_\n",
 					"pre-commit": ["npx lint-staged\n", { mode: 0x777 }],
 				},
-				".prettierignore": ["/.husky", "/lib", "/pnpm-lock.yaml", ...ignores]
-					.sort()
-					.join("\n"),
+				".prettierignore": formatIgnoreFile(
+					["/.husky", "/lib", "/pnpm-lock.yaml", ...ignores].sort(),
+				),
 				".prettierrc.json": JSON.stringify({
 					$schema: "http://json.schemastore.org/prettierrc",
 					...(overrides.length && { overrides: overrides.sort() }),
diff --git a/src/steps/writing/creation/createKnipConfig.ts b/src/steps/writing/creation/createKnipConfig.ts
index ba7d41a..08e98db 100644
--- a/src/steps/writing/creation/createKnipConfig.ts
+++ b/src/steps/writing/creation/createKnipConfig.ts
@@ -9,11 +9,11 @@ export async function createKnipConfig() {
 
 	return await formatJson({
 		$schema: `https://unpkg.com/knip@${existingPackageJson?.devDependencies?.knip ?? "latest"}/schema.json`,
-		entry: ["src/index.ts!"],
+		entry: ["src/index.ts"],
 		ignoreExportsUsedInFile: {
 			interface: true,
 			type: true,
 		},
-		project: ["src/**/*.ts!"],
+		project: ["src/**/*.ts"],
 	});
 }


Test patch:
diff --git a/script/__snapshots__/migrate-test-e2e.ts.snap b/script/__snapshots__/migrate-test-e2e.ts.snap
index 1dbbf8b..4827f5e 100644
--- a/script/__snapshots__/migrate-test-e2e.ts.snap
+++ b/script/__snapshots__/migrate-test-e2e.ts.snap
@@ -216,12 +216,12 @@ exports[`expected file changes > knip.json 1`] = `
 @@ ... @@
  {
  	"$schema": "https://unpkg.com/knip@5.41.1/schema.json",
--	"entry": ["script/*e2e.js", "src/index.ts!", "src/**/*.test.*"],
+-	"entry": ["script/*e2e.js", "src/index.ts", "src/**/*.test.*"],
 -	"ignoreDependencies": ["all-contributors-cli", "cspell-populate-words"],
-+	"entry": ["src/index.ts!"],
++	"entry": ["src/index.ts"],
  	"ignoreExportsUsedInFile": { "interface": true, "type": true },
--	"project": ["src/**/*.ts!", "script/**/*.js"]
-+	"project": ["src/**/*.ts!"]
+-	"project": ["src/**/*.ts", "script/**/*.js"]
++	"project": ["src/**/*.ts"]
  }"
 `;
 
diff --git a/src/next/blocks/blockMarkdownlint.test.ts b/src/next/blocks/blockMarkdownlint.test.ts
index 749d102..db00740 100644
--- a/src/next/blocks/blockMarkdownlint.test.ts
+++ b/src/next/blocks/blockMarkdownlint.test.ts
@@ -78,7 +78,8 @@ describe("blockMarkdownlint", () => {
 			    ".markdownlint.json": "{"extends":"markdownlint/style/prettier","first-line-h1":false,"no-inline-html":false}",
 			    ".markdownlintignore": ".github/CODE_OF_CONDUCT.md
 			CHANGELOG.md
-			node_modules/",
+			node_modules/
+			",
 			  },
 			  "scripts": [
 			    {
@@ -169,7 +170,8 @@ describe("blockMarkdownlint", () => {
 			    ".markdownlintignore": ".github/CODE_OF_CONDUCT.md
 			CHANGELOG.md
 			lib/
-			node_modules/",
+			node_modules/
+			",
 			  },
 			  "scripts": [
 			    {
diff --git a/src/next/blocks/blockPrettier.test.ts b/src/next/blocks/blockPrettier.test.ts
index ef447c7..fc9787c 100644
--- a/src/next/blocks/blockPrettier.test.ts
+++ b/src/next/blocks/blockPrettier.test.ts
@@ -100,7 +100,8 @@ describe("blockPrettier", () => {
 			    },
 			    ".prettierignore": "/.husky
 			/lib
-			/pnpm-lock.yaml",
+			/pnpm-lock.yaml
+			",
 			    ".prettierrc.json": "{"$schema":"http://json.schemastore.org/prettierrc","useTabs":true}",
 			  },
 			  "scripts": [
@@ -211,7 +212,8 @@ describe("blockPrettier", () => {
 			    },
 			    ".prettierignore": "/.husky
 			/lib
-			/pnpm-lock.yaml",
+			/pnpm-lock.yaml
+			",
 			    ".prettierrc.json": "{"$schema":"http://json.schemastore.org/prettierrc","useTabs":true}",
 			  },
 			  "scripts": [
@@ -340,7 +342,8 @@ describe("blockPrettier", () => {
 			    ".prettierignore": "/.husky
 			/lib
 			/pnpm-lock.yaml
-			generated",
+			generated
+			",
 			    ".prettierrc.json": "{"$schema":"http://json.schemastore.org/prettierrc","overrides":[{"files":".nvmrc","options":{"parser":"yaml"}}],"plugins":["prettier-plugin-curly","prettier-plugin-packagejson","prettier-plugin-sh"],"useTabs":true}",
 			  },
 			  "scripts": [
diff --git a/src/steps/writing/creation/createKnipConfig.test.ts b/src/steps/writing/creation/createKnipConfig.test.ts
index 884e5e6..c94e565 100644
--- a/src/steps/writing/creation/createKnipConfig.test.ts
+++ b/src/steps/writing/creation/createKnipConfig.test.ts
@@ -21,12 +21,12 @@ describe("createKnipConfig", () => {
 
 		expect(JSON.parse(packageJson)).toEqual({
 			$schema: `https://unpkg.com/knip@${version}/schema.json`,
-			entry: ["src/index.ts!"],
+			entry: ["src/index.ts"],
 			ignoreExportsUsedInFile: {
 				interface: true,
 				type: true,
 			},
-			project: ["src/**/*.ts!"],
+			project: ["src/**/*.ts"],
 		});
 	});
 
@@ -37,12 +37,12 @@ describe("createKnipConfig", () => {
 
 		expect(JSON.parse(packageJson)).toEqual({
 			$schema: `https://unpkg.com/knip@latest/schema.json`,
-			entry: ["src/index.ts!"],
+			entry: ["src/index.ts"],
 			ignoreExportsUsedInFile: {
 				interface: true,
 				type: true,
 			},
-			project: ["src/**/*.ts!"],
+			project: ["src/**/*.ts"],
 		});
 	});
 
@@ -55,12 +55,12 @@ describe("createKnipConfig", () => {
 
 		expect(JSON.parse(packageJson)).toEqual({
 			$schema: `https://unpkg.com/knip@latest/schema.json`,
-			entry: ["src/index.ts!"],
+			entry: ["src/index.ts"],
 			ignoreExportsUsedInFile: {
 				interface: true,
 				type: true,
 			},
-			project: ["src/**/*.ts!"],
+			project: ["src/**/*.ts"],
 		});
 	});
 });