Skip to content

Commit 09d5963

Browse files
authored
Merge branch 'master' into feat/validation-pipe-option
2 parents 7fbfa8a + 8f04235 commit 09d5963

File tree

519 files changed

+35398
-21200
lines changed

Some content is hidden

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

519 files changed

+35398
-21200
lines changed

.circleci/config.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ parameters:
66
default: false
77
legacy-node-version:
88
type: string
9-
default: '14.21.3'
9+
default: '18.20'
1010
maintenance-node-version:
1111
type: string
12-
default: '16.20'
12+
default: '20.18'
1313
active-node-version:
1414
type: string
15-
default: '18.17'
15+
default: '22.11'
1616
current-node-version:
1717
type: string
18-
default: '20.5'
18+
default: '23.3'
1919

2020
aliases:
2121
- &restore-cache
@@ -121,14 +121,14 @@ jobs:
121121
lint:
122122
working_directory: ~/nest
123123
docker:
124-
- image: cimg/node:<< pipeline.parameters.current-node-version >>
124+
- image: cimg/node:<< pipeline.parameters.active-node-version >>
125125
steps:
126126
- checkout
127127
- *restore-cache
128128
- *install-deps
129129
- run:
130130
name: Lint
131-
command: npm run lint
131+
command: npm run lint:ci
132132

133133
integration_tests:
134134
working_directory: ~/nest

.eslintignore

-3
This file was deleted.

.eslintrc.js

-47
This file was deleted.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(The MIT License)
22

3-
Copyright (c) 2017-2024 Kamil Mysliwiec <https://kamilmysliwiec.com>
3+
Copyright (c) 2017-2025 Kamil Mysliwiec <https://kamilmysliwiec.com>
44

