Skip to content

Commit 8b9f668

Browse files
author
Charlike Mike Reagent
authoredMar 27, 2020
fix: upgrade prettier to v2 (#131)
* upgrade prettier to v2 * lint, fmt, docs; due to prettier v2 Signed-off-by: Charlike Mike Reagent <opensource@tunnckocore.com>
1 parent eda3da1 commit 8b9f668

File tree

19 files changed

+42
-57
lines changed

19 files changed

+42
-57
lines changed
 

‎@configs/eslint-config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
},
5252
"peerDependencies": {
5353
"eslint": "^6.8.0",
54-
"prettier": "^1.19.1"
54+
"prettier": "^2.0.2"
5555
},
5656
"cov": {
5757
"color": "grey"

‎@configs/prettier-config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"scripts": {},
3434
"peerDependencies": {
35-
"prettier": "^1.19.1",
35+
"prettier": "^2.0.2",
3636
"prettier-plugin-pkgjson": "^0.2.3"
3737
},
3838
"cov": {

‎@packages/glob-cache/src/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,7 @@ globCache.stream = async function* globCacheStream(options) {
183183

184184
function hasha(value, opts) {
185185
const { algorithm, digest } = { ...opts };
186-
return crypto
187-
.createHash(algorithm)
188-
.update(value)
189-
.digest(digest);
186+
return crypto.createHash(algorithm).update(value).digest(digest);
190187
}
191188

192189
function getIntegrityFor(contents, hash = 'sha512') {

‎@packages/ip-filter/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ are just related. So, thanks for your existance!
180180
[homepage](https://github.com/micromatch/micromatch 'Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch.')
181181
- [to-file-path](https://www.npmjs.com/package/to-file-path): Create a filepath
182182
from an object path (dot notation), list
183-
[more](https://github.com/tunnckocore/to-file-path#readme) |
184-
[homepage](https://github.com/tunnckocore/to-file-path#readme 'Create a filepath from an object path (dot notation), list of arguments, array, number or Arguments object.')
183+
[more](https://tunnckocore.com/opensource) |
184+
[homepage](https://tunnckocore.com/opensource 'Create a filepath from an object path (dot notation), list of arguments, array, number or Arguments object.')
185185

186186
**[back to top](#readme)**
187187

@@ -335,7 +335,7 @@ Released under the [MPL-2.0 License][license-url].
335335

336336
<!-- prettier-ignore-end -->
337337

338-
[ip-filter]: https://github.com/tunnckocore/ip-filter
338+
[ip-filter]: https://tunnckocore.com/opensource
339339
[is-match]: https://github.com/jonschlinkert/is-match
340340
[koa]: https://github.com/koajs/koa
341341
[micromatch]: https://github.com/micromatch/micromatch

‎@packages/jest-runner-docs/src/docks.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ module.exports = function docks(filepath, options) {
6767
}\n\n${signatureBlock}${params}\n${comment.examples
6868
.map(
6969
(example) =>
70-
`\n${example.description.trim()}\n\n${examplesId}####${heading} Examples\n\n\`\`\`${example.language ||
71-
'js'}${example.value}\`\`\``,
70+
`\n${example.description.trim()}\n\n${examplesId}####${heading} Examples\n\n\`\`\`${
71+
example.language || 'js'
72+
}${example.value}\`\`\``,
7273
)
7374
.join('\n')}`;
7475

‎@packages/jest-runner-rollup/src/runner.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,7 @@ async function hooker(hookFn, options = {}) {
332332
}
333333

334334
function revHash(input, len = 20) {
335-
return crypto
336-
.createHash('md5')
337-
.update(input)
338-
.digest('hex')
339-
.slice(0, len);
335+
return crypto.createHash('md5').update(input).digest('hex').slice(0, len);
340336
}
341337

342338
function serializeJson(input) {

‎@packages/koa-better-body/.verb.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var app = require('koa')();
1818
var body = require('{%= name %}');
1919
var router = require('koa-router')();
2020

21-
router.post('/upload', body(), function*(next) {
21+
router.post('/upload', body(), function* (next) {
2222
console.log(this.request.files);
2323
console.log(this.request.fields);
2424

‎@packages/koa-better-body/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ var app = koa();
162162
163163
app
164164
.use(body())
165-
.use(function*() {
165+
.use(function* () {
166166
console.log(this.request.body); // if buffer or text
167167
console.log(this.request.files); // if multipart or urlencoded
168168
console.log(this.request.fields); // if json
169169
})
170-
.listen(8080, function() {
170+
.listen(8080, function () {
171171
console.log('koa server start listening on port 8080');
172172
});
173173
```
@@ -185,7 +185,7 @@ var app = require('koa')();
185185
var body = require('koa-better-body');
186186
var router = require('koa-router')();
187187
188-
router.post('/upload', body(), function*(next) {
188+
router.post('/upload', body(), function* (next) {
189189
console.log(this.request.files);
190190
console.log(this.request.fields);
191191
@@ -358,8 +358,8 @@ are just related. So, thanks for your existance!
358358
[homepage](https://github.com/node-formidable/formidable 'A node.js module for parsing form data, especially file uploads.')
359359
- [ip-filter](https://www.npmjs.com/package/ip-filter): Validates valid IPs
360360
(IPv4 and IPv6) using [micromatch][] - glob
361-
[more](https://github.com/tunnckocore/ip-filter#readme) |
362-
[homepage](https://github.com/tunnckocore/ip-filter#readme 'Validates valid IPs (IPv4 and IPv6) using [micromatch][] - glob patterns, RegExp, string or array of globs. If match returns the IP, otherwise null.')
361+
[more](https://tunnckocore.com/opensource) |
362+
[homepage](https://tunnckocore.com/opensource 'Validates valid IPs (IPv4 and IPv6) using [micromatch][] - glob patterns, RegExp, string or array of globs. If match returns the IP, otherwise null.')
363363
- [koa-body-parsers](https://www.npmjs.com/package/koa-body-parsers): collection
364364
of koa body parsers |
365365
[homepage](https://github.com/koajs/body-parsers#readme 'collection of koa body parsers')

‎@packages/koa-better-body/docs/src/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ var app = koa();
3131
3232
app
3333
.use(body())
34-
.use(function*() {
34+
.use(function* () {
3535
console.log(this.request.body); // if buffer or text
3636
console.log(this.request.files); // if multipart or urlencoded
3737
console.log(this.request.fields); // if json
3838
})
39-
.listen(8080, function() {
39+
.listen(8080, function () {
4040
console.log('koa server start listening on port 8080');
4141
});
4242
```

‎@packages/koa-better-body/recipes/formidable/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ form.keepExtensions = true;
2222
form.encoding = 'utf-8';
2323
form.uploadDir = path.join(__dirname, 'uploads');
2424

25-
form.on('field', function(name, value) {
25+
form.on('field', function (name, value) {
2626
console.log(name, value); // name is user, value is test
2727
});
28-
form.on('file', function(name, file) {
28+
form.on('file', function (name, file) {
2929
console.log(name); // => foo
3030
console.log(file); // => README.md
3131
console.log(file.path); // => full filepath to where is uploaded
3232
});
33-
form.on('end', function(name, file) {
33+
form.on('end', function (name, file) {
3434
console.log('finish parse');
3535
});
3636

@@ -40,14 +40,14 @@ app
4040
IncomingForm: form,
4141
}),
4242
)
43-
.use(function*() {
43+
.use(function* () {
4444
console.log(this.body.user); // => test
4545
console.log(this.request.files); // or `this.body.files`
4646
console.log(this.body.files.foo.name); // => README.md
4747
console.log(this.body.files.foo.path); // => full filepath to where is uploaded
4848
});
4949

50-
app.listen(4290, function() {
50+
app.listen(4290, function () {
5151
console.log('Koa server start listening on port 4290');
5252
console.log(
5353
'curl -i http://localhost:4290/ -F "foo=@%s/README.md" -F user=test',

‎@packages/koa-better-body/recipes/multipart/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ app
1717
keepExtensions: true,
1818
}),
1919
)
20-
.use(function*() {
20+
.use(function* () {
2121
console.log(this.request.files); // or `this.body.files`
2222
console.log(this.body.files.foo.name); // => README.md
2323
console.log(this.body.files.foo.path); // => full filepath to where is uploaded
2424
});
2525

26-
app.listen(4290, function() {
26+
app.listen(4290, function () {
2727
console.log('Koa server start listening on port 4290');
2828
console.log(
2929
'curl -i http://localhost:4290/ -F "foo=@%s/README.md"',

‎@packages/koa-better-body/test/json.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ function postBody() {
2222
}
2323

2424
test('should parse a json body', async () => {
25-
const server = koa()
26-
.use(betterBody())
27-
.use(postBody());
25+
const server = koa().use(betterBody()).use(postBody());
2826

2927
await new Promise((resolve, reject) => {
3028
request(server.callback())
@@ -37,9 +35,7 @@ test('should parse a json body', async () => {
3735
});
3836

3937
test('should parse a string json body', async () => {
40-
const server = koa()
41-
.use(betterBody())
42-
.use(postBody());
38+
const server = koa().use(betterBody()).use(postBody());
4339

4440
await new Promise((resolve, reject) => {
4541
request(server.callback())
@@ -53,9 +49,7 @@ test('should parse a string json body', async () => {
5349
});
5450

5551
test('should throw on json non-object body in strict mode (default)', async () => {
56-
const server = koa()
57-
.use(betterBody())
58-
.use(postBody());
52+
const server = koa().use(betterBody()).use(postBody());
5953

6054
await new Promise((resolve, reject) => {
6155
request(server.callback())

‎@packages/parse-function/test/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ test(`real anonymous fn has .name: null`, () => {
305305
const app = parseFunction({ ecmaVersion: 2017 });
306306

307307
/* eslint-disable-next-line prefer-arrow-callback, func-names */
308-
const actual = app.parse(function() {});
308+
const actual = app.parse(function () {});
309309
expect(actual.name).toBeNull();
310310
expect(actual.isAnonymous).toStrictEqual(true);
311311
});

‎@packages/prettier-plugin-pkgjson/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
},
3131
"scripts": {},
3232
"dependencies": {
33-
"sort-package-json": "^1.39.0"
33+
"sort-package-json": "^1.40.0"
3434
},
3535
"peerDependencies": {
36-
"prettier": "^1.19.1"
36+
"prettier": "^2.0.2"
3737
},
3838
"jest": {
3939
"coverageThreshold": {

‎@packages/prettier-plugin-pkgjson/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
'use strict';
1313

14-
const { parsers } = require('prettier/parser-babylon');
14+
const { parsers } = require('prettier/parser-babel');
1515
const sortPackageJson = require('sort-package-json');
1616

1717
const parser = parsers['json-stringify'];

‎@packages/to-file-path/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ are just related. So, thanks for your existance!
151151
[homepage](https://github.com/jonschlinkert/in-array "Return true if a value exists in an array. Faster than using indexOf and won't blow up on null values.")
152152
- [ip-filter](https://www.npmjs.com/package/ip-filter): Validates valid IPs
153153
(IPv4 and IPv6) using [micromatch][] - glob
154-
[more](https://github.com/tunnckocore/ip-filter#readme) |
155-
[homepage](https://github.com/tunnckocore/ip-filter#readme 'Validates valid IPs (IPv4 and IPv6) using [micromatch][] - glob patterns, RegExp, string or array of globs. If match returns the IP, otherwise null.')
154+
[more](https://tunnckocore.com/opensource) |
155+
[homepage](https://tunnckocore.com/opensource 'Validates valid IPs (IPv4 and IPv6) using [micromatch][] - glob patterns, RegExp, string or array of globs. If match returns the IP, otherwise null.')
156156
- [to-object-path](https://www.npmjs.com/package/to-object-path): Create an
157157
object path from a list or array of
158158
[more](https://github.com/jonschlinkert/to-object-path) |
@@ -311,7 +311,7 @@ Released under the [MPL-2.0 License][license-url].
311311
<!-- prettier-ignore-end -->
312312

313313
[fn-name]: https://github.com/sindresorhus/fn-name
314-
[ip-filter]: https://github.com/tunnckocore/ip-filter
314+
[ip-filter]: https://tunnckocore.com/opensource
315315
[is-match]: https://github.com/jonschlinkert/is-match
316316
[koa]: https://github.com/koajs/koa
317317
[micromatch]: https://github.com/micromatch/micromatch

‎@tunnckocore/utils/src/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,7 @@ function testCoverage(rootDir, testCovPath) {
270270

271271
/* istanbul ignore next */
272272
const newKey = k.endsWith('src')
273-
? k
274-
.split('/')
275-
.slice(0, -1)
276-
.join('/')
273+
? k.split('/').slice(0, -1).join('/')
277274
: k;
278275

279276
acc[newKey] = jestCov[k];

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"lerna": "^3.20.2",
7474
"lockfile-lint": "^4.0.0",
7575
"mukla": "^0.4.9",
76-
"prettier": "^1.19.1",
76+
"prettier": "^2.0.2",
7777
"react": "^16.12.0",
7878
"rollup": "^1.31.0",
7979
"rollup-plugin-babel": "^4.3.3",

‎yarn.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -13426,10 +13426,10 @@ prettier-linter-helpers@^1.0.0:
1342613426
dependencies:
1342713427
fast-diff "^1.1.2"
1342813428

13429-
prettier@^1.19.1:
13430-
version "1.19.1"
13431-
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
13432-
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
13429+
prettier@^2.0.2:
13430+
version "2.0.2"
13431+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.2.tgz#1ba8f3eb92231e769b7fcd7cb73ae1b6b74ade08"
13432+
integrity sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==
1343313433

1343413434
pretty-format@^23.6.0:
1343513435
version "23.6.0"
@@ -15301,7 +15301,7 @@ sort-object-keys@^1.1.3:
1530115301
resolved "https://registry.yarnpkg.com/sort-object-keys/-/sort-object-keys-1.1.3.tgz#bff833fe85cab147b34742e45863453c1e190b45"
1530215302
integrity sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg==
1530315303

15304-
sort-package-json@^1.39.0:
15304+
sort-package-json@^1.40.0:
1530515305
version "1.40.0"
1530615306
resolved "https://registry.yarnpkg.com/sort-package-json/-/sort-package-json-1.40.0.tgz#81ad8c2bd7dd21b6a127ab4a26186a160f07a157"
1530715307
integrity sha512-3Uc1kjmQ3SYuKziKghZvA23SihOqGxEjK2QPfFPmd7BMo9rWiJdC2FJWvAZbfhLWapuJrdmkUf6Kp0G4Wtuv5w==

0 commit comments

Comments
 (0)
Please sign in to comment.