feat(lint): prefer spread over Object.assign call

This commit is contained in:
Berkeley Martinez
2016-12-29 16:51:51 -08:00
parent 31960fee90
commit 44a0aeceb7
5 changed files with 34 additions and 34 deletions

View File

@ -14,7 +14,8 @@
"parser": "babel-eslint",
"plugins": [
"react",
"import"
"import",
"prefer-object-spread"
],
"settings": {
"import/ignore": [
@ -260,6 +261,8 @@
"import/no-duplicates": 2,
"import/newline-after-import": 2,
"import/unambiguous": 2,
"import/extensions": [ 0, "always" ]
"import/extensions": [ 0, "always" ],
"prefer-object-spread/prefer-object-spread": 2
}
}

View File

@ -41,7 +41,10 @@ export default function promo(Promo) {
.then(function({ count = 0 } = {}) {
log('job', count);
if (count) {
return Object.assign({}, promo, { name: `${code} Discount` });
return {
...promo,
name: `${code} Discount`
};
}
return Promise.reject(new Error(
`Job ${id} not found`

View File

@ -15,15 +15,12 @@ export function jsonp$(options) {
}
return new AnonymousObservable(function(o) {
const settings = Object.assign(
{},
{
const settings = {
jsonp: 'JSONPCallback',
async: true,
jsonpCallback: 'rxjsjsonpCallbackscallback_' + (id++).toString(36)
},
options
);
jsonpCallback: 'rxjsjsonpCallbackscallback_' + (id++).toString(36),
...options
};
let script = root.document.createElement('script');
script.type = 'text/javascript';

View File

@ -132,6 +132,7 @@
"del": "^2.2.0",
"eslint": "^3.1.0",
"eslint-plugin-import": "^2.0.1",
"eslint-plugin-prefer-object-spread": "^1.1.0",
"eslint-plugin-react": "^6.2.0",
"gulp": "^3.9.0",
"gulp-babel": "^6.1.1",

View File

@ -114,14 +114,12 @@ export default function commit(app) {
}
res.render(
'commit/',
Object.assign(
{
title: 'Commit to a nonprofit. Commit to your goal.',
pledge
},
commitGoals,
nonprofit
)
pledge,
...commitGoals,
...nonprofit
}
);
},
next
@ -143,14 +141,12 @@ export default function commit(app) {
.flatMap(oldPledge => {
// create new pledge for user
const pledge = Pledge(
Object.assign(
{
amount,
goal,
userId: user.id
},
nonprofit
)
userId: user.id,
...nonprofit
}
);
if (oldPledge) {
@ -224,7 +220,7 @@ export default function commit(app) {
pledge => {
let msg = dedent`
You have successfully stopped your pledge. Please
rememberto cancel your recurring donation directly
remember to cancel your recurring donation directly
with the nonprofit if you haven't already done so.
`;
if (!pledge) {