Skip to content
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

Update typescript setup #1542

Merged
merged 13 commits into from
Jun 17, 2024
5 changes: 5 additions & 0 deletions .changeset/fresh-poems-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@guardian/source-development-kitchen': patch
---

Replace use of deprecated `ArticlePillar` with `Pillar` from `@guardian/libs`.
8 changes: 8 additions & 0 deletions .changeset/serious-bulldogs-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@guardian/source-development-kitchen': major
'@guardian/source': major
---

Now has a peer dependency of `@emotion/react@^11.11.3` (from `^11.11.1`).

Fixes conflicting types between Emotion's deps, as outlined in https://github.com/emotion-js/emotion/pull/3141.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
matrix:
include:
- task: formatting:check
- task: tsc
- task: lint
- task: test
- task: e2e
Expand Down
72 changes: 71 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,15 @@ fix: install
@corepack pnpm -r fix
@corepack pnpm prettier --ignore-unknown --cache --write .

# type-checking all projects
.PHONY: tsc
tsc: install
$(call log,"Checking types across all projects")
@corepack pnpm -r tsc

# makes sure absolutely everything is working
.PHONY: validate
validate: env lint test e2e build verify-dist build-storybook
validate: env tsc lint test e2e build verify-dist build-storybook

##################################### BUILD ####################################

Expand Down Expand Up @@ -157,6 +163,10 @@ install: check-node-version
@guardian/ab-core\:test: env
@corepack pnpm --filter @guardian/ab-core test

.PHONY: @guardian/ab-core\:tsc
@guardian/ab-core\:tsc: env
@corepack pnpm --filter @guardian/ab-core tsc

.PHONY: @guardian/ab-core\:verify-dist
@guardian/ab-core\:verify-dist: env
@corepack pnpm --filter @guardian/ab-core verify-dist
Expand All @@ -181,6 +191,10 @@ install: check-node-version
@guardian/ab-react\:test: env
@corepack pnpm --filter @guardian/ab-react test

.PHONY: @guardian/ab-react\:tsc
@guardian/ab-react\:tsc: env
@corepack pnpm --filter @guardian/ab-react tsc

.PHONY: @guardian/ab-react\:verify-dist
@guardian/ab-react\:verify-dist: env
@corepack pnpm --filter @guardian/ab-react verify-dist
Expand All @@ -193,6 +207,10 @@ install: check-node-version
@guardian/browserslist-config\:lint: env
@corepack pnpm --filter @guardian/browserslist-config lint

.PHONY: @guardian/browserslist-config\:tsc
@guardian/browserslist-config\:tsc: env
@corepack pnpm --filter @guardian/browserslist-config tsc

.PHONY: @guardian/browserslist-config\:update-readme
@guardian/browserslist-config\:update-readme: env
@corepack pnpm --filter @guardian/browserslist-config update-readme
Expand All @@ -205,6 +223,10 @@ install: check-node-version
@guardian/cobalt-plugin-ts\:lint: env
@corepack pnpm --filter @guardian/cobalt-plugin-ts lint

.PHONY: @guardian/cobalt-plugin-ts\:tsc
@guardian/cobalt-plugin-ts\:tsc: env
@corepack pnpm --filter @guardian/cobalt-plugin-ts tsc

.PHONY: @guardian/core-web-vitals\:build
@guardian/core-web-vitals\:build: env
@corepack pnpm --filter @guardian/core-web-vitals build
Expand All @@ -225,6 +247,10 @@ install: check-node-version
@guardian/core-web-vitals\:test: env
@corepack pnpm --filter @guardian/core-web-vitals test

.PHONY: @guardian/core-web-vitals\:tsc
@guardian/core-web-vitals\:tsc: env
@corepack pnpm --filter @guardian/core-web-vitals tsc

.PHONY: @guardian/core-web-vitals\:verify-dist
@guardian/core-web-vitals\:verify-dist: env
@corepack pnpm --filter @guardian/core-web-vitals verify-dist
Expand All @@ -241,6 +267,10 @@ install: check-node-version
@guardian/design-tokens\:lint: env
@corepack pnpm --filter @guardian/design-tokens lint

