Skip to content

Commit

Permalink
Strictnullchecks 1 (#1140)
Browse files Browse the repository at this point in the history
* reduced nullable errors from 500ish files to 268 files

* reduced nullable errors from 500ish files to 260 files

* reduced nullable errors from 500ish files to errors to 170 errors in 70 files

* fix status badges types

* fix pipeline runs types

* fix active application overview

* fix active job-overview

* fix environment cards

* fix most other errors

* fix create-job-form

* fix react-async types

* fix default value

* map strict checks that are still falining (strictFunctionTypes and  noImplicitAny)

* enforce strictFunctionTypes (mostly)

* enforce strictFunctionTypes (mostly)

* enforce strictFunctionTypes, cleanup config

* wip noImplicitAny

* remove prop types

* enfore no implicit any

* enfore no implicit any

* revert changes to proxy

* bugfix config local

* Add forwardRef to externalLink, fix mergeconflic

* fix ExternalLink icon type

* fix ExternalLink icon type

* fix ExternalLink icon type

* update description

* update logic in restart job/batchjob

* fix valid regex and branch name

* let type of genericStatusBadge be undefined

* fix external dns certificates logic

* fix dev test, simplify logic

* fix dev test, simplify logic

* remove unneed ts-expect-error

* Update src/store/ms-graph-api.ts

Co-authored-by: Sergey Smolnikov <[email protected]>

* Update src/store/ms-graph-api.ts

Co-authored-by: Sergey Smolnikov <[email protected]>

* replace replica.created with replica.startTIme

---------

Co-authored-by: Sergey Smolnikov <[email protected]>
  • Loading branch information
Richard87 and satr authored Dec 2, 2024
1 parent bf44e58 commit 48b6fc1
Show file tree
Hide file tree
Showing 207 changed files with 1,648 additions and 2,490 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ gen-scan-api:
gen-log-api:
npm run "apigen:log"

.PHONY: gen-local-radix-log-api
gen-local-radix-log-api:
OVERRIDE_RADIX_LOG_API_SWAGGER_URL=http://localhost:8003/swagger/doc.json npm run "apigen:log"

.PHONY: gen-service-now-api
gen-service-now-api:
npm run "apigen:service-now"
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ services:
- radix
ports:
- "8000:8000" # In prod, this is served on port 443
depends_on:
- auth-state

# for use with development
auth-state:
Expand Down
24 changes: 20 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
"test": "vitest watch",
"test:no-watch": "vitest run",
"test:coverage": "vitest --coverage",
"lint": "biome check",
"lint": "biome check && tsc --noEmit --skipLibCheck",
"lint-fix": "biome check --write",
"lint-ts": "tsc --noEmit --skipLibCheck",
"lint:watch": "watch --color -n 1 biome lint --colors=force",
"lint-ts:watch": "tsc --noEmit --skipLibCheck --watch",
"lint-strict": "tsc --noEmit --skipLibCheck --strictNullChecks",
"deps": "npm run deps:license && npm run deps:stale",
"deps:license": "node scripts/deps-license-check.js",
"deps:stale": "node scripts/deps-stale-check.js",
Expand All @@ -40,9 +39,8 @@
"date-fns": "^4.1.0",
"http-status-codes": "^2.3.0",
"jdenticon": "^3.3.0",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"nanoid": "^5.0.7",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-google-charts": "^4.0.7",
Expand All @@ -63,7 +61,7 @@
"@remix-run/web-fetch": "^4.4.2",
"@rtk-query/codegen-openapi": "^1.2.0",
"@testing-library/react": "^16.0.1",
"@types/lodash": "^4.17.9",
"@types/lodash-es": "^4.17.9",
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"@types/react-router-dom": "^5.3.3",
Expand Down
2 changes: 1 addition & 1 deletion radixconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
CLUSTER_EGRESS_IPS: undefined # Comma separated list of IPs of all Public IP Prefixes assigned to the ClusterType (production, playground, development)
CLUSTER_INGRESS_IPS: undefined # Comma separated list of IPs of all Public IP Prefixes assigned to the ClusterType (production, playground, development)
OAUTH2_AUTHORITY: "https://login.microsoftonline.com/3aa4a235-b6e2-48d5-9195-7fcf05b459b0"
SERVICENOW_PROXY_SCOPES: "1b4a22f1-d4a1-4b6a-81b2-fd936daf1786/Application.Read"
SERVICENOW_PROXY_SCOPES: "1b4a22f1-d4a1-4b6a-81b2-fd936daf1786/Application.Read" # scopes must be seperated by comma
CLUSTER_OIDC_ISSUER_URL: ""
CMDB_CI_URL: "https://equinor.service-now.com/selfservice?id=form&table=cmdb_ci_business_app&sys_id={CIID}"
secrets:
Expand Down
8 changes: 0 additions & 8 deletions src/components/alert/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { clsx } from 'clsx';
import * as PropTypes from 'prop-types';
import type { FunctionComponent, PropsWithChildren, ReactNode } from 'react';

import './style.css';
Expand Down Expand Up @@ -36,10 +35,3 @@ export const Alert: FunctionComponent<PropsWithChildren<AlertProps>> = ({
)}
</div>
);

