Skip to content
This repository was archived by the owner on Mar 8, 2025. It is now read-only.

Commit 9f0f690

Browse files
author
dnphu
committed
Setup lint and code styles for project
0 parents  commit 9f0f690

File tree

9 files changed

+3661
-0
lines changed

9 files changed

+3661
-0
lines changed

.eslintrc.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
project: 'tsconfig.json',
5+
sourceType: 'module',
6+
},
7+
plugins: ['@typescript-eslint/eslint-plugin'],
8+
extends: [
9+
'plugin:@typescript-eslint/recommended',
10+
'plugin:prettier/recommended',
11+
],
12+
root: true,
13+
env: {
14+
node: true,
15+
jest: true,
16+
},
17+
ignorePatterns: ['.eslintrc.js'],
18+
rules: {
19+
'@typescript-eslint/interface-name-prefix': 'off',
20+
'@typescript-eslint/explicit-function-return-type': 'off',
21+
'@typescript-eslint/explicit-module-boundary-types': 'off',
22+
'@typescript-eslint/no-explicit-any': 'off',
23+
},
24+
};
25+

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# compiled output
2+
/dist
3+
/node_modules
4+
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
pnpm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
lerna-debug.log*
13+
14+
# OS
15+
.DS_Store
16+
17+
# Tests
18+
/coverage
19+
/.nyc_output
20+
21+
# IDEs and editors
22+
/.idea
23+
.project
24+
.classpath
25+
.c9/
26+
*.launch
27+
.settings/
28+
*.sublime-workspace
29+
30+
# IDE - VSCode
31+
.vscode/*
32+
!.vscode/settings.json
33+
!.vscode/tasks.json
34+
!.vscode/launch.json
35+
!.vscode/extensions.json

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all"
4+
}

package.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"name": "lite-express-swagger",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"dependencies": {
7+
"swagger-ui-express": "^4.1.6"
8+
},
9+
"scripts": {
10+
"prebuild": "rimraf dist",
11+
"build": "yarn prebuild && tsc",
12+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"libs/**/*.ts\"",
13+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
14+
"test": "jest",
15+
"test:watch": "jest --watch",
16+
"test:cov": "jest --coverage",
17+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
18+
"test:e2e": "jest --config ./test/jest-e2e.json"
19+
},
20+
"devDependencies": {
21+
"@types/express": "^4.17.13",
22+
"@types/jest": "^27.0.1",
23+
"@types/node": "^16.0.0",
24+
"@types/supertest": "^2.0.11",
25+
"@types/swagger-ui-express": "^4.1.3",
26+
"@typescript-eslint/eslint-plugin": "^4.28.2",
27+
"@typescript-eslint/parser": "^4.28.2",
28+
"eslint": "^7.30.0",
29+
"eslint-config-prettier": "^8.3.0",
30+
"eslint-plugin-prettier": "^3.4.0",
31+
"jest": "^27.0.6",
32+
"prettier": "^2.3.2",
33+
"supertest": "^6.1.3",
34+
"ts-jest": "^27.0.3",
35+
"ts-loader": "^9.2.3",
36+
"ts-node": "^10.0.0",
37+
"tsconfig-paths": "^3.10.1",
38+
"typescript": "^4.3.5"
39+
},
40+
"jest": {
41+
"moduleFileExtensions": [
42+
"js",
43+
"json",
44+
"ts"
45+
],
46+
"rootDir": ".",
47+
"testRegex": ".*\\.spec\\.ts$",
48+
"transform": {
49+
"^.+\\.(t|j)s$": "ts-jest"
50+
},
51+
"collectCoverageFrom": [
52+
"**/*.(t|j)s"
53+
],
54+
"coverageDirectory": "./coverage",
55+
"testEnvironment": "node",
56+
"roots": [
57+
"<rootDir>/src/",
58+
"<rootDir>/libs/"
59+
],
60+
"moduleNameMapper": {
61+
"^@rest/nest-rest(|/.*)$": "<rootDir>/libs/nest-rest/src/$1",
62+
"@modules/(.*)": "<rootDir>/src/modules/$1"
63+
}
64+
}
65+
}

src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const OPEN_API_VERSION = '3.0.0';

src/main.ts

Whitespace-only changes.

tsconfig.build.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
4+
}
5+

tsconfig.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"declaration": true,
5+
"removeComments": true,
6+
"emitDecoratorMetadata": true,
7+
"experimentalDecorators": true,
8+
"allowSyntheticDefaultImports": true,
9+
"target": "es2017",
10+
"sourceMap": true,
11+
"outDir": "./dist",
12+
"baseUrl": "./",
13+
"incremental": true,
14+
"skipLibCheck": true,
15+
"strictNullChecks": false,
16+
"noImplicitAny": false,
17+
"strictBindCallApply": false,
18+
"forceConsistentCasingInFileNames": false,
19+
"noFallthroughCasesInSwitch": false,
20+
"paths": {
21+
"@api/*": ["src/api/*"],
22+
"@modules/*": ["src/modules/*"],
23+
"@config/*": ["src/config/*"]
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)