Skip to content

Commit 858d2f2

Browse files
authored
chore(internal): revisit tsconfig files (#1667)
* chore(ci): update tsconfig * wip * wip * chore: tsconfig batch * chore: tsconfig commons * chore: tsconfig commons * chore: tsconfig idempotency * chore: tsconfig testing * chore: tsconfig tracer * chore: tsconfig parameters * chore: tsconfig metrics * chore: tsconfig logger * chore: main tsconfig * chore: tsconfig layers * chore: tsconfig docs * chore: add resolveJsonModules to layers * chore: add comments to tsconfig * chore: add resolveJsonModules to layers * chore: rebase * fix: test * chore: removed orphaned configs * test: workspace build * revert workspace build
1 parent f3916d1 commit 858d2f2

File tree

78 files changed

+340
-754
lines changed

Some content is hidden

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

78 files changed

+340
-754
lines changed

Diff for: .gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,7 @@ site
4646
!/examples/sam/src/handlers/COPY_LAMBDA_FUNCTIONS_HERE
4747

4848
# Layer temp files
49-
tmp
49+
tmp
50+
51+
# TS build files
52+
tsconfig.tsbuildinfo

Diff for: .npmignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ jest.config.js
1818
.eslintignore
1919
.huskyrc.js
2020
.eslintrc.json
21-
examples
21+
examples
22+
tsconfig.tsbuildinfo

Diff for: docs/snippets/tsconfig.json

+4-24
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
11
{
2+
"extends": "../../tsconfig.json",
23
"compilerOptions": {
3-
"experimentalDecorators": true,
4-
"noImplicitAny": true,
5-
"target": "ES2020",
6-
"module": "commonjs",
7-
"declaration": true,
8-
"declarationMap": true,
9-
"outDir": "lib",
10-
"removeComments": false,
11-
"strict": true,
12-
"inlineSourceMap": true,
13-
"moduleResolution": "node",
14-
"resolveJsonModule": true,
15-
"pretty": true,
16-
"esModuleInterop": true,
17-
"allowJs": true,
4+
"rootDir": "./",
185
"baseUrl": ".",
6+
"noEmit": true,
197
"paths": {
208
"@aws-lambda-powertools/parameters/ssm": [
219
"../../packages/parameters/lib/ssm"
@@ -41,13 +29,5 @@
4129
],
4230
"@aws-lambda-powertools/batch": ["../../packages/batch/lib"]
4331
}
44-
},
45-
"exclude": ["./node_modules"],
46-
"watchOptions": {
47-
"watchFile": "useFsEvents",
48-
"watchDirectory": "useFsEvents",
49-
"fallbackPolling": "dynamicPriority"
50-
},
51-
"lib": ["ES2020"],
52-
"types": ["node"]
32+
}
5333
}

Diff for: layers/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
"test:e2e": "jest --group=e2e"
1818
},
1919
"lint-staged": {
20-
"*.ts": "npm run lint-fix",
21-
"*.js": "npm run lint-fix"
20+
"*.{js,ts}": "npm run lint-fix"
2221
},
2322
"repository": {
2423
"type": "git",

Diff for: layers/tests/tsconfig.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"rootDir": "../",
5+
"noEmit": true
6+
},
7+
"include": [
8+
"../src/**/*",
9+
"../package.json",
10+
"./**/*",
11+
]
12+
}

Diff for: layers/tsconfig.es.json

-31
This file was deleted.

Diff for: layers/tsconfig.json

+11-29
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,12 @@
11
{
2-
"compilerOptions": {
3-
"experimentalDecorators": true,
4-
"noImplicitAny": true,
5-
"target": "ES2019",
6-
"module": "commonjs",
7-
"declaration": true,
8-
"outDir": "lib",
9-
"strict": true,
10-
"inlineSourceMap": true,
11-
"moduleResolution": "node",
12-
"resolveJsonModule": true,
13-
"pretty": true,
14-
"baseUrl": "src/",
15-
"rootDirs": [ "src/" ],
16-
"esModuleInterop": true
17-
},
18-
"include": [ "src/**/*" ],
19-
"exclude": [ "./node_modules", "cdk.out"],
20-
"watchOptions": {
21-
"watchFile": "useFsEvents",
22-
"watchDirectory": "useFsEvents",
23-
"fallbackPolling": "dynamicPriority"
24-
},
25-
"lib": [ "es2019" ],
26-
"types": [
27-
"jest",
28-
"node"
29-
]
30-
}
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./lib",
5+
"rootDir": "./",
6+
"resolveJsonModule": true
7+
},
8+
"include": [
9+
"./src/**/*",
10+
"./bin/**/*"
11+
],
12+
}

