Skip to content

Commit

Permalink
feat: WEB-372 Config prettier (#5991)
Browse files Browse the repository at this point in the history
* first run of prettier format

* add more prettierignore

* update prettier ignore

* Update clsx classname utils

* Update README + pre-commit

* Rerun prettier with web config

* fixed formatting on files

---------

Co-authored-by: Marc Hess <[email protected]>
  • Loading branch information
carlagn and mhessdev authored May 10, 2024
1 parent bf41d00 commit 1fa29e3
Show file tree
Hide file tree
Showing 100 changed files with 3,701 additions and 3,502 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/doc_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: ✍ Documentation request or bug
about: Report a content issue (incorrect content, spelling mistake, broken link), request new content, or suggest an improvement.
labels: 'docs'
assignees: ''
labels: "docs"
assignees: ""
---
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/website_request.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: ✨ Doc site request or bug
about: Request a website feature or improvement, or report a bug. For documentation, please use documentation request.
labels: 'website'
labels: "website"
---
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/z_doc_release.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: 🎉 Documentation release
about: INTERNAL ONLY. Documentation release tasks.
title: 'Release:'
labels: 'docs,docs/task'
assignees: ''
title: "Release:"
labels: "docs,docs/task"
assignees: ""
---

## Release
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/create-or-update-comment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ inputs:
body-includes:
description: An optional string to search by (use this almost always)
required: false
default: 'bot'
default: "bot"
runs:
using: composite
steps:
Expand All @@ -19,7 +19,7 @@ runs:
id: find-existing
with:
issue-number: ${{ inputs.pull-request }}
comment-author: 'github-actions[bot]'
comment-author: "github-actions[bot]"
body-includes: ${{ inputs.body-includes }}

- name: Create comment
Expand Down
11 changes: 11 additions & 0 deletions .github/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0

# Prettify all selected files
echo "$FILES" | xargs ./node_modules/.bin/prettier --ignore-unknown --write

# Add back the modified/prettified files to staging
echo "$FILES" | xargs git add

exit 0
18 changes: 9 additions & 9 deletions .github/workflows/image-optimise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ name: Compress images
on:
pull_request:
paths:
- '**.jpg'
- '**.jpeg'
- '**.png'
- '**.webp'
- "**.jpg"
- "**.jpeg"
- "**.png"
- "**.webp"
push:
branches:
- main
paths:
- '**.jpg'
- '**.jpeg'
- '**.png'
- '**.webp'
- "**.jpg"
- "**.jpeg"
- "**.png"
- "**.webp"
workflow_dispatch:
schedule:
- cron: '00 23 * * 0'
- cron: "00 23 * * 0"
jobs:
build:
name: calibreapp/image-actions
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/list-changed-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
branches:
- main
paths:
- 'content/**/*'
- "content/**/*"

jobs:
post-files-changed-comment:
name: 'Post files changed comment'
name: "Post files changed comment"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -49,4 +49,4 @@ jobs:
with:
pull-request: ${{ github.event.pull_request.number }}
body: ${{ steps.build-comment-body.outputs.body }}
body-includes: 'original | preview'
body-includes: "original | preview"
2 changes: 1 addition & 1 deletion .github/workflows/lost-pixel.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Lost Pixel'
name: "Lost Pixel"
on: [push]

jobs:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ on:
branches:
- main
paths:
- 'content/**/*'
- "content/**/*"
pull_request:
branches:
- main
paths:
- 'content/**/*'
- "content/**/*"
jobs:
spellcheck:
name: 'Docs: Spellcheck'
name: "Docs: Spellcheck"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Check out the code
- uses: actions/setup-node@v4
name: Setup node
with:
node-version: '18'
node-version: "18"
- run: npm install -g cspell
name: Install cSpell
- run: cspell --config ./cSpell.json "content/**/*.mdx" --no-progress
Expand Down
7 changes: 4 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/
public/
.cache/
static/
out/
history/
*.mdx
*.mdx
plugins/
.husky/
.docusaurus/
10 changes: 6 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"printWidth": 100,
"jsxBracketSameLine": false,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"singleQuote": false,
"trailingComma": "es5",
"semi": true
"semi": true,
"singleAttributePerLine": false,
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "css"
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,23 @@ $ mdtool remove 2
# Result: 01-a, 02-b, 03-c, 04-d becomes 01-a, 02-b, 02-c, 03-d; 02-b is supposed to be manually deleted
```

### Prettier

To align with the current standards specified in our `.prettierc` configuration, it's recommended to include the `pre-commit` hook within the `/.github/` directory. This can be achieved by executing the following commands from the project's root:

```bash
mv /.github/pre-commit /.git/hooks/
```

After that, and upon executing a commit command, you may encounter the following message:

```
hint: The '.git/hooks/pre-commit' hook was ignored because it's not set as executable.
hint: You can disable this warning with `git config advice.ignoredHook false`.
```

To address this, you can follow the provided instructions to disable the `ignoredHook` flag.

#### Thanks Luca

![](https://res.cloudinary.com/prismaio/image/upload/v1628765536/docs/LJ0FGHk_u2jjxv.png)
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};
8 changes: 4 additions & 4 deletions content/200-orm/050-overview/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Overview",
"collapsible": false,
"collapsed": false
}
"label": "Overview",
"collapsible": false,
"collapsed": false
}
8 changes: 4 additions & 4 deletions content/200-orm/100-prisma-schema/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Prisma Schema",
"collapsible": false,
"collapsed": false
}
"label": "Prisma Schema",
"collapsible": false,
"collapsed": false
}
8 changes: 4 additions & 4 deletions content/200-orm/200-prisma-client/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Prisma Client",
"collapsible": false,
"collapsed": false
}
"label": "Prisma Client",
"collapsible": false,
"collapsed": false
}
8 changes: 4 additions & 4 deletions content/200-orm/300-prisma-migrate/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Prisma Migrate",
"collapsible": false,
"collapsed": false
}
"label": "Prisma Migrate",
"collapsible": false,
"collapsed": false
}
8 changes: 4 additions & 4 deletions content/200-orm/400-tools/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Tools",
"collapsible": false,
"collapsed": false
}
"label": "Tools",
"collapsible": false,
"collapsed": false
}
8 changes: 4 additions & 4 deletions content/200-orm/500-reference/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Reference",
"collapsible": false,
"collapsed": false
}
"label": "Reference",
"collapsible": false,
"collapsed": false
}
8 changes: 4 additions & 4 deletions content/200-orm/800-more/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "More",
"collapsible": false,
"collapsed": false
}
"label": "More",
"collapsible": false,
"collapsed": false
}
6 changes: 3 additions & 3 deletions content/400-pulse/250-database-setup/_category_.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"collapsed": false,
"collapsible": false
}
"collapsed": false,
"collapsible": false
}
6 changes: 3 additions & 3 deletions content/500-platform/20-concepts/_category_.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"collapsed": false,
"collapsible": false
}
"collapsed": false,
"collapsible": false
}
2 changes: 1 addition & 1 deletion content/500-platform/60-platform-cli/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"customProps": {
"badge": "Early Access"
}
}
}
8 changes: 4 additions & 4 deletions content/500-platform/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"collapsed": false,
"collapsible": false,
"className": "firstTitle"
}
"collapsed": false,
"collapsible": false,
"className": "firstTitle"
}
2 changes: 1 addition & 1 deletion content/600-about/200-prisma-docs/_category_.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"collapsed": false,
"collapsible": false
}
}
Loading

0 comments on commit 1fa29e3

Please sign in to comment.