Skip to content

Commit

Permalink
[CI]: lint!
Browse files Browse the repository at this point in the history
  • Loading branch information
Behzad-rabiei committed Jan 29, 2024
1 parent 72e7e74 commit 23438f0
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 45 deletions.
16 changes: 3 additions & 13 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"es2021": true,
"node": true
},
"extends": [
"standard-with-typescript",
"prettier"
],
"extends": ["standard-with-typescript", "prettier"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand All @@ -15,12 +12,5 @@
"project": "./tsconfig.json"
},
"rules": {},
"ignorePatterns": [
"coverage",
"dist",
"__tests__/",
"*.json",
"*.yml",
"*.js",
]
}
"ignorePatterns": ["coverage", "dist", "__tests__/", "*.json", "*.yml", "*.js"]
}
26 changes: 26 additions & 0 deletions .github/linters/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": [
"standard-with-typescript",
"prettier"
],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {},
"ignorePatterns": [
"coverage",
"dist",
"__tests__/",
"*.json",
"*.yml",
"*.js"
]
}
2 changes: 0 additions & 2 deletions .github/linters/.eslintrc.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .lintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
src/**/*.js
*.json
*.log
*.yml
*.yml
coverage
15 changes: 8 additions & 7 deletions __tests__/unit/database/services/guildMember.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import mongoose, { Connection } from 'mongoose';
import { IGuildMember, guildMemberSchema, IGuildMemberUpdateBody, DatabaseManager, GuildMember } from '@togethercrew.dev/db';
import {
IGuildMember,
guildMemberSchema,
IGuildMemberUpdateBody,
DatabaseManager,
GuildMember,
} from '@togethercrew.dev/db';
import setupTestDB from '../../../utils/setupTestDB';
import { guildMember1, guildMember2, guildMember3 } from '../../../fixtures/guildMember.fixture';
import { guildMemberService } from '../../../../src/database/services';
Expand Down Expand Up @@ -125,7 +131,6 @@ describe('guildMember service', () => {
updateBody,
);


expect(result).toMatchObject(updateBody);

const guildMember1Doc = await guildMemberService.getGuildMember(connection, {
Expand All @@ -141,11 +146,7 @@ describe('guildMember service', () => {
});

test('should return null when no guild member match the filter criteria', async () => {
const result = await guildMemberService.updateGuildMember(
connection,
{ discordId: '1' },
updateBody,
);
const result = await guildMemberService.updateGuildMember(connection, { discordId: '1' }, updateBody);
expect(result).toEqual(null);
});
});
Expand Down
13 changes: 7 additions & 6 deletions __tests__/utils/setupTestDB.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import mongoose from "mongoose";
import config from "../../src/config";
import mongoose from 'mongoose';
import config from '../../src/config';
import RabbitMQ, { MBConnection, Queue } from '@togethercrew.dev/tc-messagebroker';

const setupTestDB = () => {
beforeAll(async () => {
mongoose.set("strictQuery", false);
mongoose.set('strictQuery', false);
await mongoose.connect(config.mongoose.serverURL);

});

beforeEach(async () => {
await Promise.all(Object.values(mongoose.connection.collections).map(async (collection) => collection.deleteMany({})));
await Promise.all(
Object.values(mongoose.connection.collections).map(async (collection) => collection.deleteMany({})),
);
});

afterAll(async () => {
await mongoose.disconnect();
});
};

export default setupTestDB;
export default setupTestDB;
13 changes: 0 additions & 13 deletions mongo-init.js

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test:ci": "jest --ci --detectOpenHandles",
"lint": "eslint **/*.ts",
"lint-fix": "eslint --fix **/*.ts",
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\" \"types/*.ts\" \"__tests__/**/*.ts\" \"*.js\" \"*.json\" \"*.md\"",
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\" \"types/*.ts\"",
"migrate:create": "migrate create --template-file ./src/migrations/utils/template.ts --migrations-dir=\"./src/migrations/db\"",
"migrate:up": "migrate --migrations-dir=\"./lib/migrations/db\" up",
"migrate:down": "migrate --migrations-dir=\"./lib/migrations/db\" down"
Expand Down Expand Up @@ -68,4 +68,4 @@
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
}
}
}
2 changes: 1 addition & 1 deletion src/config/logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pino, { Bindings } from 'pino';
import pino, { type Bindings } from 'pino';
import config from './index';

export default pino({
Expand Down

0 comments on commit 23438f0

Please sign in to comment.