Skip to content

Commit a45ab0d

Browse files
chore: prettier configuration (#61)
* chore(prettier): added prettier configuration and eslint integration * chore(prettier): formatting project files * chore: fixing lint --------- Co-authored-by: Antonio Collazo Garcia <[email protected]>
1 parent cc078e6 commit a45ab0d

File tree

96 files changed

+3149
-2151
lines changed

Some content is hidden

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

96 files changed

+3149
-2151
lines changed

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"arrowParens": "always",
3+
"bracketSpacing": true,
4+
"jsxSingleQuote": false,
5+
"printWidth": 80,
6+
"semi": true,
7+
"singleQuote": false,
8+
"tabWidth": 4,
9+
"trailingComma": "all"
10+
}

docker-compose.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
version: '3.0'
1+
version: "3.0"
22

33
services:
4-
web:
5-
build: .
6-
ports:
7-
- "4000:4000"
4+
web:
5+
build: .
6+
ports:
7+
- "4000:4000"

lerna.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3-
"version": "0.0.0"
2+
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3+
"version": "0.0.0"
44
}

package-lock.json

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
{
2-
"name": "root",
3-
"private": true,
4-
"workspaces": [
5-
"packages/*"
6-
],
7-
"devDependencies": {
8-
"@types/luxon": "^3.3.0",
9-
"@types/mongodb": "^4.0.7",
10-
"@types/node": "^20.3.1",
11-
12-
"eslint": "^8.44.0",
13-
"eslint-plugin-import": "^2.27.5",
14-
"eslint-plugin-n": "^15.7.0",
15-
"eslint-plugin-promise": "^6.1.1",
16-
"eslint-plugin-react": "^7.32.2",
17-
"eslint-plugin-react-hooks": "^4.6.0",
18-
"@typescript-eslint/eslint-plugin": "^6.2.0",
19-
"@typescript-eslint/parser": "^6.2.0",
20-
"eslint-import-resolver-typescript": "^3.5.5",
21-
22-
"lerna": "^7.0.2",
23-
"luxon": "^3.3.0",
24-
"mongodb": "^5.6.0",
25-
"typescript": "^5.1.6"
26-
},
27-
"scripts": {
28-
"publish": "lerna run tsc && lerna publish",
29-
"build": "lerna run tsc",
30-
"lint": "lerna run lint",
31-
"start": "cd ./packages/api && npm run start",
32-
"dev:start-api": "cd ./packages/api && npm run dev:start",
33-
"dev:start-ui": "cd ./packages/ui && npm run start",
34-
"dev:start-tw:watch": "cd ./packages/ui && npm run build:tw:watch"
35-
},
36-
"overrides": {
37-
"typescript": "^5.1.6"
38-
}
39-
}
2+
"name": "root",
3+
"private": true,
4+
"workspaces": [
5+
"packages/*"
6+
],
7+
"devDependencies": {
8+
"@types/luxon": "^3.3.0",
9+
"@types/mongodb": "^4.0.7",
10+
"@types/node": "^20.3.1",
11+
"eslint": "^8.44.0",
12+
"eslint-plugin-import": "^2.27.5",
13+
"eslint-plugin-n": "^15.7.0",
14+
"eslint-plugin-promise": "^6.1.1",
15+
"eslint-plugin-react": "^7.32.2",
16+
"eslint-plugin-react-hooks": "^4.6.0",
17+
"@typescript-eslint/eslint-plugin": "^6.2.0",
18+
"@typescript-eslint/parser": "^6.2.0",
19+
"eslint-import-resolver-typescript": "^3.5.5",
20+
"eslint-config-prettier": "^8.9.0",
21+
"prettier": "3.0.0",
22+
"lerna": "^7.0.2",
23+
"luxon": "^3.3.0",
24+
"mongodb": "^5.6.0",
25+
"typescript": "^5.1.6"
26+
},
27+
"scripts": {
28+
"publish": "lerna run tsc && lerna publish",
29+
"build": "lerna run tsc",
30+
"lint": "lerna run lint",
31+
"format": "lerna run format",
32+
"start": "cd ./packages/api && npm run start",
33+
"dev:start-api": "cd ./packages/api && npm run dev:start",
34+
"dev:start-ui": "cd ./packages/ui && npm run start",
35+
"dev:start-tw:watch": "cd ./packages/ui && npm run build:tw:watch"
36+
},
37+
"overrides": {
38+
"typescript": "^5.1.6"
39+
}
40+
}

packages/api/.eslintrc

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
{
2-
"root": true,
3-
"parser": "@typescript-eslint/parser",
4-
"plugins": [
5-
"@typescript-eslint"
6-
],
7-
"extends": [
8-
"eslint:recommended",
9-
"plugin:@typescript-eslint/eslint-recommended",
10-
"plugin:@typescript-eslint/recommended"
11-
],
12-
"parserOptions": {
13-
"ecmaVersion": "latest",
14-
"project": [
15-
"./tsconfig.json"
16-
]
17-
},
18-
"rules": {
19-
"@typescript-eslint/quotes": "off",
20-
"@typescript-eslint/no-non-null-assertion": "off",
21-
"semi": "off",
22-
"@typescript-eslint/semi": ["error", "always"],
23-
"@typescript-eslint/indent": "off"
24-
}
25-
}
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint"],
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/eslint-recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"prettier"
10+
],
11+
"parserOptions": {
12+
"ecmaVersion": "latest",
13+
"project": ["./tsconfig.json"]
14+
},
15+
"rules": {
16+
"@typescript-eslint/quotes": "off",
17+
"@typescript-eslint/no-non-null-assertion": "off"
18+
}
19+
}

