Skip to content

Commit 91a3701

Browse files
feat: add prettier-plugin-sh (#1544)
## PR Checklist - [x] Addresses an existing open issue: fixes #1263 - [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 Adds the plugin in, similar to the existing `prettier-plugin-curly` and `prettier-plugin-packagejson` plugins. 💖
1 parent be806ca commit 91a3701

File tree

10 files changed

+48
-7
lines changed

10 files changed

+48
-7
lines changed

.github/DEVELOPMENT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
After [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo) and [installing pnpm](https://pnpm.io/installation):
77

88
```shell
9-
git clone https://github.com/<your-name-here>/create-typescript-app
9+
git clone https://github.com/ < your-name-here > /create-typescript-app
1010
cd create-typescript-app
1111
pnpm install
1212
```

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.all-contributorsrc
2+
.husky/
23
coverage*/
34
lib/
45
pnpm-lock.yaml

.prettierrc.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"$schema": "http://json.schemastore.org/prettierrc",
33
"overrides": [{ "files": ".nvmrc", "options": { "parser": "yaml" } }],
4-
"plugins": ["prettier-plugin-curly", "prettier-plugin-packagejson"],
4+
"plugins": [
5+
"prettier-plugin-curly",
6+
"prettier-plugin-sh",
7+
"prettier-plugin-packagejson"
8+
],
59
"useTabs": true
610
}

docs/Tooling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pnpm run build --watch
8383

8484
[**Prettier**](https://prettier.io): Formats code for developers and enforces a consistent formatting style.
8585
It's run on file save per [VS Code](https://code.visualstudio.com/docs/getstarted/settings) settings and as a Git commit hook via [husky](https://typicode.github.io/husky) and [lint-staged](https://github.com/okonet/lint-staged).
86-
[prettier-plugin-curly](https://github.com/JoshuaKGoldberg/prettier-plugin-curly) and [prettier-plugin-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson) add in more formatting as well.
86+
[prettier-plugin-curly](https://github.com/JoshuaKGoldberg/prettier-plugin-curly), [prettier-plugin-sh](https://github.com/un-ts/prettier/tree/master/packages/sh), and [prettier-plugin-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson) add in more formatting as well.
8787

8888
Auto-formatting all files:
8989

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"markdownlint-cli": "^0.41.0",
9494
"prettier-plugin-curly": "^0.2.0",
9595
"prettier-plugin-packagejson": "^2.5.0",
96+
"prettier-plugin-sh": "^0.14.0",
9697
"release-it": "^17.3.0",
9798
"sentences-per-line": "^0.2.1",
9899
"tsup": "^8.1.0",

pnpm-lock.yaml

+28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

script/__snapshots__/migrate-test-e2e.ts.snap

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ exports[`expected file changes > .prettierignore 1`] = `
2929
+++ b/.prettierignore
3030
@@ ... @@
3131
.all-contributorsrc
32+
.husky/
3233
-coverage*/
3334
+coverage/
3435
lib/

src/steps/finalizeDependencies.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe("finalize", () => {
3838
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
3939
[
4040
[
41-
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @release-it/conventional-changelog@latest @types/eslint-plugin-markdown@latest @vitest/coverage-v8@latest all-contributors-cli@latest console-fail-test@latest cspell@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-jsonc@latest eslint-plugin-markdown@latest eslint-plugin-n@latest eslint-plugin-package-json@latest eslint-plugin-perfectionist@latest eslint-plugin-regexp@latest eslint-plugin-vitest@latest eslint-plugin-yml@latest husky@latest jsonc-eslint-parser@latest knip@latest lint-staged@latest markdownlint@latest markdownlint-cli@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest release-it@latest sentences-per-line@latest tsup@latest typescript@latest typescript-eslint@latest vitest@latest -D",
41+
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @release-it/conventional-changelog@latest @types/eslint-plugin-markdown@latest @vitest/coverage-v8@latest all-contributors-cli@latest console-fail-test@latest cspell@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-jsonc@latest eslint-plugin-markdown@latest eslint-plugin-n@latest eslint-plugin-package-json@latest eslint-plugin-perfectionist@latest eslint-plugin-regexp@latest eslint-plugin-vitest@latest eslint-plugin-yml@latest husky@latest jsonc-eslint-parser@latest knip@latest lint-staged@latest markdownlint@latest markdownlint-cli@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest release-it@latest sentences-per-line@latest tsup@latest typescript@latest typescript-eslint@latest vitest@latest -D",
4242
],
4343
[
4444
"npx all-contributors-cli generate",
@@ -59,7 +59,7 @@ describe("finalize", () => {
5959
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
6060
[
6161
[
62-
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @release-it/conventional-changelog@latest @types/eslint-plugin-markdown@latest @vitest/coverage-v8@latest all-contributors-cli@latest console-fail-test@latest cspell@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-jsonc@latest eslint-plugin-markdown@latest eslint-plugin-n@latest eslint-plugin-package-json@latest eslint-plugin-perfectionist@latest eslint-plugin-regexp@latest eslint-plugin-vitest@latest eslint-plugin-yml@latest husky@latest jsonc-eslint-parser@latest knip@latest lint-staged@latest markdownlint@latest markdownlint-cli@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest release-it@latest sentences-per-line@latest tsup@latest typescript@latest typescript-eslint@latest vitest@latest -D --offline",
62+
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @release-it/conventional-changelog@latest @types/eslint-plugin-markdown@latest @vitest/coverage-v8@latest all-contributors-cli@latest console-fail-test@latest cspell@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-jsonc@latest eslint-plugin-markdown@latest eslint-plugin-n@latest eslint-plugin-package-json@latest eslint-plugin-perfectionist@latest eslint-plugin-regexp@latest eslint-plugin-vitest@latest eslint-plugin-yml@latest husky@latest jsonc-eslint-parser@latest knip@latest lint-staged@latest markdownlint@latest markdownlint-cli@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest release-it@latest sentences-per-line@latest tsup@latest typescript@latest typescript-eslint@latest vitest@latest -D --offline",
6363
],
6464
[
6565
"npx all-contributors-cli generate",
@@ -92,7 +92,7 @@ describe("finalize", () => {
9292
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
9393
[
9494
[
95-
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @types/eslint-plugin-markdown@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-n@latest eslint-plugin-regexp@latest husky@latest lint-staged@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest tsup@latest typescript@latest typescript-eslint@latest -D",
95+
"pnpm add @eslint-community/eslint-plugin-eslint-comments@latest @eslint/js@latest @types/eslint-plugin-markdown@latest eslint@latest eslint-plugin-jsdoc@latest eslint-plugin-n@latest eslint-plugin-regexp@latest husky@latest lint-staged@latest prettier@latest prettier-plugin-curly@latest prettier-plugin-packagejson@latest prettier-plugin-sh@latest tsup@latest typescript@latest typescript-eslint@latest -D",
9696
],
9797
[
9898
"pnpm dedupe",

src/steps/finalizeDependencies.ts

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export async function finalizeDependencies(options: Options) {
1616
"lint-staged",
1717
"prettier",
1818
"prettier-plugin-curly",
19+
"prettier-plugin-sh",
1920
"prettier-plugin-packagejson",
2021
"tsup",
2122
"typescript",

src/steps/writing/creation/rootFiles.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export async function createRootFiles(options: Options) {
2828
".nvmrc": `20.12.2\n`,
2929
".prettierignore": formatIgnoreFile([
3030
...(options.excludeAllContributors ? [] : [".all-contributorsrc"]),
31+
".husky/",
3132
...(options.excludeTests ? [] : ["coverage/"]),
3233
"lib/",
3334
"pnpm-lock.yaml",
@@ -40,7 +41,11 @@ export async function createRootFiles(options: Options) {
4041
options: { parser: "yaml" },
4142
},
4243
],
43-
plugins: ["prettier-plugin-curly", "prettier-plugin-packagejson"],
44+
plugins: [
45+
"prettier-plugin-curly",
46+
"prettier-plugin-sh",
47+
"prettier-plugin-packagejson",
48+
],
4449
useTabs: true,
4550
}),
4651
...(!options.excludeReleases && {

0 commit comments

Comments
 (0)