Skip to content

Commit

Permalink
Merge pull request #556 from dashohoxha/prettier-script
Browse files Browse the repository at this point in the history
Script that runs 'npx prettier' on all .js and .md files.
  • Loading branch information
shcheklein authored Aug 13, 2019
2 parents 5020fd0 + 3254dbf commit 3bb3083
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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

0 comments on commit 3bb3083

Please sign in to comment.