Alert.propTypes = {
children: PropTypes.node,
actions: PropTypes.node,
className: PropTypes.string,
type: PropTypes.oneOf<AlertType>(['info', 'success', 'warning', 'danger']),
};
14 changes: 0 additions & 14 deletions src/components/alerting/alerting-actions.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Button } from '@equinor/eds-core-react';
import * as PropTypes from 'prop-types';

import './style.css';
import type { AlertingConfig } from '../../store/radix-api';

Expand Down Expand Up @@ -66,15 +64,3 @@ export const AlertingActions = ({
</div>
);
};

AlertingActions.propTypes = {
isSaving: PropTypes.bool.isRequired,
isEdit: PropTypes.bool.isRequired,
config: PropTypes.object.isRequired as PropTypes.Validator<AlertingConfig>,

onSave: PropTypes.func.isRequired,
onCancel: PropTypes.func.isRequired,
onEdit: PropTypes.func.isRequired,
onEnable: PropTypes.func.isRequired,
onDisable: PropTypes.func.isRequired,
};
5 changes: 0 additions & 5 deletions src/components/alerting/alerting-overview.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Icon, Typography } from '@equinor/eds-core-react';
import { check_circle_outlined, warning_outlined } from '@equinor/eds-icons';
import * as PropTypes from 'prop-types';
import { Fragment, type FunctionComponent } from 'react';
import type { AlertingConfig } from '../../store/radix-api';

Expand Down Expand Up @@ -34,7 +33,3 @@ export const AlertingConfigStatus: FunctionComponent<{
</>
);
};

AlertingConfigStatus.propTypes = {
config: PropTypes.object.isRequired as PropTypes.Validator<AlertingConfig>,
};
13 changes: 8 additions & 5 deletions src/components/alerting/buildEditConfig.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { cloneDeep } from 'lodash';
import { cloneDeep } from 'lodash-es';
import type {
AlertingConfig,
ReceiverConfigMap,
UpdateAlertingConfig,
UpdateReceiverConfigSecretsMap,
} from '../../store/radix-api';

const buildReceiverSecrets = (receviers: ReceiverConfigMap) => {
const secretsConfig = {};
const secretsConfig: UpdateReceiverConfigSecretsMap = {};
if (!receviers) {
return secretsConfig;
}
Expand All @@ -25,8 +26,10 @@ export const buildEditConfig = (
config: AlertingConfig
): UpdateAlertingConfig => {
return {
alerts: cloneDeep(config.alerts),
receivers: cloneDeep(config.receivers),
receiverSecrets: buildReceiverSecrets(config.receivers),
alerts: config.alerts ? cloneDeep(config.alerts) : [],
receivers: config.receivers ? cloneDeep(config.receivers) : {},
receiverSecrets: config.receivers
? buildReceiverSecrets(config.receivers)
: {},
};
};
9 changes: 0 additions & 9 deletions src/components/alerting/edit-alerting.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { TextField } from '@equinor/eds-core-react';
import * as PropTypes from 'prop-types';
import type {
ChangeEvent,
Dispatch,
Expand Down Expand Up @@ -37,11 +36,3 @@ export const UpdateSlackReceivers: FunctionComponent<{
))}
</>
);

