Skip to content

Commit a43272f

Browse files
Feature/CCM-10591 lambda boilerplate (#68)
* CCM-10591: Add Lambda Boilerplate * CCM-10591: Add Lambda Boilerplate * CCM-10591: Add Lambda Boilerplate * CCM-10591: Add Lambda Boilerplate * CCM-10591: Add Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate * CCM-10591: Lambda Boilerplate
1 parent fc8e00f commit a43272f

33 files changed

+9374
-289
lines changed

.github/workflows/stage-2-test.yaml

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,89 @@ on:
3232
required: true
3333
type: string
3434

35+
env:
36+
AWS_REGION: eu-west-2
37+
TERM: xterm-256color
38+
39+
permissions:
40+
id-token: write # This is required for requesting the JWT
41+
contents: read # This is required for actions/checkout
42+
3543
jobs:
44+
check-generated-dependencies:
45+
name: "Check generated dependencies"
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 5
48+
steps:
49+
- name: "Checkout code"
50+
uses: actions/checkout@v4
51+
- name: "Repo setup"
52+
run: |
53+
npm ci
54+
- name: "Generate dependencies"
55+
run: |
56+
npm run generate-dependencies --workspaces --if-present
57+
git diff --exit-code
3658
test-unit:
3759
name: "Unit tests"
3860
runs-on: ubuntu-latest
3961
timeout-minutes: 5
4062
steps:
4163
- name: "Checkout code"
4264
uses: actions/checkout@v4
65+
- name: "Repo setup"
66+
run: |
67+
npm ci
68+
- name: "Generate dependencies"
69+
run: |
70+
npm run generate-dependencies --workspaces --if-present
4371
- name: "Run unit test suite"
4472
run: |
4573
make test-unit
4674
- name: "Save the result of fast test suite"
47-
run: |
48-
echo "Nothing to save"
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: unit-tests
78+
path: "**/.reports/unit"
79+
include-hidden-files: true
80+
if: always()
81+
- name: "Save the result of code coverage"
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: code-coverage-report
85+
path: ".reports/lcov.info"
4986
test-lint:
5087
name: "Linting"
5188
runs-on: ubuntu-latest
5289
timeout-minutes: 5
5390
steps:
5491
- name: "Checkout code"
5592
uses: actions/checkout@v4
93+
- name: "Repo setup"
94+
run: |
95+
npm ci
96+
- name: "Generate dependencies"
97+
run: |
98+
npm run generate-dependencies --workspaces --if-present
5699
- name: "Run linting"
57100
run: |
58101
make test-lint
59-
- name: "Save the linting result"
102+
test-typecheck:
103+
name: "Typecheck"
104+
runs-on: ubuntu-latest
105+
timeout-minutes: 5
106+
steps:
107+
- name: "Checkout code"
108+
uses: actions/checkout@v4
109+
- name: "Repo setup"
60110
run: |
61-
echo "Nothing to save"
111+
npm ci
112+
- name: "Generate dependencies"
113+
run: |
114+
npm run generate-dependencies --workspaces --if-present
115+
- name: "Run typecheck"
116+
run: |
117+
make test-typecheck
62118
test-coverage:
63119
name: "Test coverage"
64120
needs: [test-unit]
@@ -86,6 +142,10 @@ jobs:
86142
uses: actions/checkout@v4
87143
with:
88144
fetch-depth: 0 # Full history is needed to improving relevancy of reporting
145+
- name: "Download coverage report for SONAR"
146+
uses: actions/download-artifact@v4
147+
with:
148+
name: code-coverage-report
89149
- name: "Perform static analysis"
90150
uses: ./.github/actions/perform-static-analysis
91151
with:

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,14 @@ 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
24+
.reports

.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

eslint.config.mjs

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
import jest from 'eslint-plugin-jest';
2+
import jsxA11y from 'eslint-plugin-jsx-a11y';
3+
import prettierRecommended from 'eslint-plugin-prettier/recommended';
4+
import { importX } from 'eslint-plugin-import-x';
5+
import * as eslintImportResolverTypescript from 'eslint-import-resolver-typescript';
6+
import noRelativeImportPaths from 'eslint-plugin-no-relative-import-paths';
7+
import react from 'eslint-plugin-react';
8+
import security from 'eslint-plugin-security';
9+
import sonarjs from 'eslint-plugin-sonarjs';
10+
import json from 'eslint-plugin-json';
11+
import unicorn from 'eslint-plugin-unicorn';
12+
import { defineConfig, globalIgnores } from 'eslint/config';
13+
import js from '@eslint/js';
14+
import html from 'eslint-plugin-html';
15+
import tseslint from 'typescript-eslint';
16+
import sortDestructureKeys from 'eslint-plugin-sort-destructure-keys';
17+
import {
18+
configs as airbnbConfigs,
19+
plugins as airbnbPlugins,
20+
} from 'eslint-config-airbnb-extended';
21+
import { rules as prettierConfigRules } from 'eslint-config-prettier';
22+
23+
import { dirname } from 'node:path';
24+
import { fileURLToPath } from 'node:url';
25+
import { FlatCompat } from '@eslint/eslintrc';
26+
27+
const __filename = fileURLToPath(import.meta.url);
28+
const __dirname = dirname(__filename);
29+
30+
const compat = new FlatCompat({
31+
baseDirectory: __dirname,
32+
});
33+
34+
export default defineConfig([
35+
globalIgnores([
36+
'**/*/coverage/*',
37+
'**/.build',
38+
'**/node_modules',
39+
'**/dist',
40+
'**/test-results',
41+
'**/playwright-report*',
42+
'eslint.config.mjs',
43+
]),
44+
45+
//imports
46+
importX.flatConfigs.recommended,
47+
{ rules: { ...airbnbPlugins.importX.rules } },
48+
49+
// js
50+
js.configs.recommended,
51+
airbnbPlugins.stylistic,
52+
airbnbConfigs.base.recommended,
53+
54+
// ts
55+
tseslint.configs.strictTypeChecked,
56+
tseslint.configs.stylisticTypeChecked,
57+
airbnbConfigs.base.typescript,
58+
airbnbPlugins.typescriptEslint,
59+
60+
{
61+
ignores: ['**/*.json'],
62+
languageOptions: {
63+
parserOptions: {
64+
projectService: true,
65+
tsconfigRootDir: import.meta.dirname,
66+
},
67+
},
68+
},
69+
70+
{
71+
files: ['**/*.json'],
72+
extends: [tseslint.configs.disableTypeChecked],
73+
},
74+
75+
{
76+
settings: {
77+
'import-x/resolver-next': [
78+
eslintImportResolverTypescript.createTypeScriptImportResolver({
79+
project: [
80+
'frontend/tsconfig.json',
81+
'lambdas/*/tsconfig.json',
82+
'tests/test-team/tsconfig.json',
83+
'utils/*/tsconfig.json',
84+
],
85+
}),
86+
],
87+
},
88+
},
89+
90+
{
91+
rules: {
92+
'@typescript-eslint/no-unused-vars': [
93+
2,
94+
{
95+
argsIgnorePattern: '^_',
96+
varsIgnorePattern: '^_',
97+
},
98+
],
99+
'@typescript-eslint/consistent-type-definitions': 0,
100+
},
101+
},
102+
103+
// unicorn
104+
unicorn.configs['recommended'],
105+
{
106+
rules: {
107+
'unicorn/prevent-abbreviations': 0,
108+
'unicorn/filename-case': [
109+
2,
110+
{
111+
case: 'kebabCase',
112+
ignore: ['.tsx'],
113+
},
114+
],
115+
'unicorn/no-null': 0,
116+
'unicorn/prefer-module': 0,
117+
'unicorn/import-style': [
118+
2,
119+
{
120+
styles: {
121+
path: {
122+
named: true,
123+
},
124+
},
125+
},
126+
],
127+
},
128+
},
129+
130+
// react
131+
react.configs.flat.recommended,
132+
airbnbConfigs.react.recommended,
133+
airbnbConfigs.react.typescript,
134+
airbnbPlugins.react,
135+
airbnbPlugins.reactHooks,
136+
airbnbPlugins.reactA11y,
137+
138+
// jest
139+
jest.configs['flat/recommended'],
140+
141+
// prettier
142+
prettierRecommended,
143+
{ rules: { ...prettierConfigRules, 'prettier/prettier': 2 } },
144+
145+
// jsxA11y
146+
{
147+
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
148+
plugins: {
149+
'jsx-a11y': jsxA11y,
150+
},
151+
languageOptions: {
152+
parserOptions: {
153+
ecmaFeatures: {
154+
jsx: true,
155+
},
156+
},
157+
},
158+
},
159+
160+
// security
161+
security.configs.recommended,
162+
163+
// sonar
164+
sonarjs.configs.recommended,
165+
166+
// html
167+
{
168+
files: ['**/*.html'],
169+
plugins: { html },
170+
},
171+
172+
// Next.js
173+
...compat.config({
174+
extends: ['next', 'next/core-web-vitals', 'next/typescript'],
175+
settings: {
176+
next: {
177+
rootDir: 'frontend',
178+
},
179+
},
180+
rules: {
181+
// needed because next lint rules look for a pages directory
182+
'@next/next/no-html-link-for-pages': 0,
183+
},
184+
}),
185+
186+
// json
187+
{
188+
files: ['**/*.json'],
189+
...json.configs['recommended'],
190+
},
191+
192+
// destructure sorting
193+
{
194+
name: 'eslint-plugin-sort-destructure-keys',
195+
plugins: {
196+
'sort-destructure-keys': sortDestructureKeys,
197+
},
198+
rules: {
199+
'sort-destructure-keys/sort-destructure-keys': 2,
200+
},
201+
},
202+
203+
// imports
204+
{
205+
rules: {
206+
'sort-imports': [
207+
2,
208+
{
209+
ignoreDeclarationSort: true,
210+
},
211+
],
212+
'import-x/extensions': 0,
213+
},
214+
},
215+
{
216+
files: ['**/*.ts', '**/*.tsx'],
217+
rules: {
218+
'import-x/no-unresolved': 0, // trust the typescript compiler to catch unresolved imports
219+
},
220+
},
221+
{
222+
files: ['tests/test-team/**'],
223+
rules: {
224+
'import-x/no-extraneous-dependencies': [
225+
2,
226+
{
227+
devDependencies: true,
228+
},
229+
],
230+
},
231+
},
232+
{
233+
files: ['**/utils/**', 'tests/test-team/**'],
234+
rules: {
235+
'import-x/prefer-default-export': 0,
236+
},
237+
},
238+
{
239+
plugins: {
240+
'no-relative-import-paths': noRelativeImportPaths,
241+
},
242+
rules: {
243+
'no-relative-import-paths/no-relative-import-paths': 2,
244+
},
245+
},
246+
{
247+
files: ['scripts/**'],
248+
rules: {
249+
'import-x/no-extraneous-dependencies': [
250+
'error',
251+
{ devDependencies: true },
252+
],
253+
},
254+
},
255+
256+
// misc rule overrides
257+
{
258+
rules: {
259+
'no-restricted-syntax': 0,
260+
'no-underscore-dangle': 0,
261+
'no-await-in-loop': 0,
262+
'no-plusplus': [2, { allowForLoopAfterthoughts: true }],
263+
'unicorn/prefer-top-level-await': 0, // top level await is not available in commonjs
264+
},
265+
},
266+
]);

infrastructure/terraform/components/acct/.tool-versions

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)