Skip to content

Commit db80901

Browse files
committed
switched to eslint-prettier
based on graphql/graphql-js#1112
1 parent bb2d1a9 commit db80901

File tree

7 files changed

+37
-72
lines changed

7 files changed

+37
-72
lines changed

.eslintrc

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
"plugins": [
55
"babel",
6-
"react"
6+
"react",
7+
"prettier"
78
],
89

910
"settings": {
@@ -46,6 +47,8 @@
4647
},
4748

4849
"rules": {
50+
"prettier/prettier": 2,
51+
4952
"react/no-deprecated": 2,
5053
"react/no-did-mount-set-state": 2,
5154
"react/no-did-update-set-state": 2,
@@ -100,7 +103,6 @@
100103
"eqeqeq": 2,
101104
"func-names": 0,
102105
"func-style": 0,
103-
"generator-star-spacing": [2, {"before": true, "after": false}],
104106
"guard-for-in": 2,
105107
"handle-callback-err": [2, "error"],
106108
"id-length": 0,

.prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"parser": "flow",
3+
"singleQuote": true,
4+
"trailingComma": "all"
5+
}

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"react": "global:React"
3333
},
3434
"scripts": {
35-
"test": "npm run lint && npm run pretty-check && npm run check && npm run testonly",
35+
"test": "npm run lint && npm run check && npm run testonly",
3636
"start": "npm run download && babel-node src/server/main.js",
3737
"watch": "babel scripts/watch.js | node",
3838
"testonly": "mocha $npm_package_options_mocha",
@@ -45,8 +45,7 @@
4545
"download": "babel-node src/api/cachedData/downloadCache.js src/api/cachedData/cache.json",
4646
"build-public": "scripts/build-public",
4747
"deploy": "scripts/build-public && scripts/deploy-public",
48-
"pretty": "node scripts/pretty.js",
49-
"pretty-check": "node scripts/pretty.js --check",
48+
"prettier": "prettier --write 'src/**/*.js'",
5049
"print-schema": "npm run download && babel-node scripts/print-schema.js"
5150
},
5251
"dependencies": {
@@ -75,12 +74,13 @@
7574
"coveralls": "^2.11.2",
7675
"eslint": "^4.6.0",
7776
"eslint-plugin-babel": "4.1.2",
77+
"eslint-plugin-prettier": "^2.6.0",
7878
"eslint-plugin-react": "^7.3.0",
7979
"flow-bin": "^0.52.0",
8080
"isomorphic-fetch": "2.2.1",
8181
"isparta": "^4.0.0",
8282
"mocha": "^3.5.0",
83-
"prettier": "^1.6.1",
83+
"prettier": "^1.11.1",
8484
"sane": "^2.0.0"
8585
}
8686
}

scripts/pretty.js

-57
This file was deleted.

src/schema/__tests__/film.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ describe('Film type', async () => {
120120
edges { cursor, node { title } } }
121121
}`;
122122
const nextResult = await swapi(nextQuery);
123-
expect(
124-
nextResult.data.allFilms.edges.map(e => e.node.title),
125-
).to.deep.equal(['Return of the Jedi', 'The Phantom Menace']);
123+
expect(nextResult.data.allFilms.edges.map(e => e.node.title)).to.deep.equal(
124+
['Return of the Jedi', 'The Phantom Menace'],
125+
);
126126
});
127127
});

src/schema/__tests__/person.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ describe('Person type', async () => {
123123
edges { cursor, node { name } } }
124124
}`;
125125
const nextResult = await swapi(nextQuery);
126-
expect(
127-
nextResult.data.allPeople.edges.map(e => e.node.name),
128-
).to.deep.equal(['R2-D2', 'Darth Vader']);
126+
expect(nextResult.data.allPeople.edges.map(e => e.node.name)).to.deep.equal(
127+
['R2-D2', 'Darth Vader'],
128+
);
129129
});
130130

131131
describe('Edge cases', () => {

yarn.lock

+18-3
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,13 @@ [email protected]:
16561656
version "4.1.2"
16571657
resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-4.1.2.tgz#79202a0e35757dd92780919b2336f1fa2fe53c1e"
16581658

1659+
eslint-plugin-prettier@^2.6.0:
1660+
version "2.6.0"
1661+
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.0.tgz#33e4e228bdb06142d03c560ce04ec23f6c767dd7"
1662+
dependencies:
1663+
fast-diff "^1.1.1"
1664+
jest-docblock "^21.0.0"
1665+
16591666
eslint-plugin-react@^7.3.0:
16601667
version "7.3.0"
16611668
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.3.0.tgz#ca9368da36f733fbdc05718ae4e91f778f38e344"
@@ -1888,6 +1895,10 @@ fast-deep-equal@^1.0.0:
18881895
version "1.0.0"
18891896
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff"
18901897

1898+
fast-diff@^1.1.1:
1899+
version "1.1.2"
1900+
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154"
1901+
18911902
fast-levenshtein@~2.0.4:
18921903
version "2.0.6"
18931904
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
@@ -2599,6 +2610,10 @@ iterall@^1.1.0:
25992610
version "1.1.1"
26002611
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.1.1.tgz#f7f0af11e9a04ec6426260f5019d9fcca4d50214"
26012612

2613+
jest-docblock@^21.0.0:
2614+
version "21.2.0"
2615+
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414"
2616+
26022617
jodid25519@^1.0.0:
26032618
version "1.0.2"
26042619
resolved "https://registry.yarnpkg.com/jodid25519/-/jodid25519-1.0.2.tgz#06d4912255093419477d425633606e0e90782967"
@@ -3238,9 +3253,9 @@ preserve@^0.2.0:
32383253
version "0.2.0"
32393254
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
32403255

3241-
prettier@^1.6.1:
3242-
version "1.6.1"
3243-
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.6.1.tgz#850f411a3116226193e32ea5acfc21c0f9a76d7d"
3256+
prettier@^1.11.1:
3257+
version "1.11.1"
3258+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.11.1.tgz#61e43fc4cd44e68f2b0dfc2c38cd4bb0fccdcc75"
32443259

32453260
private@^0.1.6, private@^0.1.7:
32463261
version "0.1.7"

0 commit comments

Comments
 (0)