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

Script that runs 'npx prettier' on all .js and .md files. #556

Merged
merged 4 commits into from
Aug 13, 2019
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
14 changes: 14 additions & 0 deletions scripts/prettier.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# Run 'npx prettier' on the given .js or .md files. If no files are
# given, run it on all the .js and .md files of the project.

cd $(dirname $0)
cd ..

shopt -s globstar
files="$@"
[[ -z $files ]] && files='src/**/*.js pages/*.js static/**/*.md'
fix_files=$(npx prettier --list-different $files)
[[ -n $fix_files ]] && npx prettier --write $fix_files


2 changes: 1 addition & 1 deletion static/docs/user-guide/contributing-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ in question.
- We use [Prettier](https://prettier.io/) default conventions to format our
source code files. The formatting of staged files will automatically be done
by the Git pre-commit hook we have configured. You may also run
`npx prettier --write <file paths>` manually before committing changes.
`scripts/prettier.sh <file paths>` manually before committing changes.

- Using `dvc <command>` in the Markdown files, the docs engine will create a
link to that command automatically. (No need to use `[]()` explicitly to
Expand Down