Skip to content

Commit d46aa6d

Browse files
committed
Chore: Add format script to run prettier
Run the format script and commit updates
1 parent 869f56d commit d46aa6d

File tree

5 files changed

+33
-34
lines changed

5 files changed

+33
-34
lines changed

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package.json
2+
CHANGELOG.md
23

34
# this file doesn't exist, but we use it as a filename that should be ignored
45
# by prettier in the tests

.travis.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
language: node_js
22
cache: yarn
33
node_js:
4-
- '4'
5-
- '6'
6-
- '7'
7-
- '8'
8-
- '9'
4+
- "4"
5+
- "6"
6+
- "7"
7+
- "8"
8+
- "9"
99
env:
1010
- ESLINT_VERSION=latest
1111
- ESLINT_VERSION=3.15.0
1212
before_script:
1313
- if [[ $ESLINT_VERSION != "latest" ]]; then
14-
yarn upgrade "eslint@$ESLINT_VERSION";
14+
yarn upgrade "eslint@$ESLINT_VERSION";
1515
fi

LICENSE.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
The MIT License (MIT)
2-
=====================
1+
# The MIT License (MIT)
32

43
Copyright © 2017 Andres Suarez and Teddy Katz
54

README.md

+24-26
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ Then, in your `.eslintrc.json`:
4343

4444
```json
4545
{
46-
"plugins": [
47-
"prettier"
48-
],
46+
"plugins": ["prettier"],
4947
"rules": {
5048
"prettier/prettier": "error"
5149
}
@@ -62,25 +60,23 @@ To integrate this plugin with `eslint-config-prettier`, you can use the `"recomm
6260

6361
1. In addition to the above installation instructions, install `eslint-config-prettier`:
6462

65-
```sh
66-
npm install --save-dev eslint-config-prettier
67-
```
63+
```sh
64+
npm install --save-dev eslint-config-prettier
65+
```
6866

6967
2. Then you need to add `plugin:prettier/recommended` as the last extension in your `.eslintrc.json`:
7068

71-
```json
72-
{
73-
"extends": [
74-
"plugin:prettier/recommended"
75-
]
76-
}
77-
```
69+
```json
70+
{
71+
"extends": ["plugin:prettier/recommended"]
72+
}
73+
```
7874

7975
This does three things:
8076

81-
* Enables `eslint-plugin-prettier`.
82-
* Sets the `prettier/prettier` rule to `"error"`.
83-
* Extends the `eslint-config-prettier` configuration.
77+
- Enables `eslint-plugin-prettier`.
78+
- Sets the `prettier/prettier` rule to `"error"`.
79+
- Extends the `eslint-config-prettier` configuration.
8480

8581
You can then set Prettier's own options inside a `.prettierrc` file.
8682
@@ -103,9 +99,10 @@ For the list of every available exclusion rule set, please see the [readme of es
10399
104100
> Note: While it is possible to pass options to Prettier via your ESLint configuration file, it is not recommended because editor extensions such as `prettier-atom` and `prettier-vscode` **will** read [`.prettierrc`](https://prettier.io/docs/en/configuration.html), but **won't** read settings from ESLint, which can lead to an inconsistent experience.
105101

106-
* The first option:
102+
- The first option:
103+
107104
- Objects are passed directly to Prettier as [options](https://prettier.io/docs/en/options.html). Example:
108-
105+
109106
```json
110107
"prettier/prettier": ["error", {"singleQuote": true, "parser": "flow"}]
111108
```
@@ -127,9 +124,10 @@ For the list of every available exclusion rule set, please see the [readme of es
127124
"parser": "flow"
128125
}]
129126
```
130-
NB: This option will merge and override any config set with `.prettierrc` files (for Prettier < 1.7.0, [config files are ignored](https://github.com/prettier/eslint-plugin-prettier/issues/46))
131127

132-
* The second option:
128+
NB: This option will merge and override any config set with `.prettierrc` files (for Prettier < 1.7.0, [config files are ignored](https://github.com/prettier/eslint-plugin-prettier/issues/46))
129+
130+
- The second option:
133131

134132
- A string with a pragma that triggers this rule. By default, this rule applies to all files. However, if you set a pragma (this option), only files with that pragma in the heading docblock will be checked. All pragmas must start with `@`. Example:
135133

@@ -156,26 +154,26 @@ For the list of every available exclusion rule set, please see the [readme of es
156154
```
157155

158156
_This option is useful if you're migrating a large codebase and already use pragmas like `@flow`._
159-
157+
160158
- An object with the following options
161-
159+
162160
- `pragma`: Also sets the aforementioned `pragma`: a string with a pragma that triggers this rule. By default, this rule applies to all files. However, if you set a pragma (this option), only files with that pragma in the heading docblock will be checked. All pragmas must start with `@`.
163-
161+
164162
```json
165163
"prettier/prettier": ["error", null, {
166164
"pragma": "@prettier"
167165
}]
168166
```
169-
167+
170168
- `usePrettierrc`: Enables loading of the Prettier configuration file, (default: `true`). May be useful if you are using multiple tools that conflict with each other, or do not wish to mix your ESLint settings with your Prettier configuration.
171-
169+
172170
```json
173171
"prettier/prettier": ["error", null, {
174172
"usePrettierrc": false
175173
}]
176174
```
177175
178-
* The rule is autofixable -- if you run `eslint` with the `--fix` flag, your code will be formatted according to `prettier` style.
176+
- The rule is autofixable -- if you run `eslint` with the `--fix` flag, your code will be formatted according to `prettier` style.
179177
180178
---
181179

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"scripts": {
1717
"lint": "eslint .",
1818
"test": "npm run lint && mocha",
19+
"format": "yarn run prettier '**/*.{js,json,md,yml}' --write && yarn run lint --fix",
1920
"generate-release": "node-release-script"
2021
},
2122
"repository": {

0 commit comments

Comments
 (0)