Skip to content

Commit

Permalink
document prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
kremalicious committed Aug 19, 2019
1 parent 40a675f commit 84ff8f7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": ["./index.js", "prettier/standard", "plugin:prettier/recommended"]
"extends": ["./index.js", "prettier/standard", "plugin:prettier/recommended"],
"plugins": ["prettier"]
}
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Don't be like that cat.

- [Usage](#usage)
- [React](#react)
- [Prettier](#prettier)
- [Editor Plugins](#editor-plugins)
- [Rules](#rules)
- [Development](#development)
Expand All @@ -32,7 +33,7 @@ Don't be like that cat.

## Usage

For every project containing JavaScript, ESLint should be set up with this config.
For every project containing JavaScript, ESLint should be set up with this base setup.

```bash
npm install --save-dev eslint eslint-config-oceanprotocol
Expand All @@ -51,7 +52,7 @@ Then, create a new file `.eslintrc` in the root of your project and fill with:
When using within a React project use this to get set up:

```bash
npm install --save-dev eslint eslint-config-oceanprotocol
npm i -D eslint eslint-config-oceanprotocol
```

And in your `.eslintrc`:
Expand All @@ -62,6 +63,33 @@ And in your `.eslintrc`:
}
```

### Prettier

Additionally, you should add [Prettier](https://prettier.io) to your project and work with it through ESLint:

```bash
npm i -D prettier eslint-config-prettier eslint-plugin-prettier
```

Then add a `.prettierrc` file to the root of your project with this content:

```json
{
"semi": false,
"singleQuote": true,
"trailingComma": "none"
}
```

Finally, modify your `.eslintrc`:

```json
{
"extends": ["oceanprotocol", "prettier/standard", "plugin:prettier/recommended"],
"plugins": ["prettier"]
}
```

### Editor Plugins

For maximum fun during coding, install an ESLint plugin in your favorite editor to get suggestions and autofixes as you type.
Expand Down

0 comments on commit 84ff8f7

Please sign in to comment.