.PHONY: @guardian/design-tokens\:tsc
@guardian/design-tokens\:tsc: env
@corepack pnpm --filter @guardian/design-tokens tsc

.PHONY: @guardian/eslint-config\:fix
@guardian/eslint-config\:fix: env
@corepack pnpm --filter @guardian/eslint-config fix
Expand All @@ -249,6 +279,10 @@ install: check-node-version
@guardian/eslint-config\:lint: env
@corepack pnpm --filter @guardian/eslint-config lint

.PHONY: @guardian/eslint-config\:tsc
@guardian/eslint-config\:tsc: env
@corepack pnpm --filter @guardian/eslint-config tsc

.PHONY: @guardian/eslint-config-typescript\:fix
@guardian/eslint-config-typescript\:fix: env
@corepack pnpm --filter @guardian/eslint-config-typescript fix
Expand All @@ -257,6 +291,10 @@ install: check-node-version
@guardian/eslint-config-typescript\:lint: env
@corepack pnpm --filter @guardian/eslint-config-typescript lint

.PHONY: @guardian/eslint-config-typescript\:tsc
@guardian/eslint-config-typescript\:tsc: env
@corepack pnpm --filter @guardian/eslint-config-typescript tsc

.PHONY: @guardian/identity-auth\:build
@guardian/identity-auth\:build: env
@corepack pnpm --filter @guardian/identity-auth build
Expand All @@ -277,6 +315,10 @@ install: check-node-version
@guardian/identity-auth\:test: env
@corepack pnpm --filter @guardian/identity-auth test

.PHONY: @guardian/identity-auth\:tsc
@guardian/identity-auth\:tsc: env
@corepack pnpm --filter @guardian/identity-auth tsc

.PHONY: @guardian/identity-auth\:verify-dist
@guardian/identity-auth\:verify-dist: env
@corepack pnpm --filter @guardian/identity-auth verify-dist
Expand All @@ -301,6 +343,10 @@ install: check-node-version
@guardian/identity-auth-frontend\:test: env
@corepack pnpm --filter @guardian/identity-auth-frontend test

.PHONY: @guardian/identity-auth-frontend\:tsc
@guardian/identity-auth-frontend\:tsc: env
@corepack pnpm --filter @guardian/identity-auth-frontend tsc

.PHONY: @guardian/identity-auth-frontend\:verify-dist
@guardian/identity-auth-frontend\:verify-dist: env
@corepack pnpm --filter @guardian/identity-auth-frontend verify-dist
Expand Down Expand Up @@ -333,6 +379,10 @@ install: check-node-version
@guardian/libs\:test: env
@corepack pnpm --filter @guardian/libs test

.PHONY: @guardian/libs\:tsc
@guardian/libs\:tsc: env
@corepack pnpm --filter @guardian/libs tsc

.PHONY: @guardian/libs\:verify-dist
@guardian/libs\:verify-dist: env
@corepack pnpm --filter @guardian/libs verify-dist
Expand All @@ -353,6 +403,10 @@ install: check-node-version
@guardian/newsletter-types\:lint: env
@corepack pnpm --filter @guardian/newsletter-types lint

.PHONY: @guardian/newsletter-types\:tsc
@guardian/newsletter-types\:tsc: env
@corepack pnpm --filter @guardian/newsletter-types tsc

.PHONY: @guardian/prettier\:fix
@guardian/prettier\:fix: env
@corepack pnpm --filter @guardian/prettier fix
Expand All @@ -361,6 +415,10 @@ install: check-node-version
@guardian/prettier\:lint: env
@corepack pnpm --filter @guardian/prettier lint

.PHONY: @guardian/prettier\:tsc
@guardian/prettier\:tsc: env
@corepack pnpm --filter @guardian/prettier tsc

.PHONY: @guardian/source\:build
@guardian/source\:build: env
@corepack pnpm --filter @guardian/source build
Expand Down Expand Up @@ -397,6 +455,10 @@ install: check-node-version
@guardian/source\:test: env
@corepack pnpm --filter @guardian/source test

