Skip to content

Commit 1a7d6e9

Browse files
committed
Initialize NestJS Labs development monorepo with ESLint and TypeScript configurations. Added .gitignore, package.json, pnpm workspace, and README. Configured ESLint for various project types and set up TypeScript configurations for NestJS and Next.js.
0 parents  commit 1a7d6e9

23 files changed

+3674
-0
lines changed

.gitignore

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# compiled output
2+
/dist
3+
/node_modules
4+
/build
5+
**/dist
6+
**/node_modules
7+
**/build
8+
9+
# Logs
10+
logs
11+
*.log
12+
npm-debug.log*
13+
pnpm-debug.log*
14+
yarn-debug.log*
15+
yarn-error.log*
16+
lerna-debug.log*
17+
18+
# OS
19+
.DS_Store
20+
21+
# Tests
22+
/coverage
23+
/.nyc_output
24+
25+
# IDEs and editors
26+
/.idea
27+
.project
28+
.classpath
29+
.c9/
30+
*.launch
31+
.settings/
32+
*.sublime-workspace
33+
34+
# IDE - VSCode
35+
.vscode/*
36+
!.vscode/settings.json
37+
!.vscode/tasks.json
38+
!.vscode/launch.json
39+
!.vscode/extensions.json
40+
41+
# dotenv environment variable files
42+
.env
43+
.env.development.local
44+
.env.test.local
45+
.env.production.local
46+
.env.local
47+
48+
# temp directory
49+
.temp
50+
.tmp
51+
52+
# Runtime data
53+
pids
54+
*.pid
55+
*.seed
56+
*.pid.lock
57+
58+
# Diagnostic reports (https://nodejs.org/api/report.html)
59+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

.npmrc

Whitespace-only changes.

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"eslint.workingDirectories": [
3+
{
4+
"mode": "auto"
5+
}
6+
]
7+
}

README.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# NestJS Labs Dev
2+
3+
A monorepo for NestJS development environment, providing reusable ESLint and TypeScript configurations.
4+
5+
## 🚀 Project Overview
6+
7+
This monorepo contains various configuration packages for NestJS development, designed to provide a consistent and high-quality development experience.
8+
9+
## 📦 Included Packages
10+
11+
### `@nestjs-labs/eslint-config`
12+
Provides modular ESLint configurations supporting multiple project types:
13+
- **Base**: Basic configuration
14+
- **Node.js**: Node.js project configuration
15+
- **NestJS**: NestJS project configuration
16+
- **Next.js**: Next.js project configuration
17+
- **React**: React project configuration
18+
- **Jest**: Test files configuration
19+
20+
### `@nestjs-labs/typescript-config`
21+
Provides TypeScript configuration files:
22+
- **Base**: Basic TypeScript configuration
23+
- **NestJS**: NestJS project specific configuration
24+
- **Next.js**: Next.js project specific configuration
25+
- **React Library**: React library project configuration
26+
27+
## 🛠️ Tech Stack
28+
29+
- **Package Manager**: pnpm
30+
- **Build Tool**: Turbo
31+
- **Language**: TypeScript
32+
- **Code Quality**: ESLint + Prettier
33+
- **Node.js**: >= 20
34+
35+
## 📋 Requirements
36+
37+
- Node.js 18+
38+
- pnpm 9.0.0+
39+
40+
## 🚀 Quick Start
41+
42+
### Install Dependencies
43+
44+
```bash
45+
pnpm install
46+
```
47+
48+
### Development
49+
50+
```bash
51+
# Start development mode
52+
pnpm dev
53+
54+
# Build all packages
55+
pnpm build
56+
57+
# Lint code
58+
pnpm lint
59+
60+
# Type checking
61+
pnpm check-types
62+
63+
# Format code
64+
pnpm format
65+
```
66+
67+
## 📁 Project Structure
68+
69+
```
70+
nestjs-labs-dev/
71+
├── packages/
72+
│ ├── eslint-config/ # ESLint configuration package
73+
│ │ ├── src/
74+
│ │ │ ├── base.ts # Base configuration
75+
│ │ │ ├── nest.ts # NestJS configuration
76+
│ │ │ ├── next.ts # Next.js configuration
77+
│ │ │ ├── react.ts # React configuration
78+
│ │ │ ├── node.ts # Node.js configuration
79+
│ │ │ ├── jest.ts # Jest configuration
80+
│ │ │ └── index.ts # Main entry
81+
│ │ └── package.json
82+
│ └── typescript-config/ # TypeScript configuration package
83+
│ ├── base.json # Base configuration
84+
│ ├── nestjs.json # NestJS configuration
85+
│ ├── nextjs.json # Next.js configuration
86+
│ └── package.json
87+
├── package.json
88+
├── pnpm-workspace.yaml
89+
├── turbo.json
90+
└── README.md
91+
```
92+
93+
## 🔧 Usage Examples
94+
95+
### ESLint Configuration
96+
97+
Install and use ESLint configuration in your project:
98+
99+
```bash
100+
pnpm add -D @nestjs-labs/eslint-config
101+
```
102+
103+
Create `eslint.config.js`:
104+
105+
```javascript
106+
// Use complete NestJS configuration
107+
import nestJsConfig from '@nestjs-labs/eslint-config/nest';
108+
export default nestJsConfig;
109+
```
110+
111+
### TypeScript Configuration
112+
113+
Install and use TypeScript configuration in your project:
114+
115+
```bash
116+
pnpm add -D @nestjs-labs/typescript-config
117+
```
118+
119+
Extend configuration in `tsconfig.json`:
120+
121+
```json
122+
{
123+
"extends": "@nestjs-labs/typescript-config/nestjs"
124+
}
125+
```
126+
127+
## 📄 License
128+
129+
MIT License
130+
131+
## 🙏 Acknowledgments
132+
133+
This project is inspired by and references the excellent work from [@polkadot-js/dev](https://github.com/polkadot-js/dev), which provides shared development configurations and CI scripts for the Polkadot.js ecosystem. Their approach to creating reusable development tooling has been a great inspiration for this project.
134+
135+
## 🔗 Related Links
136+
137+
- [NestJS Official Website](https://nestjs.com/)
138+
- [Turbo Documentation](https://turbo.build/)
139+
- [pnpm Documentation](https://pnpm.io/)
140+
- [@polkadot-js/dev](https://github.com/polkadot-js/dev) - Inspiration for this project

package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "@nestjs-labs/dev",
3+
"private": true,
4+
"scripts": {
5+
"build": "turbo run build",
6+
"dev": "turbo run dev",
7+
"lint": "turbo run lint",
8+
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
9+
"check-types": "turbo run check-types"
10+
},
11+
"devDependencies": {
12+
"@types/node": "^22.0.0",
13+
"prettier": "^3.6.2",
14+
"turbo": "^2.5.5",
15+
"typescript": "5.8.3"
16+
},
17+
"engines": {
18+
"node": ">=20"
19+
}
20+
}

packages/eslint-config/README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# ESLint Configuration
2+
3+
This package provides modular ESLint configurations for different project types.
4+
5+
## Available Configurations
6+
7+
### Base Configuration
8+
```javascript
9+
// eslint.config.js
10+
import baseConfig from '@nestjs-labs/eslint-config/base';
11+
export default baseConfig;
12+
```
13+
14+
### Node.js Projects
15+
```javascript
16+
// eslint.config.js
17+
import nodeJsConfig from '@nestjs-labs/eslint-config/node';
18+
export default nodeJsConfig;
19+
```
20+
21+
### NestJS Projects
22+
```javascript
23+
// eslint.config.js
24+
import nestJsConfig from '@nestjs-labs/eslint-config/nest';
25+
export default nestJsConfig;
26+
```
27+
28+
### Next.js Projects
29+
```javascript
30+
// eslint.config.js
31+
import nextJsConfig from '@nestjs-labs/eslint-config/next';
32+
export default nextJsConfig;
33+
```
34+
35+
### React Projects
36+
```javascript
37+
// eslint.config.js
38+
import reactConfig from '@nestjs-labs/eslint-config/react';
39+
export default reactConfig;
40+
```
41+
42+
### Jest Test Files
43+
```javascript
44+
// eslint.config.js
45+
import jestConfig from '@nestjs-labs/eslint-config/jest';
46+
export default jestConfig;
47+
```
48+
49+
### Full Configuration (All Features)
50+
```javascript
51+
// eslint.config.js
52+
import fullConfig from '@nestjs-labs/eslint-config';
53+
export default fullConfig;
54+
```
55+
56+
## Legacy Extends Support
57+
58+
For projects that need to use the legacy `extends` syntax, you can import named exports:
59+
60+
```javascript
61+
// eslint.config.js
62+
import { nodeEslint, nestEslint, jestEslint } from '@nestjs-labs/eslint-config';
63+
64+
export default [
65+
...nodeEslint,
66+
...nestEslint,
67+
...jestEslint,
68+
// Your additional rules here
69+
];
70+
```
71+
72+
Available named exports:
73+
- `baseEslint` - Base configuration
74+
- `nodeEslint` - Node.js configuration
75+
- `nestEslint` - NestJS configuration
76+
- `nextEslint` - Next.js configuration
77+
- `reactEslint` - React configuration
78+
- `jestEslint` - Jest configuration
79+
80+
## Features
81+
82+
- **TypeScript Support**: Full TypeScript linting with strict rules
83+
- **Import Sorting**: Automatic import organization
84+
- **Code Style**: Consistent formatting rules
85+
- **React Support**: JSX and React Hooks rules
86+
- **Next.js Support**: Next.js specific optimizations
87+
- **NestJS Support**: NestJS decorator and class rules
88+
- **Testing Support**: Jest and test file specific rules
89+
- **Node.js Support**: Node.js specific globals and rules
90+
91+
## Requirements
92+
93+
- Node.js 18+
94+
- TypeScript 5.8+
95+
- ESLint 9.31+
96+
- typescript-eslint 8.37+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "@nestjs-labs/eslint-config",
3+
"version": "1.0.0",
4+
"main": "dist/index.js",
5+
"types": "dist/index.d.ts",
6+
"type": "module",
7+
"exports": {
8+
".": "./dist/index.js",
9+
"./base": "./dist/base.js",
10+
"./node": "./dist/node.js",
11+
"./nest": "./dist/nest.js",
12+
"./next": "./dist/next.js",
13+
"./react": "./dist/react.js",
14+
"./jest": "./dist/jest.js"
15+
},
16+
"files": [
17+
"dist"
18+
],
19+
"devDependencies": {
20+
"@eslint/js": "^9.31.0",
21+
"@next/eslint-plugin-next": "^15.2.4",
22+
"@tsconfig/strictest": "^2.0.5",
23+
"@types/node": "^22.0.0",
24+
"@typescript-eslint/eslint-plugin": "^8.4.0",
25+
"@typescript-eslint/parser": "^8.4.0",
26+
"eslint": "^9.31.0",
27+
"eslint-config-prettier": "^10.1.1",
28+
"eslint-plugin-import": "^2.31.1",
29+
"eslint-plugin-jest": "^29.0.1",
30+
"eslint-plugin-n": "^17.21.0",
31+
"eslint-plugin-promise": "^7.2.1",
32+
"eslint-plugin-react": "^7.37.2",
33+
"eslint-plugin-react-hooks": "^5.0.0",
34+
"eslint-plugin-simple-import-sort": "^12.1.0",
35+
"eslint-plugin-sort-destructure-keys": "^2.0.0",
36+
"globals": "^16.2.0",
37+
"typescript-eslint": "^8.37.0"
38+
},
39+
"peerDependencies": {
40+
"eslint": "^9.31.0"
41+
},
42+
"scripts": {
43+
"build": "tsc"
44+
}
45+
}

0 commit comments

Comments
 (0)