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

[AXON-34] Update TSC to latest and fix all compilation errors #140

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions e2e/tsconfig.e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"baseUrl": ".",
"outDir": "../.generated",
"module": "CommonJS",
"target": "es6",
"lib": ["esnext", "dom"],
"target": "es2018",
"lib": ["es2018", "dom"],
"skipDefaultLibCheck": true,
"resolveJsonModule": true,
"skipLibCheck": true,
Expand All @@ -19,7 +19,6 @@
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"ignoreDeprecations": "5.0",
"noUnusedLocals": true,
"typeRoots": ["node_modules/@types", "src/typings/"]
Expand Down
1,559 changes: 885 additions & 674 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@
"ts-node": "^8.8.2",
"tsconfig-paths": "^3.9.0",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"typescript": "^5.4.0 <5.5.0",
"typescript": "^5.7.3",
"vsce": "^2.15.0",
"vscode-extension-tester": "^8.10.0",
"vue": "^3.2.23",
Expand Down
2 changes: 1 addition & 1 deletion src/atlclients/strategy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { strategyForProvider } from './strategy';
// it.each is not found without this:
import { it } from '@jest/globals';

const expectedData = {
const expectedData: any = {
bbcloud: {
provider: 'bbcloud',
authorizeUrl:
Expand Down
4 changes: 2 additions & 2 deletions src/bitbucket/bitbucket-cloud/pullRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const maxItemsSupported = {
};
export const defaultPagelen = 25;

const mergeStrategyLabels = {
const mergeStrategyLabels: Record<string, string> = {
merge_commit: 'Merge commit',
squash: 'Squash',
fast_forward: 'Fast forward',
Expand Down Expand Up @@ -251,7 +251,7 @@ export class CloudPullRequestApi implements PullRequestApi {
private isFileConflicted(diffType: string, diffStat: any, conflictData: any[]): boolean | undefined {
const oldPath = diffStat.old?.path;
const newPath = diffStat.new?.path;
return diffType === 'TOPIC' && conflictData.some((c) => c.path === newPath ?? oldPath);
return diffType === 'TOPIC' && conflictData.some((c) => c.path === newPath || oldPath);
}

private mapStatusWordsToFileStatus(status: string): FileStatus {
Expand Down
2 changes: 1 addition & 1 deletion src/bitbucket/bitbucket-server/pullRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class ServerPullRequestApi implements PullRequestApi {
}

async getListToReview(workspaceRepo: WorkspaceRepo): Promise<PaginatedPullRequests> {
const query = {
const query: Record<string, any> = {
'username.1': await this.userName(workspaceRepo),
'role.1': 'REVIEWER',
};
Expand Down
2 changes: 1 addition & 1 deletion src/bitbucket/httpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class HTTPClient {
let url = `${this.baseUrl}${urlSlug}`;
url = HTTPClient.addQueryParams(url, queryParams);

const headers = {
const headers: Record<string, string> = {
accept: 'application/octet-stream',
};

Expand Down
2 changes: 1 addition & 1 deletion src/bitbucket/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export interface FileDiff {
newPathDeletions: number[];
// maps destination file line number to source file line number to support Bitbucket server comments
// NOT using Map here as Map does not serialize to JSON
newPathContextMap: Object;
newPathContextMap: Record<string, number>;
};

// Indicates whether or not the file has a conflict. Only defined on topic diffs - recent (approx 2022 and forward) BB server diffs.
Expand Down
2 changes: 1 addition & 1 deletion src/feedback/pmfJSDSubmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getAgent, getAxiosInstance } from '../jira/jira-client/providers';
import { PMFData } from '../lib/ipc/models/common';
import { getFeedbackUser } from './feedbackUser';

const q1Choices = {
const q1Choices: Record<string, string> = {
'0': 'Very disappointed',
'1': 'Somewhat disappointed',
'2': 'Not disappointed',
Expand Down
2 changes: 1 addition & 1 deletion src/jira/jira-client/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const jiraBasicAuthProvider = (username: string, password: string): Autho
};

export const getAgent: AgentProvider = (site?: SiteInfo) => {
let agent = {};
let agent: Record<string, any> = {};
try {
if (site) {
if (site.customSSLCertPaths && site.customSSLCertPaths.trim() !== '') {
Expand Down
4 changes: 2 additions & 2 deletions src/react/atlascode/bbissue/BitbucketIssuePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ import UserPicker from './UserPicker';
import { AtlascodeErrorBoundary } from '../common/ErrorBoundary';
import { AnalyticsView } from 'src/analyticsTypes';

const priorityIcon = {
const priorityIcon: Record<string, JSX.Element> = {
trivial: <RadioButtonUncheckedIcon />,
minor: <ArrowDownwardIcon />,
major: <KeyboardArrowUpIcon />,
critical: <ArrowUpwardIcon />,
blocker: <BlockIcon />,
};

const typeIcon = {
const typeIcon: Record<string, JSX.Element> = {
bug: <BugReportIcon />,
enhancement: <ArrowUpwardIcon />,
proposal: <EmojiObjectsIcon />,
Expand Down
4 changes: 2 additions & 2 deletions src/react/atlascode/bbissue/CreateBitbucketIssuePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ import {
import { AtlascodeErrorBoundary } from '../common/ErrorBoundary';
import { AnalyticsView } from 'src/analyticsTypes';

const priorityIcon = {
const priorityIcon: Record<string, JSX.Element> = {
trivial: <RadioButtonUncheckedIcon />,
minor: <ArrowDownwardIcon />,
major: <KeyboardArrowUpIcon />,
critical: <ArrowUpwardIcon />,
blocker: <BlockIcon />,
};

const typeIcon = {
const typeIcon: Record<string, JSX.Element> = {
bug: <BugReportIcon />,
enhancement: <ArrowUpwardIcon />,
proposal: <EmojiObjectsIcon />,
Expand Down
2 changes: 1 addition & 1 deletion src/react/atlascode/bbissue/StatusMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type StatusMenuProps = {
variant?: 'filled' | 'outlined' | 'standard';
};

const StatusRenderer = {
const StatusRenderer: Record<string, JSX.Element> = {
new: <Lozenge appearance="new" label="new" />,
open: <Lozenge appearance="inprogress" label="open" />,
resolved: <Lozenge appearance="success" label="resolved" />,
Expand Down
8 changes: 4 additions & 4 deletions src/react/atlascode/common/form/useFormValidation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function useFormValidation<FieldTypes>(watch?: Partial<FieldTypes>): Form
if (field) {
if (Object.keys(watches.current).includes(field.inputRef.name)) {
needsReRender = true;
if (typeof watches.current[field.inputRef.name] === 'boolean') {
if (typeof (watches.current as any)[field.inputRef.name] === 'boolean') {
watches.current = {
...watches.current,
[field.inputRef.name]: (field.inputRef as HTMLInputElement).checked,
Expand All @@ -110,13 +110,13 @@ export function useFormValidation<FieldTypes>(watch?: Partial<FieldTypes>): Form

if (field.validator) {
const errString = await field.validator(field.inputRef.name, field.inputRef.value);
if (errors.current[field.inputRef.name] !== errString) {
if ((watches.current as any)[field.inputRef.name] !== errString) {
needsReRender = true;

if (errString) {
errors.current = { ...errors.current, [field.inputRef.name]: errString };
} else {
delete errors.current[field.inputRef.name];
delete (watches.current as any)[field.inputRef.name];
}
}
}
Expand All @@ -136,7 +136,7 @@ export function useFormValidation<FieldTypes>(watch?: Partial<FieldTypes>): Form
}

//TODO: add an option to validate all fields before submitting.
const fieldValues: Partial<FieldTypes> = {};
const fieldValues: any = {};
try {
for (const field of Object.values<FieldDescriptor>(fields)) {
if (field) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import React from 'react';
import { BitbucketIssue } from '../../../bitbucket/model';
import Lozenge from '../common/Lozenge';

const StatusRenderer = {
const StatusRenderer: Record<string, JSX.Element> = {
new: <Lozenge appearance="new" label="new" />,
open: <Lozenge appearance="inprogress" label="open" />,
resolved: <Lozenge appearance="success" label="resolved" />,
Expand Down
11 changes: 9 additions & 2 deletions src/react/index-dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,21 @@ import { atlascodeTheme } from './atlascode/theme/atlascodeTheme';
import { computeStyles, VSCodeStylesContext } from './vscode/theme/styles';
import { createVSCodeTheme } from './vscode/theme/vscodeTheme';

declare global {
// eslint-disable-next-line no-unused-vars
interface Window {
acquireVsCodeApi: () => any;
}
}

// @ts-ignore
// __webpack_public_path__ is used to set the public path for the js files - https://webpack.js.org/guides/public-path/
// eslint-disable-next-line no-var
declare var __webpack_public_path__: string;
// eslint-disable-next-line no-unused-vars
__webpack_public_path__ = `${document.baseURI!}build/`;

const routes = {
const routes: Record<string, any> = {
atlascodeSettingsV2: React.lazy(
() => import(/* webpackChunkName: "atlascodeSettingsV2" */ './atlascode/config/ConfigPage'),
),
Expand Down Expand Up @@ -47,7 +54,7 @@ const routes = {
),
};

const ports = {
const ports: Record<string, number> = {
atlascodeSettingsV2: UIWSPort.Settings,
atlascodeOnboardingV2: UIWSPort.Onboarding,
bitbucketIssuePageV2: UIWSPort.BitbucketIssuePage,
Expand Down
2 changes: 1 addition & 1 deletion src/react/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare var __webpack_public_path__: string;
// eslint-disable-next-line no-unused-vars
__webpack_public_path__ = `${document.baseURI!}build/`;

const routes = {
const routes: Record<string, any> = {
atlascodeSettingsV2: React.lazy(
() => import(/* webpackChunkName: "atlascodeSettingsV2" */ './atlascode/config/ConfigPage'),
),
Expand Down
2 changes: 1 addition & 1 deletion src/uninstall/uninstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { analyticsClient } from '../analytics-node-client/src/client.min.js';
import { v4 } from 'uuid';

class AnalyticsPlatform {
private static nodeJsPlatformMapping = {
private static nodeJsPlatformMapping: Record<string, string> = {
aix: 'desktop',
android: 'android',
darwin: 'mac',
Expand Down
2 changes: 1 addition & 1 deletion src/views/pipelines/Helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function descriptionForState(
truncateCommitMessage: boolean,
excludePipelinePrefix?: boolean,
): string {
const descriptionForResult = {
const descriptionForResult: Record<string, string> = {
pipeline_state_completed_successful: 'was successful',
pipeline_state_completed_failed: 'has failed',
pipeline_state_completed_error: 'has failed',
Expand Down
2 changes: 1 addition & 1 deletion src/views/pipelines/PipelinesMonitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { descriptionForState, generatePipelineTitle, shouldDisplay } from './Hel
import { BitbucketActivityMonitor } from '../BitbucketActivityMonitor';

export class PipelinesMonitor implements BitbucketActivityMonitor {
private _previousResults: Map<string, Pipeline[]> = new Map();
private _previousResults: Record<string, Pipeline[]> = {};

constructor(private _repositories: WorkspaceRepo[]) {}

Expand Down
2 changes: 1 addition & 1 deletion src/views/pullrequest/diffViewHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export interface PRFileDiffQueryParams extends FileDiffQueryParams {
commentThreads: Comment[][];
addedLines: number[];
deletedLines: number[];
lineContextMap: Object;
lineContextMap: Record<string, number>;
}

export function getInlineComments(allComments: Comment[]): Map<string, Comment[][]> {
Expand Down
2 changes: 1 addition & 1 deletion src/webviews/components/index-dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ declare var __webpack_public_path__: string;
// eslint-disable-next-line no-unused-vars
__webpack_public_path__ = `${document.baseURI!}build/`;

const routes = {
const routes: Record<string, any> = {
viewIssueScreen: React.lazy(() => import(/* webpackChunkName: "viewIssueScreen" */ './issue/JiraIssuePage')),
atlascodeCreateIssueScreen: React.lazy(
() => import(/* webpackChunkName: "atlascodeCreateIssueScreen" */ './issue/CreateIssuePage'),
Expand Down
2 changes: 1 addition & 1 deletion src/webviews/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ declare var __webpack_public_path__: string;
// eslint-disable-next-line no-unused-vars
__webpack_public_path__ = `${document.baseURI!}build/`;

const routes = {
const routes: Record<string, any> = {
viewIssueScreen: React.lazy(() => import(/* webpackChunkName: "viewIssueScreen" */ './issue/JiraIssuePage')),
atlascodeCreateIssueScreen: React.lazy(
() => import(/* webpackChunkName: "atlascodeCreateIssueScreen" */ './issue/CreateIssuePage'),
Expand Down
4 changes: 2 additions & 2 deletions src/webviews/components/issue/CreateIssuePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default class CreateIssuePage extends AbstractIssueEditorPage<Emit, Accep
handleSubmit = async (e: any) => {
const requiredFields = Object.values(this.state.fields).filter((field) => field.required);

const errs = {};
const errs: Record<string, string> = {};
requiredFields.forEach((field: FieldUI) => {
if (field.uiType === UIType.Worklog && this.state.fieldValues[`${field.key}.enabled`]) {
const timeSpent = this.state.fieldValues[`${field.key}.timeSpent`];
Expand Down Expand Up @@ -232,7 +232,7 @@ export default class CreateIssuePage extends AbstractIssueEditorPage<Emit, Accep
}

if (field.key.indexOf('.') > -1) {
let valObj = {};
let valObj: Record<string, string> = {};
const splits = field.key.split('.');
fieldkey = splits[0];
if (this.state.fieldValues[splits[0]]) {
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"baseUrl": ".",
"outDir": "build/extension",
"module": "esnext",
"target": "es6",
"lib": ["esnext", "dom"],
"target": "es2018",
"lib": ["es2018", "dom"],
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
Expand All @@ -18,7 +18,6 @@
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"ignoreDeprecations": "5.0",
"noUnusedLocals": true,
"typeRoots": ["node_modules/@types", "src/typings/"]
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.notest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"baseUrl": ".",
"outDir": "build/extension",
"module": "esnext",
"target": "es6",
"lib": ["esnext", "dom"],
"target": "es2018",
"lib": ["es2018", "dom"],
"skipLibCheck": true,
"sourceMap": true,
"allowJs": true,
Expand All @@ -18,7 +18,6 @@
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"typeRoots": ["node_modules/@types", "src/typings/"]
},
Expand Down
Loading