Skip to content

Commit 7f01508

Browse files
authored
Merge pull request #7 from afteracademy/formatting
Formatting
2 parents 22a053d + 465830e commit 7f01508

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+3787
-2984
lines changed

.eslintignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.vscode/
2+
3+
node_modules/
4+
5+
# Build products
6+
build/
7+
dist/
8+
tools/

.eslintrc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"rules": {
3+
"semi": ["error", "always"],
4+
"@typescript-eslint/ban-ts-ignore": "off",
5+
"@typescript-eslint/no-var-requires": "off",
6+
"@typescript-eslint/no-explicit-any": "off",
7+
"@typescript-eslint/explicit-function-return-type": "off",
8+
"@typescript-eslint/no-use-before-define": "off"
9+
},
10+
"extends": [
11+
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
12+
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
13+
"plugin:prettier/recommended" // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
14+
],
15+
"parser": "@typescript-eslint/parser",
16+
"parserOptions": {
17+
"ecmaVersion": 2020, // Allows for the parsing of modern ECMAScript features
18+
"sourceType": "module" // Allows for the use of imports
19+
},
20+
21+
"env": {
22+
"node": true
23+
}
24+
}

.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
build/
2+
coverage/
3+
keys/
4+
logs/
5+
node_modules/
6+
*.md

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"useTabs": false,
3+
"semi": true,
4+
"trailingComma": "all",
5+
"singleQuote": true,
6+
"printWidth": 100,
7+
"tabWidth": 2
8+
}

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ before_install:
88
- cp keys/public.pem.example keys/public.pem
99
- cp keys/private.pem.example keys/private.pem
1010
- cp tests/.env.test.example tests/.env.test
11-
- docker-compose up -d
11+
- docker-compose up -d

