Skip to content

Commit

Permalink
upgrade typescript, react, eslint
Browse files Browse the repository at this point in the history
Signed-off-by: Kiss Miklos <[email protected]>
  • Loading branch information
kissmikijr committed Feb 24, 2024
1 parent 63fd858 commit b5cbf18
Show file tree
Hide file tree
Showing 68 changed files with 255 additions and 671 deletions.
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,25 @@
"start-backend": "yarn workspace backend start",
"start-backend:ci": "yarn workspace backend backstage-cli package build && node packages/backend",
"start:ci": "concurrently \"yarn start\" \"yarn start-backend:ci\"",
"build": "lerna run build",
"build": "backstage-cli repo build --all",
"build-image": "yarn workspace backend build-image",
"tsc": "tsc",
"tsc:full": "tsc --skipLibCheck false --incremental false",
"clean": "backstage-cli clean && lerna run clean",
"diff": "lerna run diff --",
"test": "yarn backstage-cli repo test --workerIdleMemoryLimit=800M --coverage --runInBand",
"test:all": "lerna run test -- --coverage --runInBand",
"lint": "lerna run lint --since origin/main --",
"lint": "backstage-cli repo lint --since origin/main",
"lint:all": "lerna run lint --",
"create-plugin": "backstage-cli create-plugin --scope roadiehq --no-private",
"remove-plugin": "backstage-cli remove-plugin",
"release": "changeset version && yarn prettier --write '{packages,plugins}/*/{package.json,CHANGELOG.md}' && yarn install",
"prepare": "husky install"
},
"resolutions": {
"@types/react": "^18",
"@types/react-dom": "^18"
},
"workspaces": {
"packages": [
"packages/*",
Expand All @@ -35,17 +39,19 @@
]
},
"devDependencies": {
"@backstage/cli": "^0.25.1",
"@backstage/cli": "^0.25.0",
"@spotify/prettier-config": "^14.0.0",
"@types/webpack": "^5.28.0",
"concurrently": "^7.0.0",
"eslint": "^8.6.0",
"eslint-plugin-notice": "^0.9.10",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-unused-imports": "^3.1.0",
"husky": "^8.0.1",
"lerna": "^6.0.0",
"lint-staged": "^13.0.3",
"prettier": "^2.3.2",
"typescript": "~4.7.0"
"typescript": "~5.2.0"
},
"prettier": "@spotify/prettier-config",
"dependencies": {
Expand Down
7 changes: 3 additions & 4 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"@roadiehq/backstage-plugin-travis-ci": "^2.1.11",
"@roadiehq/plugin-scaffolder-frontend-module-http-request-field": "^1.3.12",
"history": "^5.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.0.2",
"react-dom": "^18.0.2",
"react-router": "6.0.0-beta.0",
"react-router-dom": "6.0.0-beta.0",
"react-use": "^15.3.3"
Expand All @@ -61,9 +61,8 @@
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
"@types/jest": "^26.0.7",
"@types/node": "^14.14.32",
"@types/react-dom": "^16.9.8",
"@types/react-dom": "^18",
"cross-env": "^7.0.0",
"cypress": "^7.3.0",
"eslint-plugin-cypress": "^2.10.3",
Expand Down
3 changes: 1 addition & 2 deletions plugins/backend/backstage-aws-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
"@backstage/cli": "^0.25.0",
"@types/supertest": "^2.0.8",
"supertest": "^4.0.2",
"aws-sdk-client-mock": "^0.6.2",
"ts-jest": "^26.1.0"
"aws-sdk-client-mock": "^0.6.2"
},
"files": [
"dist",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@
},
"devDependencies": {
"@backstage/cli": "^0.25.0",
"jest-mock": "^29.0.0",
"@types/supertest": "^2.0.8",
"jest-fetch-mock": "^3.0.3",
"supertest": "^4.0.2",
"ts-jest": "^26.1.0"
"ts-jest": "^29.0.0"
},
"files": [
"dist",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import {
} from './argocdTestResponses';
import fetchMock from 'jest-fetch-mock';
import { timer } from './timer.services';
import { mocked } from 'ts-jest/utils';
import { Logger } from 'winston';
import { ResourceItem, UpdateArgoProjectAndAppProps } from './types';
import { mocked } from 'jest-mock';

fetchMock.enableMocks();
jest.mock('./timer.services');
jest.mock('./timer.services', () => ({
timer: jest.fn(),
}));
const loggerMock = {
error: jest.fn(),
info: jest.fn(),
Expand Down Expand Up @@ -1207,8 +1209,8 @@ describe('ArgoCD service', () => {
expect(resp).toEqual(
expect.objectContaining({ metadata: { name: 'application' } }),
);
expect(fetchMock).toBeCalledTimes(1);
expect(fetchMock).toBeCalledWith(
expect(fetchMock).toHaveBeenCalledTimes(1);
expect(fetchMock).toHaveBeenCalledWith(
'https://argoInstance1.com/api/v1/applications/application',
expect.objectContaining({ headers: { Authorization: 'Bearer token' } }),
);
Expand Down Expand Up @@ -1258,7 +1260,7 @@ describe('ArgoCD service', () => {
}),
).rejects.toEqual('Unauthorized');

expect(mockGetArgoToken).toBeCalledTimes(1);
expect(mockGetArgoToken).toHaveBeenCalledTimes(1);
});

it('fails because unauthorized to get application information', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import request from 'supertest';
import { getVoidLogger } from '@backstage/backend-common';
import fetchMock from 'jest-fetch-mock';
import { timer } from './timer.services';
import { mocked } from 'ts-jest/utils';
import { mocked } from 'jest-mock';

const mockDeleteApp = jest.fn();
const mockDeleteProject = jest.fn();
Expand Down
4 changes: 1 addition & 3 deletions plugins/backend/backstage-plugin-aws-auth/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
module.exports = {
extends: [require.resolve('@backstage/cli/config/eslint.backend')],
};
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ describe('aws-api', () => {
mockResponse(),
);

expect((await response).json).toBeCalledWith(credentialsStub);
expect(generateTemporaryCredentialsMock).toBeCalledWith(
expect((await response).json).toHaveBeenCalledWith(credentialsStub);
expect(generateTemporaryCredentialsMock).toHaveBeenCalledWith(
keyIdStub,
keySecretStub,
undefined,
Expand All @@ -90,8 +90,8 @@ describe('aws-api', () => {
mockResponse(),
);

expect((await response).json).toBeCalledWith(credentialsStub);
expect(generateTemporaryCredentialsMock).toBeCalledWith(
expect((await response).json).toHaveBeenCalledWith(credentialsStub);
expect(generateTemporaryCredentialsMock).toHaveBeenCalledWith(
keyIdStub,
keySecretStub,
roleArnStub,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('AWSEKSClusterProvider', () => {
const provider = AWSEKSClusterProvider.fromConfig(config, { logger });
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: [],
});
Expand Down Expand Up @@ -93,7 +93,7 @@ describe('AWSEKSClusterProvider', () => {
const provider = AWSEKSClusterProvider.fromConfig(config, { logger });
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: [
expect.objectContaining({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('AWSIAMRoleProvider', () => {
const provider = AWSIAMRoleProvider.fromConfig(config, { logger });
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: [],
});
Expand Down Expand Up @@ -84,7 +84,7 @@ describe('AWSIAMRoleProvider', () => {
const provider = AWSIAMRoleProvider.fromConfig(config, { logger });
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: [
expect.objectContaining({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('AWSIAMUserProvider', () => {
const provider = AWSIAMUserProvider.fromConfig(config, { logger });
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: [],
});
Expand Down Expand Up @@ -84,7 +84,7 @@ describe('AWSIAMUserProvider', () => {
const provider = AWSIAMUserProvider.fromConfig(config, { logger });
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: [
expect.objectContaining({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('AWSLambdaFunctionProvider', () => {
const provider = AWSLambdaFunctionProvider.fromConfig(config, { logger });
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: [],
});
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('AWSLambdaFunctionProvider', () => {
const provider = AWSLambdaFunctionProvider.fromConfig(config, { logger });
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: [
expect.objectContaining({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('AWSS3BucketProvider', () => {
const provider = AWSS3BucketProvider.fromConfig(config, { logger });
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: [],
});
Expand All @@ -83,7 +83,7 @@ describe('AWSS3BucketProvider', () => {
const provider = AWSS3BucketProvider.fromConfig(config, { logger });
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: [
expect.objectContaining({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('OktaEntityProvider', () => {
});
provider.getClient('http://someorg', ['okta.users.read']);

expect(Client).toBeCalledWith({
expect(Client).toHaveBeenCalledWith({
orgUrl: 'http://someorg',
token: 'secret',
});
Expand All @@ -75,7 +75,7 @@ describe('OktaEntityProvider', () => {
});
provider.getClient('http://someorg', ['okta.users.read']);

expect(Client).toBeCalledWith({
expect(Client).toHaveBeenCalledWith({
authorizationMode: 'PrivateKey',
clientId: 'theclientid',
keyId: 'thekeyid',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('OktaGroupProvider', () => {
const provider = OktaGroupEntityProvider.fromConfig(config, { logger });
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: [],
});
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('OktaGroupProvider', () => {
});
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: expect.arrayContaining([
expect.objectContaining({
Expand Down Expand Up @@ -186,7 +186,7 @@ describe('OktaGroupProvider', () => {
const provider = OktaGroupEntityProvider.fromConfig(config, { logger });
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: expect.arrayContaining([
expect.objectContaining({
Expand Down Expand Up @@ -229,7 +229,7 @@ describe('OktaGroupProvider', () => {
});
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: expect.arrayContaining([
expect.objectContaining({
Expand Down Expand Up @@ -259,7 +259,7 @@ describe('OktaGroupProvider', () => {
});
await provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: expect.arrayContaining([
expect.objectContaining({
Expand Down Expand Up @@ -290,7 +290,7 @@ describe('OktaGroupProvider', () => {
});
await provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: expect.arrayContaining([
expect.objectContaining({
Expand Down Expand Up @@ -325,7 +325,7 @@ describe('OktaGroupProvider', () => {
});
await provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: expect.arrayContaining([
expect.objectContaining({
Expand Down Expand Up @@ -371,7 +371,7 @@ describe('OktaGroupProvider', () => {
});
await provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: expect.arrayContaining([
expect.objectContaining({
Expand Down Expand Up @@ -416,7 +416,7 @@ describe('OktaGroupProvider', () => {
});
await provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: [],
});
Expand All @@ -437,7 +437,7 @@ describe('OktaGroupProvider', () => {
});
await provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: expect.arrayContaining([
expect.objectContaining({
Expand Down Expand Up @@ -484,7 +484,7 @@ describe('OktaGroupProvider', () => {
});
provider.connect(entityProviderConnection);
await provider.run();
expect(entityProviderConnection.applyMutation).toBeCalledWith({
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: expect.arrayContaining([
expect.objectContaining({
Expand Down
Loading

0 comments on commit b5cbf18

Please sign in to comment.