Diff for: packages/batch/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"test:e2e:nodejs18x": "echo 'Not Implemented'",
1818
"test:e2e": "echo 'Not Implemented'",
1919
"watch": "jest --watch",
20-
"build": "tsc",
20+
"build": "tsc --build --force",
2121
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
2222
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
2323
"prebuild": "rimraf ./lib",

Diff for: packages/batch/src/constants.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { DynamoDBRecord, KinesisStreamRecord, SQSRecord } from 'aws-lambda';
1+
import type {
2+
DynamoDBRecord,
3+
KinesisStreamRecord,
4+
SQSRecord,
5+
} from 'aws-lambda';
26
import type {
37
PartialItemFailureResponse,
48
EventSourceDataClassTypes,

Diff for: packages/batch/src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import type {
22
Context,
33
DynamoDBRecord,
44
KinesisStreamRecord,

Diff for: packages/batch/tests/tsconfig.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"rootDir": "../",
5+
"noEmit": true
6+
},
7+
"include": [
8+
"../src/**/*",
9+
"./**/*",
10+
]
11+
}

Diff for: packages/batch/tests/unit/AsyncBatchProcessor.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @group unit/batch/class/asyncBatchProcessor
55
*/
66
import type { Context } from 'aws-lambda';
7-
import { helloworldContext as dummyContext } from '../../../commons/src/samples/resources/contexts';
7+
import { helloworldContext as dummyContext } from '@aws-lambda-powertools/commons/lib/samples/resources/contexts';
88
import { AsyncBatchProcessor } from '../../src/AsyncBatchProcessor';
99
import { EventType } from '../../src/constants';
1010
import { BatchProcessingError, FullBatchFailureError } from '../../src/errors';

Diff for: packages/batch/tests/unit/BatchProcessor.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @group unit/batch/class/batchprocessor
55
*/
66
import type { Context } from 'aws-lambda';
7-
import { helloworldContext as dummyContext } from '../../../commons/src/samples/resources/contexts';
7+
import { helloworldContext as dummyContext } from '@aws-lambda-powertools/commons/lib/samples/resources/contexts';
88
import { BatchProcessor } from '../../src/BatchProcessor';
99
import { EventType } from '../../src/constants';
1010
import { BatchProcessingError, FullBatchFailureError } from '../../src/errors';

