Add prettier

This commit is contained in:
Oliver Davies 2020-03-14 21:51:50 +00:00
parent d1b22efc0e
commit e4444b405a
5 changed files with 66 additions and 0 deletions

30
.github/workflows/format.yml vendored Normal file
View file

@ -0,0 +1,30 @@
name: Run Prettier
on:
push:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Run prettier
run: |
npm install
npx prettier **/*.md --write
- name: Commit changes
run: |
if [ -n "$(git status --short **/*.md)" ]; then
git config --local user.name "Oliver Davies"
git config --local user.email "339813+opdavies@users.noreply.github.com"
git commit -a -m "Run prettier"
fi
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/node_modules/

11
package-lock.json generated Normal file
View file

@ -0,0 +1,11 @@
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"prettier": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew=="
}
}
}

5
package.json Normal file
View file

@ -0,0 +1,5 @@
{
"dependencies": {
"prettier": "^1.19.1"
}
}

18
prettier.config.js Normal file
View file

@ -0,0 +1,18 @@
module.exports = {
arrowParens: 'avoid',
bracketSpacing: false,
endOfLine: 'lf',
htmlWhitespaceSensitivity: 'css',
insertPragma: false,
jsxBracketSameLine: false,
jsxSingleQuote: false,
printWidth: 80,
proseWrap: 'always',
quoteProps: 'as-needed',
requirePragma: false,
semi: false,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: false,
}