Skip to content

Commit 7bb4be9

Browse files
frenzzyokendoken
authored andcommitted
Integrate Prettier
1 parent 0660223 commit 7bb4be9

File tree

3 files changed

+42
-23
lines changed

3 files changed

+42
-23
lines changed

.eslintrc.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ module.exports = {
1616
'airbnb',
1717
'plugin:flowtype/recommended',
1818
'plugin:css-modules/recommended',
19+
'prettier',
20+
'prettier/flowtype',
21+
'prettier/react',
1922
],
2023

21-
plugins: [
22-
'flowtype',
23-
'css-modules',
24-
],
24+
plugins: ['flowtype', 'css-modules', 'prettier'],
2525

2626
globals: {
2727
__DEV__: true,
@@ -64,6 +64,17 @@ module.exports = {
6464
// babel-plugin-transform-react-pure-class-to-function
6565
// https://github.com/kriasoft/react-starter-kit/pull/961
6666
'react/prefer-stateless-function': 'off',
67+
68+
// ESLint plugin for prettier formatting
69+
// https://github.com/prettier/eslint-plugin-prettier
70+
'prettier/prettier': [
71+
'error',
72+
{
73+
// https://github.com/prettier/prettier#options
74+
singleQuote: true,
75+
trailingComma: 'all',
76+
},
77+
],
6778
},
6879

6980
settings: {

package.json

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
"node": ">=6.5",
77
"npm": ">=3.10"
88
},
9-
"browserslist": [
10-
">1%",
11-
"last 4 versions",
12-
"Firefox ESR",
13-
"not ie < 9"
14-
],
9+
"browserslist": [">1%", "last 4 versions", "Firefox ESR", "not ie < 9"],
1510
"dependencies": {
1611
"babel-polyfill": "^6.23.0",
1712
"bluebird": "^3.5.0",
@@ -76,12 +71,14 @@
7671
"enzyme": "^2.9.1",
7772
"eslint": "^3.19.0",
7873
"eslint-config-airbnb": "^15.0.1",
74+
"eslint-config-prettier": "^2.3.0",
7975
"eslint-import-resolver-node": "^0.3.1",
8076
"eslint-loader": "^1.8.0",
8177
"eslint-plugin-css-modules": "^2.7.1",
8278
"eslint-plugin-flowtype": "^2.34.1",
8379
"eslint-plugin-import": "^2.6.1",
8480
"eslint-plugin-jsx-a11y": "^5.0.3",
81+
"eslint-plugin-prettier": "^2.1.2",
8582
"eslint-plugin-react": "^7.0.1",
8683
"file-loader": "^0.11.2",
8784
"front-matter": "^2.1.2",
@@ -114,6 +111,7 @@
114111
"postcss-pseudoelements": "^5.0.0",
115112
"postcss-selector-matches": "^3.0.1",
116113
"postcss-selector-not": "^3.0.1",
114+
"prettier": "^1.5.2",
117115
"raw-loader": "^0.5.1",
118116
"react-deep-force-update": "^2.0.1",
119117
"react-error-overlay": "^1.0.9",
@@ -149,9 +147,7 @@
149147
],
150148
"env": {
151149
"test": {
152-
"plugins": [
153-
"rewire"
154-
]
150+
"plugins": ["rewire"]
155151
}
156152
},
157153
"ignore": [
@@ -163,14 +159,9 @@
163159
]
164160
},
165161
"lint-staged": {
166-
"*.{js,jsx}": [
167-
"eslint --fix",
168-
"git add"
169-
],
170-
"*.{css,less,scss,sss}": [
171-
"stylelint --fix",
172-
"git add"
173-
]
162+
"*.{js,jsx}": ["eslint --fix", "git add"],
163+
"*.{json,graphql}": ["prettier --write", "git add"],
164+
"*.{css,less,scss,sss}": ["stylelint --fix", "git add"]
174165
},
175166
"scripts": {
176167
"precommit": "lint-staged",

yarn.lock

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2885,6 +2885,12 @@ eslint-config-airbnb@^15.0.1:
28852885
dependencies:
28862886
eslint-config-airbnb-base "^11.2.0"
28872887

2888+
eslint-config-prettier@^2.3.0:
2889+
version "2.3.0"
2890+
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-2.3.0.tgz#b75b1eabea0c8b97b34403647ee25db349b9d8a0"
2891+
dependencies:
2892+
get-stdin "^5.0.1"
2893+
28882894
eslint-import-resolver-node@^0.3.1:
28892895
version "0.3.1"
28902896
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz#4422574cde66a9a7b099938ee4d508a199e0e3cc"
@@ -2949,6 +2955,13 @@ eslint-plugin-jsx-a11y@^5.0.3:
29492955
emoji-regex "^6.1.0"
29502956
jsx-ast-utils "^1.4.0"
29512957

2958+
eslint-plugin-prettier@^2.1.2:
2959+
version "2.1.2"
2960+
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.1.2.tgz#4b90f4ee7f92bfbe2e926017e1ca40eb628965ea"
2961+
dependencies:
2962+
fast-diff "^1.1.1"
2963+
jest-docblock "^20.0.1"
2964+
29522965
eslint-plugin-react@^7.0.1:
29532966
version "7.1.0"
29542967
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.1.0.tgz#27770acf39f5fd49cd0af4083ce58104eb390d4c"
@@ -3226,6 +3239,10 @@ fast-deep-equal@^1.0.0:
32263239
version "1.0.0"
32273240
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff"
32283241

3242+
fast-diff@^1.1.1:
3243+
version "1.1.1"
3244+
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.1.tgz#0aea0e4e605b6a2189f0e936d4b7fbaf1b7cfd9b"
3245+
32293246
fast-levenshtein@~2.0.4:
32303247
version "2.0.6"
32313248
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
@@ -4499,7 +4516,7 @@ jest-diff@^20.0.3:
44994516
jest-matcher-utils "^20.0.3"
45004517
pretty-format "^20.0.3"
45014518

4502-
jest-docblock@^20.0.3:
4519+
jest-docblock@^20.0.1, jest-docblock@^20.0.3:
45034520
version "20.0.3"
45044521
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.3.tgz#17bea984342cc33d83c50fbe1545ea0efaa44712"
45054522

@@ -6604,7 +6621,7 @@ preserve@^0.2.0:
66046621
version "0.2.0"
66056622
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
66066623

6607-
prettier@^1.3.1:
6624+
prettier@^1.3.1, prettier@^1.5.2:
66086625
version "1.5.2"
66096626
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.5.2.tgz#7ea0751da27b93bfb6cecfcec509994f52d83bb3"
66106627

0 commit comments

Comments
 (0)