diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..d5aa45b --- /dev/null +++ b/.github/workflows/format.yml @@ -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 }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..223cec4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules/ + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..870d78e --- /dev/null +++ b/package-lock.json @@ -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==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..264121d --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "prettier": "^1.19.1" + } +} diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 0000000..181b27c --- /dev/null +++ b/prettier.config.js @@ -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, +}