UpdateSlackReceivers.propTypes = {
alertingConfig: PropTypes.object
.isRequired as PropTypes.Validator<AlertingConfig>,
changedReceivers: PropTypes.object
.isRequired as PropTypes.Validator<ChangedReceivers>,
setChangedReceivers: PropTypes.func.isRequired,
};
11 changes: 1 addition & 10 deletions src/components/alerting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Icon, Typography } from '@equinor/eds-core-react';
import { info_circle } from '@equinor/eds-icons';
import * as PropTypes from 'prop-types';
import { useState } from 'react';

import { AlertingActions } from './alerting-actions';
Expand Down Expand Up @@ -36,7 +35,7 @@ export const Alerting = ({
{}
);
const onSave = async () => {
const config: UpdateAlertingConfig = buildEditConfig(alertingConfig);
const config = buildEditConfig(alertingConfig);
Object.entries(changedReceivers).forEach(([receiver, url]) => {
config.receiverSecrets[receiver] = { slackConfig: { webhookUrl: url } };
});
Expand Down Expand Up @@ -88,11 +87,3 @@ export const Alerting = ({
</div>
);
};

Alerting.propTypes = {
isSaving: PropTypes.bool.isRequired,
alertingConfig: PropTypes.object.isRequired,
enableAlerting: PropTypes.func.isRequired,
updateAlerting: PropTypes.func.isRequired,
disableAlerting: PropTypes.func.isRequired,
};
10 changes: 0 additions & 10 deletions src/components/app-config-ad-groups/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { AuthenticatedTemplate } from '@azure/msal-react';
import { Typography } from '@equinor/eds-core-react';
import * as PropTypes from 'prop-types';

import { ADGroups, type HandleAdGroupsChangeCB } from '../graph/adGroups';

import './style.css';

interface Props {
Expand Down Expand Up @@ -36,10 +33,3 @@ export const AppConfigAdGroups = ({
</AuthenticatedTemplate>
</div>
);

AppConfigAdGroups.propTypes = {
labeling: PropTypes.string.isRequired,
adGroups: PropTypes.arrayOf(PropTypes.string),
isDisabled: PropTypes.bool,
onChange: PropTypes.func.isRequired,
};
15 changes: 9 additions & 6 deletions src/components/app-config-ci/ci-popover.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import { Popover, Typography } from '@equinor/eds-core-react';
import { type FunctionComponent, useEffect } from 'react';
import { useEffect } from 'react';

import type { Application } from '../../store/service-now-api';
import { configVariables } from '../../utils/config';
import { ExternalLink } from '../link/external-link';

export interface ConfigurationItemPopoverProps {
open?: boolean;
open: boolean;
onClose: () => unknown;
anchorEl: HTMLElement;
anchorEl?: HTMLElement;
configurationItem: Application;
}

function urlStringForCI(id: string): string {
return configVariables.CMDB_CI_URL.replace(/{CIID}/g, encodeURIComponent(id));
}

export const ConfigurationItemPopover: FunctionComponent<
ConfigurationItemPopoverProps
> = ({ open, onClose, anchorEl, configurationItem }) => {
export const ConfigurationItemPopover = ({
open,
onClose,
anchorEl,
configurationItem,
}: ConfigurationItemPopoverProps) => {
const externalUrl = urlStringForCI(configurationItem.id);

useEffect(() => {
Expand Down
46 changes: 0 additions & 46 deletions src/components/app-config-ci/ci-select.tsx

This file was deleted.

Loading

0 comments on commit 48b6fc1

Please sign in to comment.