Skip to content

Commit 2a349e3

Browse files
committed
feat: Convert entire codebase from JavaScript to TypeScript
- Converted all 69 JavaScript files to TypeScript/TSX - Added proper type annotations to utility functions, constants, and config files - Disabled allowJs in tsconfig.json to prevent new JS files from being created - Updated tsconfig.json to exclude .js files from include patterns - Converted module.exports to ES6 exports where applicable - Added TypeScript interfaces for complex objects (Partners, SuccessStories, etc.) - Added proper function signatures with parameter and return types Files converted: - common/config (2 files) - common/constants (5 files) - common/styles (2 files) - common/utils (14 files including tests) - components (10 files) - cypress (8 files) - decorators (2 files) - config files (7 files) - scripts (4 files) - test-utils (16 files) Note: Some linting errors remain and will be fixed in follow-up commits 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3f60873 commit 2a349e3

76 files changed

Lines changed: 159 additions & 122 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
/*
22
* This file should only contain environment variables that are non-secret.
33
*/
4-
const isProduction = process.env.PRODUCTION_DEPLOYMENT === 'true';
4+
const isProduction: boolean = process.env.PRODUCTION_DEPLOYMENT === 'true';
5+
6+
interface ClientTokens {
7+
GOOGLE_ADS_ID: string;
8+
GOOGLE_ANALYTICS_ID: string;
9+
GOOGLE_TAG_MANAGER_ID: string;
10+
OC_FACEBOOK_KEY: string;
11+
OC_GOOGLE_KEY: string;
12+
SENTRY_DSN: string;
13+
}
514

615
// These are all exposed by the client, so there's no way to protect them anyways.
7-
export const clientTokens = isProduction
16+
export const clientTokens: ClientTokens = isProduction
817
? {
918
GOOGLE_ADS_ID: 'AW-868714671',
1019
GOOGLE_ANALYTICS_ID: 'G-5QSQ208NW6',
@@ -24,18 +33,18 @@ export const clientTokens = isProduction
2433
};
2534

2635
// TODO: Use GH Actions to enable environment-based deploys and stop using prod on PR deploys
27-
export const apiUrl = isProduction
36+
export const apiUrl: string = isProduction
2837
? 'https://api.operationcode.org'
2938
: 'https://api.staging.operationcode.org';
3039

31-
export const resourcesAPIURL = isProduction
40+
export const resourcesAPIURL: string = isProduction
3241
? 'https://resources.operationcode.org'
3342
: 'https://resources.staging.operationcode.org';
3443

35-
export const slackMembersAPIUrl = 'https://slack.com/api/conversations.members';
36-
export const slackGeneralChannelId = 'C03GSNF6X';
44+
export const slackMembersAPIUrl: string = 'https://slack.com/api/conversations.members';
45+
export const slackGeneralChannelId: string = 'C03GSNF6X';
3746

38-
export const AIR_TABLE_BASE_ID = 'app9tYjofmFWMxRl8';
39-
export const AIR_TABLE_TABLE_NAME = isProduction
47+
export const AIR_TABLE_BASE_ID: string = 'app9tYjofmFWMxRl8';
48+
export const AIR_TABLE_TABLE_NAME: string = isProduction
4049
? 'Onboarding Request PRODUCTION'
4150
: 'Onboarding Request STAGING';
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
/* eslint-disable unicorn/prevent-abbreviations */
22
// Webpack is unable to use export default
3-
const svgoConfig = {
3+
4+
interface SVGOPlugin {
5+
name: string;
6+
params?: Record<string, any>;
7+
}
8+
9+
interface SVGOConfig {
10+
plugins: SVGOPlugin[];
11+
floatPrecision: number;
12+
}
13+
14+
const svgoConfig: SVGOConfig = {
415
plugins: [
516
{ name: 'cleanupIDs', params: { minify: true } },
617
{ name: 'cleanupListOfValues' },
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,16 @@ import airbnb from 'static/images/sponsors/airbnb_logo.png';
1515
export const PARTNER_TYPES = {
1616
PAID: 'PAID',
1717
KIND: 'IN-KIND',
18-
};
18+
} as const;
1919

20-
const partners = [
20+
interface Partner {
21+
name: string;
22+
logoSource: string;
23+
url: string;
24+
type: typeof PARTNER_TYPES.PAID | typeof PARTNER_TYPES.KIND;
25+
}
26+
27+
const partners: Partner[] = [
2128
{
2229
name: 'APEX Systems',
2330
logoSource: `${s3}partnerLogos/apex_systems.png`,
@@ -137,4 +144,6 @@ const partners = [
137144
{ name: 'Airbnb', logoSource: airbnb.src, url: 'https://airbnb.com', type: PARTNER_TYPES.KIND },
138145
];
139146

140-
export default sortBy(partners, 'name');
147+
const sortedPartners: Partner[] = sortBy(partners, 'name');
148+
149+
export default sortedPartners;
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { s3 } from 'common/constants/urls';
22

3-
const successStories = [
3+
interface SuccessStory {
4+
title: string;
5+
quote: string;
6+
imageSource: string;
7+
}
8+
9+
const successStories: SuccessStory[] = [
410
{
511
title: 'Ali Cipolla-Taylor, Talent Acquisition at Microsoft',
612
quote:

common/constants/unitsOfTime.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

common/constants/unitsOfTime.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// In seconds
2+
export const ONE_DAY: number = 86400;
3+
export const ONE_WEEK: number = 604800;
4+
export const TWO_WEEKS: number = 1209600;

common/constants/urls.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

common/constants/urls.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const s3hostName: string = 'operation-code-assets.s3.us-east-2.amazonaws.com';
2+
const s3: string = `https://${s3hostName}/`;
3+
const leadershipCircleLink: string = 'https://secure.lglforms.com/form_engine/s/L428AQ2rrsFJQyy5Fbglvg';
4+
const codeOfConduct: string = `https://github.com/OperationCode/operationcode_docs/blob/master/community/code_of_conduct.md`;
5+
const slackGuidelines: string = `https://github.com/OperationCode/START_HERE/blob/master/community_guidelines.md`;
6+
7+
export { s3hostName, s3, leadershipCircleLink, codeOfConduct, slackGuidelines };

0 commit comments

Comments
 (0)