Skip to content

chore(internal): revisit tsconfig files #1667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ site
!/examples/sam/src/handlers/COPY_LAMBDA_FUNCTIONS_HERE

# Layer temp files
tmp
tmp

# TS build files
tsconfig.tsbuildinfo
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ jest.config.js
.eslintignore
.huskyrc.js
.eslintrc.json
examples
examples
tsconfig.tsbuildinfo
28 changes: 4 additions & 24 deletions docs/snippets/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"experimentalDecorators": true,
"noImplicitAny": true,
"target": "ES2020",
"module": "commonjs",
"declaration": true,
"declarationMap": true,
"outDir": "lib",
"removeComments": false,
"strict": true,
"inlineSourceMap": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"pretty": true,
"esModuleInterop": true,
"allowJs": true,
"rootDir": "./",
"baseUrl": ".",
"noEmit": true,
"paths": {
"@aws-lambda-powertools/parameters/ssm": [
"../../packages/parameters/lib/ssm"
Expand All @@ -41,13 +29,5 @@
],
"@aws-lambda-powertools/batch": ["../../packages/batch/lib"]
}
},
"exclude": ["./node_modules"],
"watchOptions": {
"watchFile": "useFsEvents",
"watchDirectory": "useFsEvents",
"fallbackPolling": "dynamicPriority"
},
"lib": ["ES2020"],
"types": ["node"]
}
}
3 changes: 1 addition & 2 deletions layers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"test:e2e": "jest --group=e2e"
},
"lint-staged": {
"*.ts": "npm run lint-fix",
"*.js": "npm run lint-fix"
"*.{js,ts}": "npm run lint-fix"
},
"repository": {
"type": "git",
Expand Down
12 changes: 12 additions & 0 deletions layers/tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": "../",
"noEmit": true
},
"include": [
"../src/**/*",
"../package.json",
"./**/*",
]
}
31 changes: 0 additions & 31 deletions layers/tsconfig.es.json

This file was deleted.

