Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add prettier-plugin-sh #1544

Merged
merged 4 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
After [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo) and [installing pnpm](https://pnpm.io/installation):

```shell
git clone https://github.com/<your-name-here>/create-typescript-app
git clone https://github.com/ < your-name-here > /create-typescript-app
cd create-typescript-app
pnpm install
```
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.all-contributorsrc
.husky/
coverage*/
lib/
pnpm-lock.yaml
6 changes: 5 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"$schema": "http://json.schemastore.org/prettierrc",
"overrides": [{ "files": ".nvmrc", "options": { "parser": "yaml" } }],
"plugins": ["prettier-plugin-curly", "prettier-plugin-packagejson"],
"plugins": [
"prettier-plugin-curly",
"prettier-plugin-sh",
"prettier-plugin-packagejson"
],
"useTabs": true
}
2 changes: 1 addition & 1 deletion docs/Tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pnpm run build --watch

[**Prettier**](https://prettier.io): Formats code for developers and enforces a consistent formatting style.
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).
[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.
[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.

Auto-formatting all files:

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"markdownlint-cli": "^0.41.0",
"prettier-plugin-curly": "^0.2.0",
"prettier-plugin-packagejson": "^2.5.0",
"prettier-plugin-sh": "^0.14.0",
"release-it": "^17.3.0",
"sentences-per-line": "^0.2.1",
"tsup": "^8.1.0",
Expand Down
28 changes: 28 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions script/__snapshots__/migrate-test-e2e.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ exports[`expected file changes > .prettierignore 1`] = `
+++ b/.prettierignore
@@ ... @@
.all-contributorsrc
.husky/
-coverage*/
+coverage/
lib/
Expand Down
6 changes: 3 additions & 3 deletions src/steps/finalizeDependencies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("finalize", () => {
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
[
[
"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",
"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",
],
[
"npx all-contributors-cli generate",
Expand All @@ -59,7 +59,7 @@ describe("finalize", () => {
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
[
[
"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",
"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",
],
[
"npx all-contributors-cli generate",
Expand Down Expand Up @@ -92,7 +92,7 @@ describe("finalize", () => {
expect(mockExecaCommand.mock.calls).toMatchInlineSnapshot(`
[
[
"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",
"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",
],
[
"pnpm dedupe",
Expand Down
1 change: 1 addition & 0 deletions src/steps/finalizeDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export async function finalizeDependencies(options: Options) {
"lint-staged",
"prettier",
"prettier-plugin-curly",
"prettier-plugin-sh",
"prettier-plugin-packagejson",
"tsup",
"typescript",
Expand Down
7 changes: 6 additions & 1 deletion src/steps/writing/creation/rootFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ 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",
Expand All @@ -40,7 +41,11 @@ export async function createRootFiles(options: Options) {
options: { parser: "yaml" },
},
],
plugins: ["prettier-plugin-curly", "prettier-plugin-packagejson"],
plugins: [
"prettier-plugin-curly",
"prettier-plugin-sh",
"prettier-plugin-packagejson",
],
useTabs: true,
}),
...(!options.excludeReleases && {
Expand Down
Loading