Template
TypeScript
bash
pnpm install -D typescript
pnpm install -D @types/node nodemon @typescript-eslint/eslint-plugin @typescript-eslint/parser npm-run-all eslint
Package.json
json
{
"scripts": {
"dev": "npm-run-all --parallel watch:typescript watch:server",
"watch:typescript": "tsc --watch",
"watch:server": "nodemon ./dist/index.js",
},
}
Development without nodemon
base
pnpm install -D typescript @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint tsx globals @eslint/js typescript-eslint
Eslint
.eslintrc.json
json
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"indent": [
"error",
2,
{
"SwitchCase": 1
}
],
/* "linebreak-style": [
"error",
"windows"
], */
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"space-before-blocks": [
"error",
"always"
],
"space-before-function-paren": [
"error",
{
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}
],
"space-infix-ops": [
"error",
{
"int32Hint": false
}
],
"no-console": [
"error",
{
"allow": [
"warn",
"error"
]
}
],
"no-multiple-empty-lines": [
"error",
{
"max": 1,
"maxBOF": 0,
"maxEOF": 1
}
],
"no-duplicate-case": "error",
"keyword-spacing": [
"error",
{
"before": true,
"after": true,
"overrides": {
"switch": {
"after": false
}
}
}
],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn", // or "error"
{
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true
/* "varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_" */
}
]
}
}
.eslintignore
dist
node_modules
Backend template
sh
pnpm install --save-dev @types/compression @types/cors @types/express @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint typescript nodemon npm-run-all
ESBuild
esbuild src/some.ts --bundle --minify --sourcemap --platform=node --target=es2022 --outfile=dist/index.js