55
Permission is hereby granted, free of charge, to any person obtaining
66
a copy of this software and associated documentation files (the

eslint.config.mjs

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// @ts-check
2+
import eslint from '@eslint/js';
3+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
4+
import globals from 'globals';
5+
import tseslint from 'typescript-eslint';
6+
7+
export default tseslint.config(
8+
{
9+
ignores: ['node_modules', '**/node_modules/**', '**/*.js', '**/*.d.ts'],
10+
},
11+
eslint.configs.recommended,
12+
...tseslint.configs.recommendedTypeChecked,
13+
eslintPluginPrettierRecommended,
14+
{
15+
languageOptions: {
16+
globals: {
17+
...globals.node,
18+
...globals.jest,
19+
},
20+
ecmaVersion: 5,
21+
sourceType: 'module',
22+
parserOptions: {
23+
project: ['tsconfig.json', 'tsconfig.spec.json'],
24+
projectService: true,
25+
tsconfigRootDir: import.meta.dirname,
26+
},
27+
},
28+
},
29+
{
30+
rules: {
31+
'@typescript-eslint/no-explicit-any': 'off',
32+
'@typescript-eslint/no-unsafe-assignment': 'off',
33+
'@typescript-eslint/no-unsafe-call': 'off',
34+
'@typescript-eslint/no-unsafe-member-access': 'off',
35+
'@typescript-eslint/no-unsafe-function-type': 'off',
36+
'@typescript-eslint/no-unsafe-argument': 'off',
37+
'@typescript-eslint/no-unsafe-return': 'off',
38+
'@typescript-eslint/no-unused-expressions': 'off',
39+
'@typescript-eslint/no-require-imports': 'off',
40+
'@typescript-eslint/no-unused-vars': 'off',
41+
"@typescript-eslint/no-misused-promises": [
42+
"error",
43+
{
44+
"checksVoidReturn": false,
45+
"checksConditionals": false
46+
}
47+
],
48+
"@typescript-eslint/require-await": "off",
49+
'@typescript-eslint/prefer-promise-reject-errors': 'off',
50+
'@typescript-eslint/no-base-to-string': 'off',
51+
'@typescript-eslint/unbound-method': 'off',
52+
'@typescript-eslint/only-throw-error': 'off',
53+
},
54+
},
55+
);

integration/auto-mock/test/bar.service.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as chaiAsPromised from 'chai-as-promised';
44
import * as sinon from 'sinon';
55
import { BarService } from '../src/bar.service';
66
import { FooService } from '../src/foo.service';
7+
78
chai.use(chaiAsPromised);
89
const { expect } = chai;
910

integration/auto-mock/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"target": "ES2021",
1111
"sourceMap": true,
1212
"allowJs": true,
13+
"strictNullChecks": true,
1314
"outDir": "./dist",
1415
"paths": {
1516
"@nestjs/common": ["../../packages/common"],
@@ -32,7 +33,8 @@
3233
},
3334
"include": [
3435
"src/**/*",
35-
"e2e/**/*"
36+
"e2e/**/*",
37+
"test/**/*"
3638
],
3739
"exclude": [
3840
"node_modules",

integration/cors/e2e/fastify.spec.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ describe.skip('Fastify Cors', () => {
3838
);
3939

4040
let requestId = 0;
41-
const configDelegation = function (req, cb) {
42-
const config = configs[requestId];
43-
requestId++;
44-
cb(null, config);
41+
const configDelegation = {
42+
delegator: function (req, cb) {
43+
const config = configs[requestId];
44+
requestId++;
45+
cb(null, config);
46+
},
4547
};
4648
app.enableCors(configDelegation);
4749

integration/cors/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"target": "ES2021",
1111
"sourceMap": true,
1212
"allowJs": true,
13+
"strictNullChecks": true,
1314
"outDir": "./dist",
1415
"paths": {
1516
"@nestjs/common": ["../../packages/common"],

integration/discovery/src/webhooks.explorer.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ export class WebhooksExplorer {
1717
const { name } = this.discoveryService.getMetadataByDecorator(
1818
Webhook,
1919
wrapper,
20-
);
20+
)!;
2121
return {
2222
name,
2323
handlers: this.metadataScanner
24-
.getAllMethodNames(wrapper.metatype.prototype)
24+
.getAllMethodNames(wrapper.metatype!.prototype)
2525
.map(methodName => {
2626
const { event } = this.discoveryService.getMetadataByDecorator(
2727
WebhookHandler,
2828
wrapper,
2929
methodName,
30-
);
30+
)!;
3131
return {
3232
methodName,
3333
event,

integration/discovery/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"target": "ES2021",
1111
"sourceMap": true,
1212
"allowJs": true,
13+
"strictNullChecks": true,
1314
"outDir": "./dist",
1415
"paths": {
1516
"@nestjs/common": ["../../packages/common"],

integration/docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ services:
2727
mysql:
2828
image: mysql:9.1.0
2929
environment:
30+
MYSQL_ROOT_HOST: '%'
3031
MYSQL_ROOT_PASSWORD: root
3132
MYSQL_DATABASE: test
3233
ports:

integration/graphql-code-first/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ async function bootstrap() {
77
app.useGlobalPipes(new ValidationPipe());
88
await app.listen(3000);
99
}
10-
bootstrap();
10+
void bootstrap();

integration/graphql-code-first/src/recipes/recipes.resolver.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class RecipesResolver {
3535
@Args('newRecipeData') newRecipeData: NewRecipeInput,
3636
): Promise<Recipe> {
3737
const recipe = await this.recipesService.create(newRecipeData);
38-
pubSub.publish('recipeAdded', { recipeAdded: recipe });
38+
void pubSub.publish('recipeAdded', { recipeAdded: recipe });
3939
return recipe;
4040
}
4141

integration/graphql-code-first/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"target": "ES2021",
1111
"sourceMap": true,
1212
"allowJs": true,
13+
"strictNullChecks": true,
1314
"outDir": "./dist",
1415
"paths": {
1516
"@nestjs/common": ["../../packages/common"],

integration/graphql-schema-first/e2e/graphql-request-scoped.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('GraphQL request scoped', () => {
4242
],
4343
},
4444
})
45-
.end((err, res) => {
45+
.end(err => {
4646
if (err) return end(err);
4747
end();
4848
});

integration/graphql-schema-first/src/cats/cats-request-scoped.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ export class CatsRequestScopedService {
2020
}
2121

2222
findOneById(id: number): Cat {
23-
return this.cats.find(cat => cat.id === id);
23+
return this.cats.find(cat => cat.id === id)!;
2424
}
2525
}

integration/graphql-schema-first/src/cats/cats.resolvers.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export class CatsResolvers {
2727

2828
@Mutation('createCat')
2929
async create(@Args() args: Cat): Promise<Cat> {
30-
const createdCat = await this.catsService.create(args);
31-
pubSub.publish('catCreated', { catCreated: createdCat });
30+
const createdCat = this.catsService.create(args);
31+
void pubSub.publish('catCreated', { catCreated: createdCat });
3232
return createdCat;
3333
}
3434

integration/graphql-schema-first/src/cats/cats.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ export class CatsService {
2020
}
2121

2222
findOneById(id: number): Cat {
23-
return this.cats.find(cat => cat.id === id);
23+
return this.cats.find(cat => cat.id === id)!;
2424
}
2525
}

integration/graphql-schema-first/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ async function bootstrap() {
55
const app = await NestFactory.create(AppModule);
66
await app.listen(3000);
77
}
8-
bootstrap();
8+
void bootstrap();

integration/graphql-schema-first/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"target": "ES2021",
1111
"sourceMap": true,
1212
"allowJs": true,
13+
"strictNullChecks": true,
1314
"outDir": "./dist",
1415
"paths": {
1516
"@nestjs/common": ["../../packages/common"],

integration/hello-world/e2e/exclude-middleware-fastify.spec.ts

+33-4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ class TestController {
5050
return RETURN_VALUE;
5151
}
5252

53+
@Get('legacy-wildcard/overview')
54+
testLegacyWildcard() {
55+
return RETURN_VALUE;
56+
}
57+
58+
@Get('splat-wildcard/overview')
59+
testSplatWildcard() {
60+
return RETURN_VALUE;
61+
}
62+
5363
@Get('overview/:id')
5464
overviewById() {
5565
return RETURN_VALUE;
@@ -64,10 +74,17 @@ class TestModule {
6474
configure(consumer: MiddlewareConsumer) {
6575
consumer
6676
.apply((req, res, next) => res.end(MIDDLEWARE_VALUE))
67-
.exclude('test', 'overview/:id', 'wildcard/(.*)', {
68-
path: 'middleware',
69-
method: RequestMethod.POST,
70-
})
77+
.exclude(
78+
'test',
79+
'overview/:id',
80+
'wildcard/*',
81+
'legacy-wildcard/(.*)',
82+
'splat-wildcard/*splat',
83+
{
84+
path: 'middleware',
85+
method: RequestMethod.POST,
86+
},
87+
)
7188
.forRoutes('*');
7289
}
7390
}
@@ -126,6 +143,18 @@ describe('Exclude middleware (fastify)', () => {
126143
.expect(200, RETURN_VALUE);
127144
});
128145

146+
it(`should exclude "/legacy-wildcard/overview" endpoint (by wildcard, legacy syntax)`, () => {
147+
return request(app.getHttpServer())
148+
.get('/legacy-wildcard/overview')
149+
.expect(200, RETURN_VALUE);
150+
});
151+
152+
it(`should exclude "/splat-wildcard/overview" endpoint (by wildcard, new syntax)`, () => {
153+
return request(app.getHttpServer())
154+
.get('/splat-wildcard/overview')
155+
.expect(200, RETURN_VALUE);
156+
});
157+
129158
afterEach(async () => {
130159
await app.close();
131160
});

0 commit comments

Comments
 (0)