Skip to content

Commit

Permalink
chore: Extending "@guardian/tsconfig" in tsconfig (#838)
Browse files Browse the repository at this point in the history
* Update tsconfig

* Using "@guardian/tsconfig"

* Update getConsentState.ts

* Update .gitignore

* Changed rootDir

* Installed @guardian/tsconfig

* Installed @guardian/tsconfig in cdk

* Using "@guardian/tsconfig" in monitoring

* Update tsconfig.json

* Updated tsconfig.json

* Remove module or target

* Update tsconfig to use ES2020

* Reverting to use guardian/tsconfig

* Update tsconfig.json

* USing Common JS

* Create calm-foxes-happen.md

* Removed omment
  • Loading branch information
akinsola-guardian authored Nov 8, 2023
1 parent 6738e64 commit 6d390ce
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-foxes-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@guardian/consent-management-platform': patch
---

Updating TS Config.json (Patching to test changeset)
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ dist
/coverage
.idea/
test-page/dist
tsconfig.build.tsbuildinfo
tsconfig.tsbuildinfo
.rollup.cache

# Cypress Tests
cypress/dist
Expand Down
1 change: 1 addition & 0 deletions cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"devDependencies": {
"@guardian/eslint-config-typescript": "^6.0.1",
"@guardian/prettier": "^4.0.0",
"@guardian/tsconfig": "^0.2.0",
"@types/jest": "^29.5.3",
"@types/node": "20.4.2",
"aws-cdk": "2.87.0",
Expand Down
14 changes: 6 additions & 8 deletions cdk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
{
"extends": "@guardian/tsconfig",
"ts-node": {
"compilerOptions": {
"module": "CommonJS"
}
},
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"moduleResolution": "node",
"lib": ["ES2020"],
"declaration": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"esModuleInterop": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": false,
"inlineSourceMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"typeRoots": ["./node_modules/@types"],
"outDir": "dist"
"outDir": "dist",
"allowJs": true,
"isolatedModules": true,
"noEmit": true,
"removeComments": true,
},
"include": ["lib/**/*", "bin/**/*"],
"exclude": [
Expand Down
5 changes: 5 additions & 0 deletions cdk/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,11 @@
resolved "https://registry.yarnpkg.com/@guardian/prettier/-/prettier-4.0.0.tgz#1ad1d7d079194937bfd0107789dde7b0fb84fa11"
integrity sha512-JvvnDnI04NcmpuD2mF5ZXTWI7tand1pj1s33fh4JxHNAV00QXwTWZBI2/QWS3ck7KjpYjpRaz8CDUcMz35hReg==

"@guardian/tsconfig@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@guardian/tsconfig/-/tsconfig-0.2.0.tgz#b1dac8831d2ff7ac557229f350d4b2f8c9fc60b5"
integrity sha512-RauppalK+cQZDRK6IssVmDSnU/VyqMNuVOxPxhmI03kVRxEdwcmBuRqexHwDbnClVUxW/N9hYLbFNuAb9V/p+A==

"@humanwhocodes/config-array@^0.11.10":
version "0.11.10"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2"
Expand Down
3 changes: 1 addition & 2 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"extends": "@guardian/tsconfig",
"compilerOptions": {
"esModuleInterop": true,
"lib": ["ES2019", "DOM"],
"module": "commonjs",
"noEmit": true,
// https://github.com/cypress-io/cypress/issues/9298
"target": "ES2019",
"types": ["node", "cypress"],
"skipLibCheck": true,
"strict": true,
Expand Down
1 change: 1 addition & 0 deletions monitoring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@aws-sdk/client-lambda": "^3.369.0",
"@guardian/eslint-config-typescript": "^6.0.1",
"@guardian/prettier": "^4.0.0",
"@guardian/tsconfig": "^0.2.0",
"@tsconfig/node18": "^18.2.0",
"@types/aws-lambda": "^8.10.119",
"@types/inquirer": "^8.2.3",
Expand Down
2 changes: 2 additions & 0 deletions monitoring/src/check-page/common-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ export const checkCMPIsNotVisible = async (page: Page): Promise<void> => {
const computedStyle = window.getComputedStyle(element);
return computedStyle.getPropertyValue('display');
}

return null;
};

const display = await page.evaluate(
Expand Down
7 changes: 3 additions & 4 deletions monitoring/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"extends": "@guardian/tsconfig",
"include": ["./*.ts"],
"target": "es5",
"compilerOptions": {
"lib": ["DOM", "es2019"],
"moduleResolution": "node"
"moduleResolution": "node",
"module": "commonjs",
}
}
5 changes: 5 additions & 0 deletions monitoring/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,11 @@
resolved "https://registry.yarnpkg.com/@guardian/prettier/-/prettier-4.0.0.tgz#1ad1d7d079194937bfd0107789dde7b0fb84fa11"
integrity sha512-JvvnDnI04NcmpuD2mF5ZXTWI7tand1pj1s33fh4JxHNAV00QXwTWZBI2/QWS3ck7KjpYjpRaz8CDUcMz35hReg==

"@guardian/tsconfig@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@guardian/tsconfig/-/tsconfig-0.2.0.tgz#b1dac8831d2ff7ac557229f350d4b2f8c9fc60b5"
integrity sha512-RauppalK+cQZDRK6IssVmDSnU/VyqMNuVOxPxhmI03kVRxEdwcmBuRqexHwDbnClVUxW/N9hYLbFNuAb9V/p+A==

"@hapi/hoek@^9.0.0":
version "9.3.0"
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@guardian/libs": "15.0.0",
"@guardian/node-riffraff-artifact": "^0.3.2",
"@guardian/prettier": "^4.0.0",
"@guardian/tsconfig": "^0.2.0",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^25.0.1",
"@rollup/plugin-html": "^1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion src/tcfv2/getConsentState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const getConsentState: () => Promise<TCFv2ConsentState> = async () => {

const vendorConsents: TCFv2ConsentList = Object.keys(grants)
.sort()
.reduce((acc, cur) => ({ ...acc, [cur]: grants[cur].vendorGrant }), {});
.reduce((acc, cur) => ({ ...acc, [cur]: grants[cur]?.vendorGrant }), {});

return {
consents,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"emitDeclarationOnly": true,
"noEmit": false,
"outDir": "dist",
"rootDir": "src"
"rootDir": "./"
},
"files": ["src/index.ts"],
"include": ["src"]
Expand Down
6 changes: 1 addition & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"extends": "@guardian/tsconfig",
"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"isolatedModules": true,
"module": "ES6",
"moduleResolution": "node",
"noEmit": true,
"removeComments": true,
"strict": true,
"target": "ES2020"
},
"include": ["*.js", "src", ".eslintrc.js"]
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1535,6 +1535,11 @@
resolved "https://registry.yarnpkg.com/@guardian/prettier/-/prettier-4.0.0.tgz#1ad1d7d079194937bfd0107789dde7b0fb84fa11"
integrity sha512-JvvnDnI04NcmpuD2mF5ZXTWI7tand1pj1s33fh4JxHNAV00QXwTWZBI2/QWS3ck7KjpYjpRaz8CDUcMz35hReg==

"@guardian/tsconfig@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@guardian/tsconfig/-/tsconfig-0.2.0.tgz#b1dac8831d2ff7ac557229f350d4b2f8c9fc60b5"
integrity sha512-RauppalK+cQZDRK6IssVmDSnU/VyqMNuVOxPxhmI03kVRxEdwcmBuRqexHwDbnClVUxW/N9hYLbFNuAb9V/p+A==

"@hapi/hoek@^9.0.0":
version "9.3.0"
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb"
Expand Down

1 comment on commit 6d390ce

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 92.45% 245/265
🟢 Branches 83.19% 94/113
🟢 Functions 90% 63/70
🟢 Lines 92.19% 236/256

Test suite run success

328 tests passing in 16 suites.

Report generated by 🧪jest coverage report action from 6d390ce

Please sign in to comment.