40 changes: 11 additions & 29 deletions layers/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,12 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"noImplicitAny": true,
"target": "ES2019",
"module": "commonjs",
"declaration": true,
"outDir": "lib",
"strict": true,
"inlineSourceMap": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"pretty": true,
"baseUrl": "src/",
"rootDirs": [ "src/" ],
"esModuleInterop": true
},
"include": [ "src/**/*" ],
"exclude": [ "./node_modules", "cdk.out"],
"watchOptions": {
"watchFile": "useFsEvents",
"watchDirectory": "useFsEvents",
"fallbackPolling": "dynamicPriority"
},
"lib": [ "es2019" ],
"types": [
"jest",
"node"
]
}
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./lib",
"rootDir": "./",
"resolveJsonModule": true
},
"include": [
"./src/**/*",
"./bin/**/*"
],
}
2 changes: 1 addition & 1 deletion packages/batch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"test:e2e:nodejs18x": "echo 'Not Implemented'",
"test:e2e": "echo 'Not Implemented'",
"watch": "jest --watch",
"build": "tsc",
"build": "tsc --build --force",
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
"prebuild": "rimraf ./lib",
Expand Down
6 changes: 5 additions & 1 deletion packages/batch/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { DynamoDBRecord, KinesisStreamRecord, SQSRecord } from 'aws-lambda';
import type {
DynamoDBRecord,
KinesisStreamRecord,
SQSRecord,
} from 'aws-lambda';
import type {
PartialItemFailureResponse,
EventSourceDataClassTypes,
Expand Down
2 changes: 1 addition & 1 deletion packages/batch/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
Context,
DynamoDBRecord,
KinesisStreamRecord,
Expand Down
11 changes: 11 additions & 0 deletions packages/batch/tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": "../",
"noEmit": true
},
"include": [
"../src/**/*",
"./**/*",
]
}
2 changes: 1 addition & 1 deletion packages/batch/tests/unit/AsyncBatchProcessor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @group unit/batch/class/asyncBatchProcessor
*/
import type { Context } from 'aws-lambda';
import { helloworldContext as dummyContext } from '../../../commons/src/samples/resources/contexts';
import { helloworldContext as dummyContext } from '@aws-lambda-powertools/commons/lib/samples/resources/contexts';
import { AsyncBatchProcessor } from '../../src/AsyncBatchProcessor';
import { EventType } from '../../src/constants';
import { BatchProcessingError, FullBatchFailureError } from '../../src/errors';
Expand Down
2 changes: 1 addition & 1 deletion packages/batch/tests/unit/BatchProcessor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @group unit/batch/class/batchprocessor
*/
import type { Context } from 'aws-lambda';
import { helloworldContext as dummyContext } from '../../../commons/src/samples/resources/contexts';
import { helloworldContext as dummyContext } from '@aws-lambda-powertools/commons/lib/samples/resources/contexts';
import { BatchProcessor } from '../../src/BatchProcessor';
import { EventType } from '../../src/constants';
import { BatchProcessingError, FullBatchFailureError } from '../../src/errors';
Expand Down
4 changes: 2 additions & 2 deletions packages/batch/tests/unit/asyncProcessPartialResponse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import type {
KinesisStreamEvent,
SQSEvent,
} from 'aws-lambda';
import { helloworldContext as dummyContext } from '../../../commons/src/samples/resources/contexts';
import { Custom as dummyEvent } from '../../../commons/src/samples/resources/events';
import { helloworldContext as dummyContext } from '@aws-lambda-powertools/commons/lib/samples/resources/contexts';
import { Custom as dummyEvent } from '@aws-lambda-powertools/commons/lib/samples/resources/events';
import { AsyncBatchProcessor, asyncProcessPartialResponse } from '../../src';
import { EventType } from '../../src/constants';
import type {
Expand Down
4 changes: 2 additions & 2 deletions packages/batch/tests/unit/processPartialResponse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import type {
KinesisStreamEvent,
SQSEvent,
} from 'aws-lambda';
import { helloworldContext as dummyContext } from '../../../commons/src/samples/resources/contexts';
import { Custom as dummyEvent } from '../../../commons/src/samples/resources/events';
import { helloworldContext as dummyContext } from '@aws-lambda-powertools/commons/lib/samples/resources/contexts';
import { Custom as dummyEvent } from '@aws-lambda-powertools/commons/lib/samples/resources/events';
import { BatchProcessor, processPartialResponse } from '../../src';
import { EventType } from '../../src/constants';
import type {
Expand Down
11 changes: 0 additions & 11 deletions packages/batch/tsconfig-dev.json

This file was deleted.

11 changes: 0 additions & 11 deletions packages/batch/tsconfig.es.json

This file was deleted.

37 changes: 9 additions & 28 deletions packages/batch/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"noImplicitAny": true,
"target": "ES2020",
"module": "commonjs",
"declaration": true,
"outDir": "lib",
"strict": true,
"inlineSourceMap": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"pretty": true,
"baseUrl": "src/",
"rootDirs": [ "src/" ],
"esModuleInterop": true
},
"include": [ "src/**/*" ],
"exclude": [ "./node_modules"],
"watchOptions": {
"watchFile": "useFsEvents",
"watchDirectory": "useFsEvents",
"fallbackPolling": "dynamicPriority"
},
"lib": [ "es2020" ],
"types": [
"node"
]
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib",
"rootDir": "./src",
},
"include": [
"./src/**/*"
],
}
5 changes: 2 additions & 3 deletions packages/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
"test:e2e": "echo 'Not Applicable'",
"watch": "jest --watch",
"generateVersionFile": "echo \"// this file is auto generated, do not modify\nexport const PT_VERSION = '$(jq -r '.version' package.json)';\" > src/version.ts",
"build": "tsc",
"build": "tsc --build --force",
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
"prebuild": "rimraf ./lib",
"prepack": "node ../../.github/scripts/release_patch_package_json.js ."
},
"lint-staged": {
"*.ts": "npm run lint-fix",
"*.js": "npm run lint-fix"
"*.{js,ts}": "npm run lint-fix"
},
"homepage": "https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/packages/metrics#readme",
"license": "MIT-0",
Expand Down
2 changes: 1 addition & 1 deletion packages/commons/src/config/EnvironmentVariablesService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConfigService } from '.';
import { ConfigService } from './ConfigService';

/**
* Class EnvironmentVariablesService
Expand Down
2 changes: 1 addition & 1 deletion packages/commons/src/middleware/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const METRICS_KEY = `${PREFIX}.metrics`;
const LOGGER_KEY = `${PREFIX}.logger`;
const IDEMPOTENCY_KEY = `${PREFIX}.idempotency`;

export { TRACER_KEY, METRICS_KEY, LOGGER_KEY, IDEMPOTENCY_KEY };
export { PREFIX, TRACER_KEY, METRICS_KEY, LOGGER_KEY, IDEMPOTENCY_KEY };
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Context } from 'aws-lambda';
import type { Context } from 'aws-lambda';

const helloworldContext: Context = {
callbackWaitsForEmptyEventLoop: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/commons/src/utils/lambda/LambdaInterface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Handler } from 'aws-lambda';
import type { Handler } from 'aws-lambda';

export type SyncHandler<T extends Handler> = (
event: Parameters<T>[0],
Expand Down
11 changes: 11 additions & 0 deletions packages/commons/tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": "../",
"noEmit": true
},
"include": [
"../src/**/*",
"./**/*",
]
}
4 changes: 0 additions & 4 deletions packages/commons/tests/unit/LambdaInterface.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ describe('LambdaInterface with decorator', () => {
// WHEN
class LambdaFunction implements LambdaInterface {
@dummyModule.dummyDecorator()
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
public async handler(
_event: unknown,
context: Context
Expand All @@ -147,8 +145,6 @@ describe('LambdaInterface with decorator', () => {
// WHEN
class LambdaFunction implements LambdaInterface {
@dummyModule.dummyDecorator()
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
public handler(
_event: unknown,
context: Context,
Expand Down
Loading