Skip to content

Commit

Permalink
Change 'arrowParens' style to default ('always')
Browse files Browse the repository at this point in the history
PR-URL: #72
  • Loading branch information
tshemsedinov committed Dec 19, 2020
1 parent 9e1c6c1 commit 3023b62
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"functions": false
}
],
"arrow-parens": ["error", "as-needed"],
"arrow-parens": "off",
"arrow-body-style": ["error", "as-needed"],
"arrow-spacing": ["error"],
"no-confusing-arrow": [
Expand Down
8 changes: 6 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"singleQuote": true,
"trailingComma": "es5",
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }],
"arrowParens": "avoid"
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
}
]
}
4 changes: 2 additions & 2 deletions do.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
function Do() {}

const chain = function (fn, ...args) {
const current = done => {
const current = (done) => {
if (done) current.done = done;
if (current.prev) {
current.prev.next = current;
Expand Down Expand Up @@ -137,7 +137,7 @@ Collector.prototype.then = function (fulfill, reject) {
// Collector instance constructor
// expected <number> or array of string,
// Returns: <Function> Collector
const collect = expected => {
const collect = (expected) => {
const expectKeys = Array.isArray(expected) ? new Set(expected) : null;
const fields = {
expectKeys,
Expand Down
2 changes: 1 addition & 1 deletion test/chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const wrapAsync = (
setTimeout(callback, Math.floor(Math.random() * 1000));
};

metatests.test('simple chain/do', test => {
metatests.test('simple chain/do', (test) => {
const readConfig = (name, callback) => {
test.strictSame(name, 'myConfig');
wrapAsync(() => {
Expand Down
66 changes: 33 additions & 33 deletions test/collector.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const collect = require('..');
const metatests = require('metatests');

metatests.test('data collector functor', test => {
metatests.test('data collector functor', (test) => {
const expectedResult = {
key1: 1,
key2: 2,
Expand All @@ -23,7 +23,7 @@ metatests.test('data collector functor', test => {
dc('key3', null, 3);
});

metatests.test('data collector method', test => {
metatests.test('data collector method', (test) => {
const expectedResult = {
key1: 1,
key2: 2,
Expand All @@ -43,7 +43,7 @@ metatests.test('data collector method', test => {
dc.collect('key3', null, 3);
});

metatests.test('data collector', test => {
metatests.test('data collector', (test) => {
const expectedResult = { foo: 1, bar: 2 };

const dc = collect(['foo', 'bar', 'foo'])
Expand All @@ -58,7 +58,7 @@ metatests.test('data collector', test => {
dc.pick('bar', 2);
});

metatests.test('data collector with shorthand pick', test => {
metatests.test('data collector with shorthand pick', (test) => {
const expectedResult = { foo: 1, bar: 2 };

const dc = collect(['foo', 'bar', 'foo'])
Expand All @@ -73,7 +73,7 @@ metatests.test('data collector with shorthand pick', test => {
dc('bar', 2);
});

metatests.test('data collector', test => {
metatests.test('data collector', (test) => {
const expectedResult = {
key1: 1,
key2: 2,
Expand All @@ -93,7 +93,7 @@ metatests.test('data collector', test => {
kc.collect('key3', null, 3);
});

metatests.test('distinct data collector', test => {
metatests.test('distinct data collector', (test) => {
const expectedResult = {
key1: 2,
key2: 2,
Expand All @@ -114,7 +114,7 @@ metatests.test('distinct data collector', test => {
dc.pick('key3', 3);
});

metatests.test('distinct key collector', test => {
metatests.test('distinct key collector', (test) => {
const expectedResult = {
key1: 2,
key2: 2,
Expand All @@ -135,10 +135,10 @@ metatests.test('distinct key collector', test => {
kc.pick('key3', 3);
});

metatests.test('data collector with repeated keys', test => {
metatests.test('data collector with repeated keys', (test) => {
const dc = collect(3)
.timeout(100)
.done(err => {
.done((err) => {
test.assert(err);
test.end();
});
Expand All @@ -148,10 +148,10 @@ metatests.test('data collector with repeated keys', test => {
dc.collect('key2', null, 2);
});

metatests.test('key collector with repeated keys', test => {
metatests.test('key collector with repeated keys', (test) => {
const kc = collect(['key1', 'key2', 'key3'])
.timeout(100)
.done(err => {
.done((err) => {
test.assert(err);
test.end();
});
Expand All @@ -161,7 +161,7 @@ metatests.test('key collector with repeated keys', test => {
kc.collect('key2', null, 2);
});

metatests.test('collect with error', test => {
metatests.test('collect with error', (test) => {
const testErr = new Error('Test error');
const col = collect(1);
col.done((err, res) => {
Expand All @@ -172,7 +172,7 @@ metatests.test('collect with error', test => {
col.fail('someKey', testErr);
});

metatests.test('collect with error (shorthand fail)', test => {
metatests.test('collect with error (shorthand fail)', (test) => {
const testErr = new Error('Test error');
const col = collect(1);
col.done((err, res) => {
Expand All @@ -183,7 +183,7 @@ metatests.test('collect with error (shorthand fail)', test => {
col('someKey', testErr);
});

metatests.test('collect method calling after it is done', test => {
metatests.test('collect method calling after it is done', (test) => {
const col = collect(1);
col.done((err, res) => {
test.error(err);
Expand All @@ -194,7 +194,7 @@ metatests.test('collect method calling after it is done', test => {
col.pick('someKey2', 'someVal2');
});

metatests.test('keys collector receives wrong key', test => {
metatests.test('keys collector receives wrong key', (test) => {
const col = collect(['rightKey']);
col.done((err, res) => {
test.error(err);
Expand All @@ -205,17 +205,17 @@ metatests.test('keys collector receives wrong key', test => {
col.pick('rightKey', 'someVal');
});

metatests.test('distinct keys collector receives wrong key', test => {
metatests.test('distinct keys collector receives wrong key', (test) => {
const col = collect(['rightKey']).distinct();
col.done(err => {
col.done((err) => {
test.assert(err);
test.end();
});
col.pick('wrongKey', 'someVal');
col.pick('rightKey', 'someVal');
});

metatests.test('collect with take', test => {
metatests.test('collect with take', (test) => {
const col = collect(1);
col.done((err, res) => {
test.error(err);
Expand All @@ -226,7 +226,7 @@ metatests.test('collect with take', test => {
col.take('someKey', af, 'someVal');
});

metatests.test('collect with shorthand take', test => {
metatests.test('collect with shorthand take', (test) => {
const col = collect(1);
col.done((err, res) => {
test.error(err);
Expand All @@ -237,7 +237,7 @@ metatests.test('collect with shorthand take', test => {
col('someKey', af, 'someVal');
});

metatests.test('collect generate callback', test => {
metatests.test('collect generate callback', (test) => {
const col = collect(1);
col.done((err, res) => {
test.error(err);
Expand All @@ -248,7 +248,7 @@ metatests.test('collect generate callback', test => {
af('someVal', col.callback('someKey'));
});

metatests.test('collect generate callback shorthand', test => {
metatests.test('collect generate callback shorthand', (test) => {
const col = collect(1);
col.done((err, res) => {
test.error(err);
Expand All @@ -259,7 +259,7 @@ metatests.test('collect generate callback shorthand', test => {
af('someVal', col('someKey'));
});

metatests.test('collect with timeout error', test => {
metatests.test('collect with timeout error', (test) => {
const timeoutErr = new Error('Collector timeout');
const col = collect(1)
.done((err, res) => {
Expand All @@ -272,7 +272,7 @@ metatests.test('collect with timeout error', test => {
col.take('someKey', af, 'someVal');
});

metatests.test('collect with take calls bigger than expected', test => {
metatests.test('collect with take calls bigger than expected', (test) => {
const col = collect(1).done((err, res) => {
test.error(err);
test.strictSame(Object.keys(res).length, 1);
Expand All @@ -283,8 +283,8 @@ metatests.test('collect with take calls bigger than expected', test => {
col.take('someKey2', af, 'someVal2');
});

metatests.test('cancel data collector', test => {
const dc = collect(3).done(err => {
metatests.test('cancel data collector', (test) => {
const dc = collect(3).done((err) => {
test.assert(err);
test.end();
});
Expand All @@ -293,8 +293,8 @@ metatests.test('cancel data collector', test => {
dc.cancel();
});

metatests.test('cancel key collector', test => {
const dc = collect(['uno', 'due']).done(err => {
metatests.test('cancel key collector', (test) => {
const dc = collect(['uno', 'due']).done((err) => {
test.assert(err);
test.end();
});
Expand All @@ -303,29 +303,29 @@ metatests.test('cancel key collector', test => {
dc.cancel();
});

metatests.test('collect then success', test => {
metatests.test('collect then success', (test) => {
const col = collect(1).then(
result => {
(result) => {
test.assert(result);
test.end();
},
err => {
(err) => {
test.error(err);
test.end();
}
);
col.pick('Key', 'value');
});

metatests.test('collect then fail', test => {
metatests.test('collect then fail', (test) => {
collect(5)
.timeout(10)
.then(
result => {
(result) => {
test.error(result);
test.end();
},
err => {
(err) => {
test.assert(err);
test.end();
}
Expand Down

0 comments on commit 3023b62

Please sign in to comment.