feat(lint): prefer spread over Object.assign call
This commit is contained in:
@ -14,7 +14,8 @@
|
|||||||
"parser": "babel-eslint",
|
"parser": "babel-eslint",
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"react",
|
"react",
|
||||||
"import"
|
"import",
|
||||||
|
"prefer-object-spread"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"import/ignore": [
|
"import/ignore": [
|
||||||
@ -260,6 +261,8 @@
|
|||||||
"import/no-duplicates": 2,
|
"import/no-duplicates": 2,
|
||||||
"import/newline-after-import": 2,
|
"import/newline-after-import": 2,
|
||||||
"import/unambiguous": 2,
|
"import/unambiguous": 2,
|
||||||
"import/extensions": [ 0, "always" ]
|
"import/extensions": [ 0, "always" ],
|
||||||
|
|
||||||
|
"prefer-object-spread/prefer-object-spread": 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,10 @@ export default function promo(Promo) {
|
|||||||
.then(function({ count = 0 } = {}) {
|
.then(function({ count = 0 } = {}) {
|
||||||
log('job', count);
|
log('job', count);
|
||||||
if (count) {
|
if (count) {
|
||||||
return Object.assign({}, promo, { name: `${code} Discount` });
|
return {
|
||||||
|
...promo,
|
||||||
|
name: `${code} Discount`
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return Promise.reject(new Error(
|
return Promise.reject(new Error(
|
||||||
`Job ${id} not found`
|
`Job ${id} not found`
|
||||||
|
@ -15,15 +15,12 @@ export function jsonp$(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new AnonymousObservable(function(o) {
|
return new AnonymousObservable(function(o) {
|
||||||
const settings = Object.assign(
|
const settings = {
|
||||||
{},
|
jsonp: 'JSONPCallback',
|
||||||
{
|
async: true,
|
||||||
jsonp: 'JSONPCallback',
|
jsonpCallback: 'rxjsjsonpCallbackscallback_' + (id++).toString(36),
|
||||||
async: true,
|
...options
|
||||||
jsonpCallback: 'rxjsjsonpCallbackscallback_' + (id++).toString(36)
|
};
|
||||||
},
|
|
||||||
options
|
|
||||||
);
|
|
||||||
|
|
||||||
let script = root.document.createElement('script');
|
let script = root.document.createElement('script');
|
||||||
script.type = 'text/javascript';
|
script.type = 'text/javascript';
|
||||||
|
@ -132,6 +132,7 @@
|
|||||||
"del": "^2.2.0",
|
"del": "^2.2.0",
|
||||||
"eslint": "^3.1.0",
|
"eslint": "^3.1.0",
|
||||||
"eslint-plugin-import": "^2.0.1",
|
"eslint-plugin-import": "^2.0.1",
|
||||||
|
"eslint-plugin-prefer-object-spread": "^1.1.0",
|
||||||
"eslint-plugin-react": "^6.2.0",
|
"eslint-plugin-react": "^6.2.0",
|
||||||
"gulp": "^3.9.0",
|
"gulp": "^3.9.0",
|
||||||
"gulp-babel": "^6.1.1",
|
"gulp-babel": "^6.1.1",
|
||||||
|
@ -106,22 +106,20 @@ export default function commit(app) {
|
|||||||
req.flash('info', {
|
req.flash('info', {
|
||||||
msg: dedent`
|
msg: dedent`
|
||||||
Looks like you already have a pledge to ${pledge.displayName}.
|
Looks like you already have a pledge to ${pledge.displayName}.
|
||||||
Clicking "Commit" here will replace your old commitment. If you
|
Clicking "Commit" here will replace your old commitment. If you
|
||||||
do change your commitment, please remember to cancel your
|
do change your commitment, please remember to cancel your
|
||||||
previous recurring donation directly with ${pledge.displayName}.
|
previous recurring donation directly with ${pledge.displayName}.
|
||||||
`
|
`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
res.render(
|
res.render(
|
||||||
'commit/',
|
'commit/',
|
||||||
Object.assign(
|
{
|
||||||
{
|
title: 'Commit to a nonprofit. Commit to your goal.',
|
||||||
title: 'Commit to a nonprofit. Commit to your goal.',
|
pledge,
|
||||||
pledge
|
...commitGoals,
|
||||||
},
|
...nonprofit
|
||||||
commitGoals,
|
}
|
||||||
nonprofit
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
next
|
next
|
||||||
@ -143,14 +141,12 @@ export default function commit(app) {
|
|||||||
.flatMap(oldPledge => {
|
.flatMap(oldPledge => {
|
||||||
// create new pledge for user
|
// create new pledge for user
|
||||||
const pledge = Pledge(
|
const pledge = Pledge(
|
||||||
Object.assign(
|
{
|
||||||
{
|
amount,
|
||||||
amount,
|
goal,
|
||||||
goal,
|
userId: user.id,
|
||||||
userId: user.id
|
...nonprofit
|
||||||
},
|
}
|
||||||
nonprofit
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (oldPledge) {
|
if (oldPledge) {
|
||||||
@ -173,7 +169,7 @@ export default function commit(app) {
|
|||||||
msg: dedent`
|
msg: dedent`
|
||||||
Congratulations, you have committed to giving
|
Congratulations, you have committed to giving
|
||||||
${displayName} $${amount} each month until you have completed
|
${displayName} $${amount} each month until you have completed
|
||||||
your ${goal}. Please remember to cancel your pledge directly
|
your ${goal}. Please remember to cancel your pledge directly
|
||||||
with ${displayName} once you finish.
|
with ${displayName} once you finish.
|
||||||
`
|
`
|
||||||
});
|
});
|
||||||
@ -223,13 +219,13 @@ export default function commit(app) {
|
|||||||
.subscribe(
|
.subscribe(
|
||||||
pledge => {
|
pledge => {
|
||||||
let msg = dedent`
|
let msg = dedent`
|
||||||
You have successfully stopped your pledge. Please
|
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.
|
with the nonprofit if you haven't already done so.
|
||||||
`;
|
`;
|
||||||
if (!pledge) {
|
if (!pledge) {
|
||||||
msg = dedent`
|
msg = dedent`
|
||||||
It doesn't look like you had an active pledge, so
|
It doesn't look like you had an active pledge, so
|
||||||
there's no pledge to stop.
|
there's no pledge to stop.
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user