.PHONY: @guardian/source\:tsc
@guardian/source\:tsc: env
@corepack pnpm --filter @guardian/source tsc

.PHONY: @guardian/source\:verify-dist
@guardian/source\:verify-dist: env
@corepack pnpm --filter @guardian/source verify-dist
Expand Down Expand Up @@ -429,6 +491,10 @@ install: check-node-version
@guardian/source-development-kitchen\:test: env
@corepack pnpm --filter @guardian/source-development-kitchen test

.PHONY: @guardian/source-development-kitchen\:tsc
@guardian/source-development-kitchen\:tsc: env
@corepack pnpm --filter @guardian/source-development-kitchen tsc

.PHONY: @guardian/source-development-kitchen\:verify-dist
@guardian/source-development-kitchen\:verify-dist: env
@corepack pnpm --filter @guardian/source-development-kitchen verify-dist
Expand All @@ -445,6 +511,10 @@ github-pages\:dev: env
github-pages\:start: env
@corepack pnpm --filter github-pages start

.PHONY: github-pages\:tsc
github-pages\:tsc: env
@corepack pnpm --filter github-pages tsc

.PHONY: storybooks\:dev
storybooks\:dev: env
@corepack pnpm --filter storybooks dev
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Tasks that apply to all projects are defined in the [`Makefile`](./Makefile):
- `make ls` _lists available `make` targets_
- `make storybooks` _runs storybook for all projects in single instance_
- `make test` _runs the unit tests for all projects_
- `make tsc` _type-checking all projects_
- `make validate` _makes sure absolutely everything is working_
- `make verify-dist` _runs unit tests against dist for all projects_

Expand All @@ -77,6 +78,7 @@ Project-specific tasks are defined as `scripts` in their `package.json`, and can
- `make @guardian/ab-core:fix`
- `make @guardian/ab-core:lint`
- `make @guardian/ab-core:test`
- `make @guardian/ab-core:tsc`
- `make @guardian/ab-core:verify-dist`

#### @guardian/ab-react
Expand All @@ -86,18 +88,21 @@ Project-specific tasks are defined as `scripts` in their `package.json`, and can
- `make @guardian/ab-react:fix`
- `make @guardian/ab-react:lint`
- `make @guardian/ab-react:test`
- `make @guardian/ab-react:tsc`
- `make @guardian/ab-react:verify-dist`

#### @guardian/browserslist-config

- `make @guardian/browserslist-config:fix`
- `make @guardian/browserslist-config:lint`
- `make @guardian/browserslist-config:tsc`
- `make @guardian/browserslist-config:update-readme`

#### @guardian/cobalt-plugin-ts

- `make @guardian/cobalt-plugin-ts:fix`
- `make @guardian/cobalt-plugin-ts:lint`
- `make @guardian/cobalt-plugin-ts:tsc`

#### @guardian/core-web-vitals

Expand All @@ -106,23 +111,27 @@ Project-specific tasks are defined as `scripts` in their `package.json`, and can
- `make @guardian/core-web-vitals:fix`
- `make @guardian/core-web-vitals:lint`
- `make @guardian/core-web-vitals:test`
- `make @guardian/core-web-vitals:tsc`
- `make @guardian/core-web-vitals:verify-dist`

#### @guardian/design-tokens

- `make @guardian/design-tokens:build`
- `make @guardian/design-tokens:fix`
- `make @guardian/design-tokens:lint`
- `make @guardian/design-tokens:tsc`

#### @guardian/eslint-config

- `make @guardian/eslint-config:fix`
- `make @guardian/eslint-config:lint`
- `make @guardian/eslint-config:tsc`

#### @guardian/eslint-config-typescript

- `make @guardian/eslint-config-typescript:fix`
- `make @guardian/eslint-config-typescript:lint`
- `make @guardian/eslint-config-typescript:tsc`

#### @guardian/identity-auth