addons/init-mongo.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
function seed(dbName, user, password){
2-
db = db.getSiblingDB(dbName)
3-
db.createUser({
4-
user: user,
5-
pwd: password,
6-
roles: [{ role: 'readWrite', db: dbName }]
7-
})
1+
function seed(dbName, user, password) {
2+
db = db.getSiblingDB(dbName);
3+
db.createUser({
4+
user: user,
5+
pwd: password,
6+
roles: [{ role: 'readWrite', db: dbName }],
7+
});
88

9-
db.createCollection("api_keys")
10-
db.createCollection("roles")
9+
db.createCollection('api_keys');
10+
db.createCollection('roles');
1111

12-
db.api_keys.insert({
13-
metadata: "To be used by the xyz vendor",
14-
key: "GCMUDiuY5a7WvyUNt9n3QztToSHzK7Uj",
15-
version: 1,
16-
status: true,
17-
createdAt: new Date(),
18-
updatedAt: new Date()
19-
})
12+
db.api_keys.insert({
13+
metadata: 'To be used by the xyz vendor',
14+
key: 'GCMUDiuY5a7WvyUNt9n3QztToSHzK7Uj',
15+
version: 1,
16+
status: true,
17+
createdAt: new Date(),
18+
updatedAt: new Date(),
19+
});
2020

21-
db.roles.insertMany([
22-
{ code: "LEARNER", status: true, createdAt: new Date(), updatedAt: new Date() },
23-
{ code: "WRITER", status: true, createdAt: new Date(), updatedAt: new Date() },
24-
{ code: "EDITOR", status: true, createdAt: new Date(), updatedAt: new Date() },
25-
{ code: "ADMIN", status: true, createdAt: new Date(), updatedAt: new Date() },
26-
])
21+
db.roles.insertMany([
22+
{ code: 'LEARNER', status: true, createdAt: new Date(), updatedAt: new Date() },
23+
{ code: 'WRITER', status: true, createdAt: new Date(), updatedAt: new Date() },
24+
{ code: 'EDITOR', status: true, createdAt: new Date(), updatedAt: new Date() },
25+
{ code: 'ADMIN', status: true, createdAt: new Date(), updatedAt: new Date() },
26+
]);
2727
}
2828

29-
seed('afteracademy-blog-db', 'afteracademy-blog-db-user', 'changeit')
30-
seed('afteracademy-blog-test-db', 'afteracademy-blog-test-db-user', 'changeit')
29+
seed('afteracademy-blog-db', 'afteracademy-blog-db-user', 'changeit');
30+
seed('afteracademy-blog-test-db', 'afteracademy-blog-test-db-user', 'changeit');

docker-compose.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3'
22

33
services:
44
app:
5-
# This defines the configuration options, including the context and dockerfile,
5+
# This defines the configuration options, including the context and dockerfile,
66
# that will be applied when Compose builds the application image.
77
build:
88
# This defines the build context for the image build — in this case, the current project directory.
@@ -11,13 +11,13 @@ services:
1111
dockerfile: Dockerfile
1212
image: app
1313
container_name: app
14-
# This defines the restart policy. The default is no,
14+
# This defines the restart policy. The default is no,
1515
# but we have set the container to restart unless it is stopped.
1616
restart: unless-stopped
1717
env_file: .env
1818
ports:
1919
# This maps port from .env on the host to same port number on the container.
20-
- "3000:$PORT"
20+
- '3000:$PORT'
2121
links:
2222
- mongo
2323

@@ -26,28 +26,28 @@ services:
2626
image: mongo:4.2.5
2727
container_name: mongo
2828
restart: unless-stopped
29-
# This tells Compose that we would like to add environment variables
29+
# This tells Compose that we would like to add environment variables
3030
# from a file called .env, located in our build context.
3131
env_file: .env
3232
environment:
3333
# MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD together create
34-
# a root user in the admin authentication database and ensure that authentication is enabled
35-
# when the container starts. We have set MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD
34+
# a root user in the admin authentication database and ensure that authentication is enabled
35+
# when the container starts. We have set MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD
3636
# using the values from our .env file, which we pass to the db service using the env_file option.
3737
- MONGO_INITDB_ROOT_USERNAME=$DB_ADMIN
3838
- MONGO_INITDB_ROOT_PASSWORD=$DB_ADMIN_PWD
3939
- MONGO_INITDB_DATABASE=$DB_NAME
4040
ports:
41-
- "$DB_PORT:27017"
42-
volumes:
43-
- ./addons/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
44-
# The named volume dbdata will persist the data stored in Mongo’s default data directory, /data/db.
45-
# This will ensure that you don’t lose data in cases where you stop or remove containers.
46-
- dbdata:/data/db
41+
- '$DB_PORT:27017'
42+
volumes:
43+
- ./addons/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
44+
# The named volume dbdata will persist the data stored in Mongo’s default data directory, /data/db.
45+
# This will ensure that you don’t lose data in cases where you stop or remove containers.
46+
- dbdata:/data/db
4747

48-
# Our top-level volumes key defines the volumes dbdata.
49-
# When Docker creates volumes, the contents of the volume are stored in a part of the host filesystem, /var/lib/docker/volumes/, that’s managed by Docker.
50-
# The contents of each volume are stored in a directory under /var/lib/docker/volumes/ and get mounted to any container that uses the volume.
48+
# Our top-level volumes key defines the volumes dbdata.
49+
# When Docker creates volumes, the contents of the volume are stored in a part of the host filesystem, /var/lib/docker/volumes/, that’s managed by Docker.
50+
# The contents of each volume are stored in a directory under /var/lib/docker/volumes/ and get mounted to any container that uses the volume.
5151
# In this way, the data that our users will create will persist in the dbdata volume even if we remove and recreate the db container.
5252
volumes:
53-
dbdata:
53+
dbdata:

jest.config.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
module.exports = {
2-
preset: 'ts-jest',
3-
testEnvironment: 'node',
4-
roots: ['<rootDir>/tests'],
5-
setupFiles: ['<rootDir>/tests/setup.ts'],
6-
"collectCoverageFrom": [
7-
"<rootDir>/src/**/*.ts",
8-
"!**/node_modules/**",
9-
]
10-
};
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
roots: ['<rootDir>/tests'],
5+
setupFiles: ['<rootDir>/tests/setup.ts'],
6+
collectCoverageFrom: ['<rootDir>/src/**/*.ts', '!**/node_modules/**'],
7+
};

0 commit comments

Comments
 (0)