fix linting of scripts

This commit is contained in:
Matteo Pagliazzi
2019-10-08 18:41:20 +02:00
parent 0d90a1db4c
commit 20f2cf7d27
4 changed files with 60 additions and 8 deletions

44
package-lock.json generated
View File

@@ -1826,6 +1826,24 @@
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz",
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
}, },
"axios": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
"integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
"dev": true,
"requires": {
"follow-redirects": "1.5.10",
"is-buffer": "^2.0.2"
},
"dependencies": {
"is-buffer": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz",
"integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==",
"dev": true
}
}
},
"babel-code-frame": { "babel-code-frame": {
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
@@ -5607,6 +5625,32 @@
"readable-stream": "^2.3.6" "readable-stream": "^2.3.6"
} }
}, },
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"dev": true,
"requires": {
"debug": "=3.1.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
}
}
},
"for-in": { "for-in": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",

View File

@@ -72,7 +72,7 @@
"npm": "^6" "npm": "^6"
}, },
"scripts": { "scripts": {
"lint": "eslint --ext .js ./migrations --fix", "lint": "eslint --ext .js ./scripts --fix",
"test": "npm run lint && gulp test && gulp apidoc", "test": "npm run lint && gulp test && gulp apidoc",
"test:build": "gulp test:prepare:build", "test:build": "gulp test:prepare:build",
"test:api-v3": "gulp test:api-v3", "test:api-v3": "gulp test:api-v3",
@@ -98,6 +98,7 @@
"@babel/core": "^7.6.2", "@babel/core": "^7.6.2",
"@babel/preset-env": "^7.6.2", "@babel/preset-env": "^7.6.2",
"@babel/register": "^7.6.2", "@babel/register": "^7.6.2",
"axios": "^0.19.0",
"chai": "^4.1.2", "chai": "^4.1.2",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"chalk": "^2.4.1", "chalk": "^2.4.1",

View File

@@ -1,5 +1,5 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
import axios from 'axios'; import axios from 'axios'; // eslint-disable-line import/no-extraneous-dependencies
import nconf from 'nconf'; import nconf from 'nconf';
import { model as User } from '../website/server/models/user'; import { model as User } from '../website/server/models/user';
@@ -77,10 +77,10 @@ async function processEmailAddress (email) {
if (users.length < 1) { if (users.length < 1) {
console.log(`No users found with email address ${email}`); console.log(`No users found with email address ${email}`);
} else { } else {
for (const user of users) { Promise.all(users.map(user => (async () => {
await deleteAmplitudeData(user._id, email); // eslint-disable-line no-await-in-loop await deleteAmplitudeData(user._id, email); // eslint-disable-line no-await-in-loop
await deleteHabiticaData(user, email); // eslint-disable-line no-await-in-loop await deleteHabiticaData(user, email); // eslint-disable-line no-await-in-loop
} })()));
} }
} }

View File

@@ -1,8 +1,11 @@
require('babel-register'); require('@babel/register'); // eslint-disable-line import/no-extraneous-dependencies
// This file is used for creating paypal billing plans. PayPal doesn't have a web interface for setting up recurring // This file is used for creating paypal billing plans.
// payment plan definitions, instead you have to create it via their REST SDK and keep it updated the same way. So this // PayPal doesn't have a web interface for setting up recurring
// file will be used once for initing your billing plan (then you get the resultant plan.id to store in config.json), // payment plan definitions, instead you have to create it
// via their REST SDK and keep it updated the same way. So this
// file will be used once for initing your billing plan
// (then you get the resultant plan.id to store in config.json),
// and once for any time you need to edit the plan thereafter // and once for any time you need to edit the plan thereafter
/* eslint-disable no-console, camelcase, no-case-declarations */ /* eslint-disable no-console, camelcase, no-case-declarations */
@@ -99,6 +102,8 @@ switch (OP) {
paypal.billingPlan.update(plan.id, billingPlanUpdateAttributes, (err2, response) => { paypal.billingPlan.update(plan.id, billingPlanUpdateAttributes, (err2, response) => {
console.log({ err: err2, response, id: plan.id }); console.log({ err: err2, response, id: plan.id });
}); });
return null;
}); });
break; break;
case 'create-webprofile': case 'create-webprofile':
@@ -113,4 +118,6 @@ switch (OP) {
console.log(error, result); console.log(error, result);
}); });
break; break;
default:
throw new Error('Invalid op');
} }