diff options
author | eug-vs <eug-vs@keemail.me> | 2020-06-12 20:20:33 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-06-12 20:20:33 +0300 |
commit | 7e4ebee9a0e56546d6dce76c5c48d6d13371c689 (patch) | |
tree | eb905fa1307833c1ab856c387be2fa533ed2ea34 | |
parent | 2a4e1ff734533a026ebf4122c31355e2dffba1b2 (diff) | |
download | which-api-7e4ebee9a0e56546d6dce76c5c48d6d13371c689.tar.gz |
style: fix all eslint errors
-rw-r--r-- | .eslintrc.json | 3 | ||||
-rw-r--r-- | hooks/expandAuthor.ts | 2 | ||||
-rw-r--r-- | index.ts | 2 | ||||
-rw-r--r-- | package-lock.json | 11 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | populateDb.ts | 6 | ||||
-rw-r--r-- | services/profiles/profiles.class.ts | 6 |
7 files changed, 20 insertions, 11 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index cab5e1b..2a3b4a8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,9 +14,12 @@ "arrow-parens": [2, "as-needed"], "comma-dangle": ["error", "never"], "import/extensions": ["error", { "ts": "never" }], + "class-methods-use-this": 0, "arrow-body-style": 0, "no-underscore-dangle": 0, "no-cond-assign": 0, + "no-console": 0, + "no-plusplus": 0, "linebreak-style": 0 } } diff --git a/hooks/expandAuthor.ts b/hooks/expandAuthor.ts index 1f33ff0..3b3e3df 100644 --- a/hooks/expandAuthor.ts +++ b/hooks/expandAuthor.ts @@ -25,7 +25,7 @@ export const expandAuthorHook = async (context: HookContext): Promise<HookContex }; export const expandAuthorManyHook = async (context: HookContext): Promise<HookContext> => { - const polls = await bluebird.map(context.result, (poll: any) => expandAuthor(poll)); + const polls = await bluebird.map(context.result, (poll: PollSchema) => expandAuthor(poll)); context.result = _.compact(polls); return context; }; @@ -15,7 +15,7 @@ db.once('open', () => { // Add any new real-time connection to the `everybody` channel app.on('connection', connection => app.channel('everybody').join(connection)); // Publish all events to the `everybody` channel -app.publish(data => app.channel('everybody')); +app.publish(() => app.channel('everybody')); const port = 3030; diff --git a/package-lock.json b/package-lock.json index 68b8b3f..d8eb8a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -506,9 +506,9 @@ "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==" }, "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" }, "body-parser": { "version": "1.19.0", @@ -1896,6 +1896,11 @@ "sliced": "1.0.1" }, "dependencies": { + "bluebird": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", + "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" + }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", diff --git a/package.json b/package.json index 903d2b0..4cbabab 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "@feathersjs/feathers": "^4.5.3", "@feathersjs/socketio": "^4.5.4", "@feathersjs/transport-commons": "^4.5.3", + "bluebird": "^3.7.2", "cors": "^2.8.5", "feathers-mongoose": "^8.3.0", "lodash": "^4.17.15", diff --git a/populateDb.ts b/populateDb.ts index 156d4f2..0a89cc9 100644 --- a/populateDb.ts +++ b/populateDb.ts @@ -54,10 +54,10 @@ const createUser = (name: string): Promise<UserSchema> => { const populate = async () => { const users = await bluebird.map(names, name => createUser(name)); - for (let i = 0; i < POLLS_AMOUNT; i++) { + await bluebird.mapSeries(new Array(POLLS_AMOUNT), async () => { const sampleUser = _.sample(users); - await createPoll(sampleUser?._id); - } + return createPoll(sampleUser?._id); + }); }; populate().finally(mongoose.disconnect); diff --git a/services/profiles/profiles.class.ts b/services/profiles/profiles.class.ts index c896789..52d6b47 100644 --- a/services/profiles/profiles.class.ts +++ b/services/profiles/profiles.class.ts @@ -1,9 +1,9 @@ -import { Poll, PollSchema } from '../../models/polls/poll.schema'; +import { PollSchema } from '../../models/polls/poll.schema'; import PollModel from '../../models/polls/poll.model'; export default class Profiles { - async get(id: string, params: any): Promise<PollSchema[]> { - return PollModel.find({ authorId: id }).lean<Poll>(); + async get(id: string): Promise<PollSchema[]> { + return PollModel.find({ authorId: id }).lean(); } } |