Skip to content

Commit

Permalink
Add Yarn and ESLint instructions to README
Browse files Browse the repository at this point in the history
  • Loading branch information
bokub committed Oct 6, 2021
1 parent 9c27721 commit 9ba82c2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: 10
- uses: JS-DevTools/npm-publish@v1
node-version: '14'

- name: Publish on npm
uses: JS-DevTools/npm-publish@v1
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

[![Code style][style-src]][style-href]
[![Downloads][downloads-src]][downloads-href]
[![Version][version-src]][version-href]

> My personal [Prettier](https://prettier.io) config / workflow
#### Install

```bash
# With npm
npm i -D prettier @bokub/prettier-config

# With yarn
yarn add -D prettier @bokub/prettier-config
```

#### Add the following to your `package.json`:
Expand All @@ -19,21 +24,51 @@ npm i -D prettier @bokub/prettier-config
}
```

#### _Optional:_ Setup pre-commit hook
#### _Optional:_ Setup pre-commit hook with husky

```bash
# With npm
npx husky-init
npm i -D pretty-quick
npx husky set .husky/pre-commit "npx pretty-quick --staged"

# With yarn
npx husky-init # add --yarn2 for Yarn 2
yarn add -D pretty-quick
yarn husky set .husky/pre-commit "npx pretty-quick --staged"
```

#### _Optional:_ Run prettier on old code
#### _Optional:_ Run prettier on existing code

```bash
npx prettier --write .
```

#### _Optional:_ Setup with ESLint

```bash
# With npm
npm i -D eslint-config-prettier eslint-plugin-prettier eslint@latest

# With yarn
yarn add -D eslint-config-prettier eslint-plugin-prettier eslint@latest
```

Then, edit your ESLint configuration file:

```jsonc
{
"plugins": ["prettier"],
"extends": ["<some-config>", "plugin:prettier/recommended"], // Add to the end of the array
"rules": {
"prettier/prettier": "warn" // Optionally, you can set the error level to warn
}
}
```

[style-src]: https://flat.badgen.net/badge/code%20style/prettier/ff69b4
[style-href]: https://github.com/prettier/prettier
[downloads-src]: https://flat.badgen.net/npm/dt/@bokub/prettier-config
[downloads-href]: https://www.npmjs.com/package/@bokub/prettier-config
[version-src]: https://runkit.io/bokub/npm-version/branches/master/@bokub/prettier-config?style=flat
[version-href]: https://www.npmjs.com/package/@bokub/prettier-config

0 comments on commit 9ba82c2

Please sign in to comment.