Skip to content

Commit 01b8660

Browse files
CCM-10591: Add Lambda Boilerplate
1 parent fc8e00f commit 01b8660

File tree

12 files changed

+7940
-0
lines changed

12 files changed

+7940
-0
lines changed

.eslintignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**/*/coverage/*
2+
.build
3+
node_modules
4+
dist
5+
**/jest.config.ts
6+
**/jest.setup.ts

.eslintrc.json

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended",
5+
"plugin:jest/recommended",
6+
"plugin:jsx-a11y/recommended",
7+
"plugin:prettier/recommended",
8+
"plugin:security/recommended-legacy",
9+
"plugin:sonarjs/recommended-legacy",
10+
"plugin:unicorn/recommended"
11+
],
12+
"overrides": [
13+
{
14+
"files": [
15+
"*.js"
16+
],
17+
"rules": {
18+
"@typescript-eslint/no-require-imports": "off",
19+
"@typescript-eslint/no-var-requires": "off",
20+
"global-require": "off",
21+
"unicorn/prefer-module": "off"
22+
}
23+
},
24+
{
25+
"files": [
26+
"*.{test,spec}.{ts,tsx}"
27+
],
28+
"rules": {
29+
"max-classes-per-file": "off",
30+
"sonarjs/no-nested-functions": "off",
31+
"unicorn/consistent-function-scoping": "off",
32+
"unicorn/no-useless-undefined": "off"
33+
}
34+
}
35+
],
36+
"plugins": [
37+
"@typescript-eslint",
38+
"html",
39+
"import",
40+
"jest",
41+
"jsx-a11y",
42+
"prettier",
43+
"security",
44+
"sonarjs",
45+
"unicorn"
46+
],
47+
"rules": {
48+
"@typescript-eslint/no-shadow": "error",
49+
"@typescript-eslint/no-unused-vars": [
50+
"error",
51+
{
52+
"argsIgnorePattern": "^_",
53+
"ignoreRestSiblings": true,
54+
"varsIgnorePattern": "^_"
55+
}
56+
],
57+
"class-methods-use-this": "off",
58+
"consistent-return": "off",
59+
"import/extensions": "off",
60+
"import/no-extraneous-dependencies": [
61+
"error",
62+
{
63+
"devDependencies": [
64+
"jest.config.ts",
65+
"jest.setup.ts",
66+
"**/__tests__/**",
67+
"**/*.dev.[jt]s?(x)"
68+
]
69+
}
70+
],
71+
"import/prefer-default-export": "off",
72+
"no-empty-function": "off",
73+
"no-param-reassign": "off",
74+
"no-restricted-syntax": "off",
75+
"no-shadow": "off",
76+
"no-underscore-dangle": "off",
77+
"no-useless-constructor": "off",
78+
"prefer-regex-literals": "off",
79+
"prettier/prettier": "error",
80+
"security/detect-object-injection": "off",
81+
"sonarjs/no-duplicate-string": "off",
82+
"sonarjs/no-small-switch": "off",
83+
"sonarjs/no-unused-vars": "off",
84+
"unicorn/filename-case": [
85+
"error",
86+
{
87+
"case": "kebabCase",
88+
"ignore": [
89+
".tsx"
90+
]
91+
}
92+
],
93+
"unicorn/no-null": "off",
94+
"unicorn/prefer-module": "off",
95+
"unicorn/prevent-abbreviations": "off"
96+
},
97+
"settings": {
98+
"import/resolver": {
99+
"typescript": {}
100+
}
101+
}
102+
}

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ version.json
1111
!project.code-workspace
1212

1313
# Please, add your custom content below!
14+
15+
# dependencies
16+
node_modules
17+
.node-version
18+
*/node_modules
19+
/.pnp
20+
.pnp.js
21+
/build
22+
dist
23+
.DS_Store

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
act 0.2.64
22
gitleaks 8.24.0
3+
jq 1.6
4+
nodejs 22.11.0
35
pre-commit 3.6.0
46
terraform 1.9.2
57
terraform-docs 0.19.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

lambdas/example-lambda/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage
2+
node_modules
3+
dist
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"dependencies": {
3+
"esbuild": "^0.24.0"
4+
},
5+
"devDependencies": {
6+
"@swc/core": "^1.11.13",
7+
"@swc/jest": "^0.2.37",
8+
"@tsconfig/node20": "^20.1.5",
9+
"@types/aws-lambda": "^8.10.148",
10+
"@types/jest": "^29.5.14",
11+
"jest": "^29.7.0",
12+
"jest-mock-extended": "^3.0.7",
13+
"typescript": "^5.8.2"
14+
},
15+
"name": "nhs-notify-repository-template-example-lambda",
16+
"private": true,
17+
"scripts": {
18+
"lambda-build": "rm -rf dist && npx esbuild --bundle --minify --sourcemap --target=es2020 --platform=node --loader:.node=file --entry-names=[name] --outdir=dist src/index.ts",
19+
"lint": "eslint .",
20+
"lint:fix": "eslint . --fix",
21+
"test:unit": "jest",
22+
"typecheck": "tsc --noEmit"
23+
},
24+
"version": "0.0.1"
25+
}

lambdas/example-lambda/src/__tests__/index.test.ts

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const handler = async () => {
2+
console.log('Lambda function has been invoked.');
3+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "@tsconfig/node20/tsconfig.json",
3+
"include": [
4+
"src/**/*"
5+
]
6+
}

0 commit comments

Comments
 (0)