Diff for: packages/batch/tests/unit/asyncProcessPartialResponse.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import type {
99
KinesisStreamEvent,
1010
SQSEvent,
1111
} from 'aws-lambda';
12-
import { helloworldContext as dummyContext } from '../../../commons/src/samples/resources/contexts';
13-
import { Custom as dummyEvent } from '../../../commons/src/samples/resources/events';
12+
import { helloworldContext as dummyContext } from '@aws-lambda-powertools/commons/lib/samples/resources/contexts';
13+
import { Custom as dummyEvent } from '@aws-lambda-powertools/commons/lib/samples/resources/events';
1414
import { AsyncBatchProcessor, asyncProcessPartialResponse } from '../../src';
1515
import { EventType } from '../../src/constants';
1616
import type {

Diff for: packages/batch/tests/unit/processPartialResponse.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import type {
99
KinesisStreamEvent,
1010
SQSEvent,
1111
} from 'aws-lambda';
12-
import { helloworldContext as dummyContext } from '../../../commons/src/samples/resources/contexts';
13-
import { Custom as dummyEvent } from '../../../commons/src/samples/resources/events';
12+
import { helloworldContext as dummyContext } from '@aws-lambda-powertools/commons/lib/samples/resources/contexts';
13+
import { Custom as dummyEvent } from '@aws-lambda-powertools/commons/lib/samples/resources/events';
1414
import { BatchProcessor, processPartialResponse } from '../../src';
1515
import { EventType } from '../../src/constants';
1616
import type {

Diff for: packages/batch/tsconfig-dev.json

-11
This file was deleted.

Diff for: packages/batch/tsconfig.es.json

-11
This file was deleted.

Diff for: packages/batch/tsconfig.json

+9-28
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,10 @@
1-
{
2-
"compilerOptions": {
3-
"experimentalDecorators": true,
4-
"noImplicitAny": true,
5-
"target": "ES2020",
6-
"module": "commonjs",
7-
"declaration": true,
8-
"outDir": "lib",
9-
"strict": true,
10-
"inlineSourceMap": true,
11-
"moduleResolution": "node",
12-
"resolveJsonModule": true,
13-
"pretty": true,
14-
"baseUrl": "src/",
15-
"rootDirs": [ "src/" ],
16-
"esModuleInterop": true
17-
},
18-
"include": [ "src/**/*" ],
19-
"exclude": [ "./node_modules"],
20-
"watchOptions": {
21-
"watchFile": "useFsEvents",
22-
"watchDirectory": "useFsEvents",
23-
"fallbackPolling": "dynamicPriority"
24-
},
25-
"lib": [ "es2020" ],
26-
"types": [
27-
"node"
28-
]
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./lib",
5+
"rootDir": "./src",
6+
},
7+
"include": [
8+
"./src/**/*"
9+
],
2910
}

Diff for: packages/commons/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@
1515
"test:e2e": "echo 'Not Applicable'",
1616
"watch": "jest --watch",
1717
"generateVersionFile": "echo \"// this file is auto generated, do not modify\nexport const PT_VERSION = '$(jq -r '.version' package.json)';\" > src/version.ts",
18-
"build": "tsc",
18+
"build": "tsc --build --force",
1919
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
2020
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
2121
"prebuild": "rimraf ./lib",
2222
"prepack": "node ../../.github/scripts/release_patch_package_json.js ."
2323
},
2424
"lint-staged": {
25-
"*.ts": "npm run lint-fix",
26-
"*.js": "npm run lint-fix"
25+
"*.{js,ts}": "npm run lint-fix"
2726
},
2827
"homepage": "https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/packages/metrics#readme",
2928
"license": "MIT-0",

Diff for: packages/commons/src/config/EnvironmentVariablesService.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ConfigService } from '.';
1+
import { ConfigService } from './ConfigService';
22

33
/**
44
* Class EnvironmentVariablesService

Diff for: packages/commons/src/middleware/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ const METRICS_KEY = `${PREFIX}.metrics`;
99
const LOGGER_KEY = `${PREFIX}.logger`;
1010
const IDEMPOTENCY_KEY = `${PREFIX}.idempotency`;
1111

12-
export { TRACER_KEY, METRICS_KEY, LOGGER_KEY, IDEMPOTENCY_KEY };
12+
export { PREFIX, TRACER_KEY, METRICS_KEY, LOGGER_KEY, IDEMPOTENCY_KEY };

Diff for: packages/commons/src/samples/resources/contexts/hello-world.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Context } from 'aws-lambda';
1+
import type { Context } from 'aws-lambda';
22

33
const helloworldContext: Context = {
44
callbackWaitsForEmptyEventLoop: true,

Diff for: packages/commons/src/utils/lambda/LambdaInterface.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Handler } from 'aws-lambda';
1+
import type { Handler } from 'aws-lambda';
22

33
export type SyncHandler<T extends Handler> = (
44
event: Parameters<T>[0],

Diff for: packages/commons/tests/tsconfig.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"rootDir": "../",
5+
"noEmit": true
6+
},
7+
"include": [
8+
"../src/**/*",
9+
"./**/*",
10+
]
11+
}

Diff for: packages/commons/tests/unit/LambdaInterface.test.ts

-4
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ describe('LambdaInterface with decorator', () => {
128128
// WHEN
129129
class LambdaFunction implements LambdaInterface {
130130
@dummyModule.dummyDecorator()
131-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
132-
// @ts-ignore
133131
public async handler(
134132
_event: unknown,
135133
context: Context
@@ -147,8 +145,6 @@ describe('LambdaInterface with decorator', () => {
147145
// WHEN
148146
class LambdaFunction implements LambdaInterface {
149147
@dummyModule.dummyDecorator()
150-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
151-
// @ts-ignore
152148
public handler(
153149
_event: unknown,
154150
context: Context,

0 commit comments

Comments
 (0)