Expand All @@ -131,6 +140,7 @@ Project-specific tasks are defined as `scripts` in their `package.json`, and can
- `make @guardian/identity-auth:fix`
- `make @guardian/identity-auth:lint`
- `make @guardian/identity-auth:test`
- `make @guardian/identity-auth:tsc`
- `make @guardian/identity-auth:verify-dist`

#### @guardian/identity-auth-frontend
Expand All @@ -140,6 +150,7 @@ Project-specific tasks are defined as `scripts` in their `package.json`, and can
- `make @guardian/identity-auth-frontend:fix`
- `make @guardian/identity-auth-frontend:lint`
- `make @guardian/identity-auth-frontend:test`
- `make @guardian/identity-auth-frontend:tsc`
- `make @guardian/identity-auth-frontend:verify-dist`

#### @guardian/libs
Expand All @@ -151,6 +162,7 @@ Project-specific tasks are defined as `scripts` in their `package.json`, and can
- `make @guardian/libs:fix`
- `make @guardian/libs:lint`
- `make @guardian/libs:test`
- `make @guardian/libs:tsc`
- `make @guardian/libs:verify-dist`

#### @guardian/newsletter-types
Expand All @@ -159,11 +171,13 @@ Project-specific tasks are defined as `scripts` in their `package.json`, and can
- `make @guardian/newsletter-types:dev`
- `make @guardian/newsletter-types:fix`
- `make @guardian/newsletter-types:lint`
- `make @guardian/newsletter-types:tsc`

#### @guardian/prettier

- `make @guardian/prettier:fix`
- `make @guardian/prettier:lint`
- `make @guardian/prettier:tsc`

#### @guardian/source

Expand All @@ -176,6 +190,7 @@ Project-specific tasks are defined as `scripts` in their `package.json`, and can
- `make @guardian/source:lint`
- `make @guardian/source:storybook`
- `make @guardian/source:test`
- `make @guardian/source:tsc`
- `make @guardian/source:verify-dist`

#### @guardian/source-development-kitchen
Expand All @@ -187,13 +202,15 @@ Project-specific tasks are defined as `scripts` in their `package.json`, and can
- `make @guardian/source-development-kitchen:lint`
- `make @guardian/source-development-kitchen:storybook`
- `make @guardian/source-development-kitchen:test`
- `make @guardian/source-development-kitchen:tsc`
- `make @guardian/source-development-kitchen:verify-dist`

#### github-pages

- `make github-pages:build`
- `make github-pages:dev`
- `make github-pages:start`
- `make github-pages:tsc`

#### storybooks

Expand Down
15 changes: 14 additions & 1 deletion apps/github-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"build": "wireit",
"dev": "wireit",
"start": "wireit"
"start": "wireit",
"tsc": "wireit"
},
"devDependencies": {
"@astrojs/check": "0.7.0",
Expand Down Expand Up @@ -54,6 +55,18 @@
"files": [
"dist/**"
]
},
"tsc": {
"command": "tsc --pretty",
"files": [
"src/**/*",
"tsconfig.json",
"../../libs/@guardian/tsconfig/tsconfig.json",
"../../@types/**",
"../../tsconfig.base.json",
"!(dist)/**"
],
"output": []
}
}
}
7 changes: 1 addition & 6 deletions configs/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ export const config = {
testPathIgnorePatterns: ['/node_modules/', '/.wireit/'],
transformIgnorePatterns: ['node_modules/.pnpm/(?!@guardian)'],
transform: {
'^.+\\.[tj]sx?$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
},
],
'^.+\\.[tj]sx?$': ['ts-jest'],
},
};
2 changes: 1 addition & 1 deletion configs/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@babel/preset-react": "7.24.1",
"@babel/preset-typescript": "7.24.1",
"@emotion/babel-plugin": "11.11.0",
"@emotion/react": "11.11.1",
"@emotion/react": "11.11.3",
"@guardian/source": "workspace:*",
"@storybook/addon-a11y": "8.0.5",
"@storybook/addon-docs": "8.0.5",
Expand Down
Loading
Loading