├── .editorconfig ├── .eslintignore ├── .eslintrc.yml ├── .github └── FUNDING.yml ├── .gitignore ├── .prettierignore ├── .prettierrc.yml ├── .vscode └── settings.json ├── README.md ├── bun.lockb ├── package.json ├── src └── index.ts ├── tsconfig.json └── tsconfig.prod.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # All files 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | indent_size = 2 11 | indent_style = space 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # directories 2 | dist 3 | node_modules 4 | 5 | # files 6 | *.env 7 | *.log 8 | *.tsbuildinfo 9 | .DS_Store 10 | .pnp.* 11 | bun.lockb 12 | npm-debug.log 13 | package-lock.json 14 | pnpm-lock.yaml 15 | yarn.lock 16 | -------------------------------------------------------------------------------- /.eslintrc.yml: -------------------------------------------------------------------------------- 1 | env: 2 | shared-node-browser: true 3 | extends: 4 | - "eslint:recommended" 5 | - "plugin:@typescript-eslint/eslint-recommended" 6 | - "plugin:@typescript-eslint/recommended" 7 | - "prettier" 8 | parser: "@typescript-eslint/parser" 9 | parserOptions: 10 | project: "tsconfig.json" 11 | plugins: 12 | - "@typescript-eslint" 13 | root: true 14 | rules: 15 | "@typescript-eslint/no-floating-promises": 16 | - error 17 | - ignoreIIFE: true 18 | ignoreVoid: true 19 | "@typescript-eslint/no-inferrable-types": "off" 20 | "@typescript-eslint/no-unused-vars": 21 | - error 22 | - argsIgnorePattern: ^_ 23 | varsIgnorePattern: ^_ 24 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: "https://3cities.xyz/#/pay?c=CAESFAKY9DMuOFdjE4Wzl2YyUFipPiSfIgICATICCAJaFURvbmF0aW9uIHRvIFBhdWwgQmVyZw" 2 | github: "PaulRBerg" 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # directories 2 | dist 3 | node_modules 4 | 5 | # files 6 | *.env 7 | *.log 8 | *.tsbuildinfo 9 | .DS_Store 10 | .pnp.* 11 | npm-debug.log* 12 | yarn.lock 13 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # directories 2 | **/build 3 | **/dist 4 | **/node_modules 5 | 6 | # files 7 | *.env 8 | *.log 9 | *.tsbuildinfo 10 | .DS_Store 11 | .pnp.* 12 | bun.lockb 13 | npm-debug.log 14 | package-lock.json 15 | pnpm-lock.yaml 16 | yarn.lock 17 | -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - "@trivago/prettier-plugin-sort-imports" 3 | printWidth: 120 4 | trailingComma: "all" 5 | 6 | overrides: 7 | - files: "*.md" 8 | options: 9 | proseWrap: "always" 10 | - files: ["*.ts", "*.tsx"] 11 | options: 12 | importOrderParserPlugins: ["typescript"] 13 | importOrderSeparation: true 14 | importOrderSortSpecifiers: true 15 | parser: "typescript" 16 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.formatOnSave": true 4 | } 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TypeScript Template 2 | 3 | A template for developing TypeScript projects, with sensible defaults. 4 | 5 | ## Getting Started 6 | 7 | Click the [`Use this template`](https://github.com/PaulRBerg/typescript-template/generate) button at the top of the page 8 | to create a new repository with this repo as the initial state. 9 | 10 | ## Features 11 | 12 | ### Sensible Defaults 13 | 14 | This template comes with sensible default configurations in the following files: 15 | 16 | ```text 17 | ├── .editorconfig 18 | ├── .eslintignore 19 | ├── .eslintrc.yml 20 | ├── .gitignore 21 | ├── .prettierignore 22 | ├── .prettierrc.yml 23 | ├── package.json 24 | ├── tsconfig.json 25 | └── tsconfig.prod.json 26 | ``` 27 | 28 | ### Dependency Management 29 | 30 | This template uses [Bun](https://bun.sh) for managing dependencies. 31 | 32 | ## Usage 33 | 34 | See the `scripts` section in the [`package.json`](./package.json) file. 35 | 36 | ## License 37 | 38 | This project is licensed under MIT. 39 | -------------------------------------------------------------------------------- /bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PaulRBerg/typescript-template/21918ffc3d438d396c4ee7b8f2dc5c9cc625e3de/bun.lockb -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@prb/typescript-template", 3 | "description": "A template for developing TypeScript projects, with sensible defaults", 4 | "version": "1.0.0", 5 | "author": { 6 | "name": "Paul Razvan Berg", 7 | "url": "https://github.com/PaulRBerg" 8 | }, 9 | "devDependencies": { 10 | "@trivago/prettier-plugin-sort-imports": "^3.3.1", 11 | "@types/node": "^18.15.5", 12 | "@typescript-eslint/eslint-plugin": "^5.56.0", 13 | "@typescript-eslint/parser": "^5.56.0", 14 | "eslint": "^8.36.0", 15 | "eslint-config-prettier": "^8.8.0", 16 | "prettier": "^2.8.6", 17 | "rimraf": "^4.4.1", 18 | "ts-node": "^10.9.1", 19 | "typescript": "^4.8.4" 20 | }, 21 | "files": [ 22 | "dist/**/*.d.ts", 23 | "dist/**/*.d.ts.map", 24 | "dist/**/*.js", 25 | "dist/**/*.js.map" 26 | ], 27 | "keywords": [ 28 | "bun", 29 | "eslint", 30 | "javascript", 31 | "prettier", 32 | "template", 33 | "typescript" 34 | ], 35 | "main": "./dist/index.js", 36 | "publishConfig": { 37 | "access": "public" 38 | }, 39 | "scripts": { 40 | "build": "tsc --build \"tsconfig.prod.json\"", 41 | "clean": "rimraf dist", 42 | "lint": "bun run lint:ts && bun run prettier:check", 43 | "lint:ts": "eslint --ext .js,.ts . && tsc --noEmit", 44 | "prettier:check": "prettier --check \"**/*.{js,json,md,ts,yml}\"", 45 | "prettier:write": "prettier --write \"**/*.{js,json,md,ts,yml}\"" 46 | }, 47 | "types": "./dist/index.d.ts" 48 | } 49 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | const message: string = "Hello World"; 2 | console.log({ message }); 3 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "declarationMap": true, 5 | "emitDecoratorMetadata": true, 6 | "esModuleInterop": true, 7 | "experimentalDecorators": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "lib": ["es6"], 10 | "module": "commonjs", 11 | "moduleResolution": "node", 12 | "noImplicitAny": true, 13 | "outDir": "./dist", 14 | "removeComments": true, 15 | "resolveJsonModule": true, 16 | "rootDir": "./src", 17 | "sourceMap": true, 18 | "strict": true, 19 | "target": "es6" 20 | }, 21 | "exclude": ["node_modules"], 22 | "include": ["src/**/*"] 23 | } 24 | -------------------------------------------------------------------------------- /tsconfig.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": false 5 | } 6 | } 7 | --------------------------------------------------------------------------------