Skip to content

Commit 1860396

Browse files
authored
Merge pull request #6 from eug-vs/eslint
Eslint
2 parents 0ecf99e + 7e4ebee commit 1860396

15 files changed

+1917
-112
lines changed

.eslintrc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"extends": [
4+
"airbnb-typescript/base",
5+
"plugin:@typescript-eslint/recommended"
6+
],
7+
"parserOptions": {
8+
"project": "./tsconfig.json"
9+
},
10+
"rules": {
11+
"quotes": ["error", "single"],
12+
"no-multiple-empty-lines": [2, { "max": 2, "maxEOF": 1 } ],
13+
"max-len": ["error", { "code": 120 }],
14+
"arrow-parens": [2, "as-needed"],
15+
"comma-dangle": ["error", "never"],
16+
"import/extensions": ["error", { "ts": "never" }],
17+
"class-methods-use-this": 0,
18+
"arrow-body-style": 0,
19+
"no-underscore-dangle": 0,
20+
"no-cond-assign": 0,
21+
"no-console": 0,
22+
"no-plusplus": 0,
23+
"linebreak-style": 0
24+
}
25+
}

hooks/expandAuthor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const expandAuthorHook = async (context: HookContext): Promise<HookContex
2525
};
2626

2727
export const expandAuthorManyHook = async (context: HookContext): Promise<HookContext> => {
28-
const polls = await bluebird.map(context.result, (poll: any) => expandAuthor(poll));
28+
const polls = await bluebird.map(context.result, (poll: PollSchema) => expandAuthor(poll));
2929
context.result = _.compact(polls);
3030
return context;
3131
};

index.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
1-
import app from './app';
21
import mongoose from 'mongoose';
32
import Promise from 'bluebird';
3+
import app from './app';
44

55
mongoose.Promise = Promise;
66

77
mongoose.connect('mongodb://localhost:27017/which', { useNewUrlParser: true });
88

99
const db = mongoose.connection;
1010
db.on('error', console.error.bind(console, 'connection error:'));
11-
db.once('open', function() {
11+
db.once('open', () => {
1212
console.log('Connection to MongoDB successful');
1313
});
1414

1515
// Add any new real-time connection to the `everybody` channel
16-
app.on('connection', connection =>
17-
app.channel('everybody').join(connection)
18-
);
16+
app.on('connection', connection => app.channel('everybody').join(connection));
1917
// Publish all events to the `everybody` channel
20-
app.publish(data => app.channel('everybody'));
18+
app.publish(() => app.channel('everybody'));
2119

2220

23-
const port = 3030
24-
app.listen(port).on('listening', () =>
25-
console.log(`Feathers server listening on localhost:${port}`)
26-
);
21+
const port = 3030;
22+
app.listen(port).on('listening', () => console.log(`Feathers server listening on localhost:${port}`));
2723

models/polls/poll.model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Model, model } from "mongoose"
1+
import { Model, model } from 'mongoose';
22
import { PollSchema, pollSchema } from './poll.schema';
33

4-
export default model<PollSchema, Model<PollSchema>>("Poll", pollSchema);
4+
export default model<PollSchema, Model<PollSchema>>('Poll', pollSchema);
55

models/polls/poll.schema.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Document, Schema, Types } from 'mongoose';
2-
import { User } from '../users/user.schema'
2+
import { User } from '../users/user.schema';
33

44
export interface ImageData {
55
url: string;
@@ -22,14 +22,14 @@ export interface PollSchema extends Document, Omit<Poll, 'author'> {
2222
const imageDataSchema = {
2323
url: String,
2424
votes: Number
25-
}
25+
};
2626

2727
export const pollSchema = new Schema({
2828
contents: {
2929
left: imageDataSchema,
3030
right: imageDataSchema
3131
},
32-
authorId: {
32+
authorId: {
3333
type: Types.ObjectId,
3434
ref: 'User'
3535
}

models/users/user.model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Model, model } from "mongoose"
1+
import { Model, model } from 'mongoose';
22
import { UserSchema, userSchema } from './user.schema';
33

4-
export default model<UserSchema, Model<UserSchema>>("User", userSchema);
4+
export default model<UserSchema, Model<UserSchema>>('User', userSchema);
55

models/users/user.schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Document, Schema } from "mongoose"
1+
import { Document, Schema } from 'mongoose';
22

33
export interface User {
44
name: string;

0 commit comments

Comments
 (0)