packages/api/__tests__/api.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
'use strict';
1+
"use strict";
22

3-
const api = require('..');
4-
const assert = require('assert').strict;
3+
const api = require("..");
4+
const assert = require("assert").strict;
55

6-
assert.strictEqual(api(), 'Hello from api');
7-
console.info('api tests passed');
6+
assert.strictEqual(api(), "Hello from api");
7+
console.info("api tests passed");

packages/api/package.json

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,48 @@
11
{
2-
"name": "@switchfeat/api",
3-
"version": "0.0.1",
4-
"description": "The api package for switchfeat",
5-
"author": "dev-bre <[email protected]>",
6-
"homepage": "https://github.com/switchfeat-com/switchfeat#readme",
7-
"license": "ISC",
8-
"main": "dist/index.js",
9-
"files": [
10-
"dist"
11-
],
12-
"repository": {
13-
"type": "git",
14-
"url": "git+https://github.com/switchfeat-com/switchfeat.git"
15-
},
16-
"scripts": {
17-
"tsc": "tsc",
18-
"start": "node dist/index.js",
19-
"dev:start": "SET NODE_ENV=dev& node dist/index.js",
20-
"test": "node ./__tests__/api.test.js",
21-
"lint": "eslint . --ext .ts"
22-
},
23-
"bugs": {
24-
"url": "https://github.com/switchfeat-com/switchfeat/issues"
25-
},
26-
"dependencies": {
27-
"@switchfeat/core": "0.0.1",
28-
"@types/express": "^4.17.17",
29-
"cookie-parser": "^1.4.6",
30-
"cors": "^2.8.5",
31-
"dotenv": "^16.3.1",
32-
"express": "^4.18.2",
33-
"express-session": "^1.17.3",
34-
"multer": "^1.4.5-lts.1",
35-
"passport": "^0.6.0",
36-
"passport-google-oauth20": "^2.0.0",
37-
"path": "^0.12.7"
38-
},
39-
"devDependencies": {
40-
"@types/cookie-parser": "^1.4.3",
41-
"@types/cors": "^2.8.13",
42-
"@types/express-session": "^1.17.7",
43-
"@types/multer": "^1.4.7",
44-
"@types/passport": "^1.0.12",
45-
"@types/passport-google-oauth20": "^2.0.11"
46-
}
2+
"name": "@switchfeat/api",
3+
"version": "0.0.1",
4+
"description": "The api package for switchfeat",
5+
"author": "dev-bre <[email protected]>",
6+
"homepage": "https://github.com/switchfeat-com/switchfeat#readme",
7+
"license": "ISC",
8+
"main": "dist/index.js",
9+
"files": [
10+
"dist"
11+
],
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/switchfeat-com/switchfeat.git"
15+
},
16+
"scripts": {
17+
"tsc": "tsc",
18+
"start": "node dist/index.js",
19+
"dev:start": "SET NODE_ENV=dev& node dist/index.js",
20+
"test": "node ./__tests__/api.test.js",
21+
"lint": "eslint . --ext .ts",
22+
"format": "prettier --write 'src/**/*.{js,ts}'"
23+
},
24+
"bugs": {
25+
"url": "https://github.com/switchfeat-com/switchfeat/issues"
26+
},
27+
"dependencies": {
28+
"@switchfeat/core": "0.0.1",
29+
"@types/express": "^4.17.17",
30+
"cookie-parser": "^1.4.6",
31+
"cors": "^2.8.5",
32+
"dotenv": "^16.3.1",
33+
"express": "^4.18.2",
34+
"express-session": "^1.17.3",
35+
"multer": "^1.4.5-lts.1",
36+
"passport": "^0.6.0",
37+
"passport-google-oauth20": "^2.0.0",
38+
"path": "^0.12.7"
39+
},
40+
"devDependencies": {
41+
"@types/cookie-parser": "^1.4.3",
42+
"@types/cors": "^2.8.13",
43+
"@types/express-session": "^1.17.7",
44+
"@types/multer": "^1.4.7",
45+
"@types/passport": "^1.0.12",
46+
"@types/passport-google-oauth20": "^2.0.11"
47+
}
4748
}

packages/api/src/helpers/responseHelper.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,21 @@ export const setErrorResponse = (resp: Response, error: ApiResponseCode) => {
66
resp.status(error.statusCode).json({
77
success: false,
88
error: error,
9-
data: null
9+
data: null,
1010
} as ResponseModel<null>);
1111
};
1212

13-
export const setSuccessResponse = <T extends object | null>(resp: Response, code: ApiResponseCode, data: T, req?: Request) => {
13+
export const setSuccessResponse = <T extends object | null>(
14+
resp: Response,
15+
code: ApiResponseCode,
16+
data: T,
17+
req?: Request,
18+
) => {
1419
console.log(code);
1520

1621
const response = {
1722
success: true,
18-
data
23+
data,
1924
} as ResponseModel<T>;
2025

2126
if (req) {
@@ -24,4 +29,4 @@ export const setSuccessResponse = <T extends object | null>(resp: Response, code
2429
}
2530

2631
resp.status(code.statusCode).json(response);
27-
};
32+
};

0 commit comments

Comments
 (0)