Skip to content

Commit

Permalink
Bump prettier from 2.8.8 to 3.1.1 (humanprotocol#1375)
Browse files Browse the repository at this point in the history
* Bump prettier from 2.8.8 to 3.1.1

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.1.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/prettier@2.8.8...3.1.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix lint warning

* fix test

* fix fortune test

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eric Lee <98655210+leric7@users.noreply.github.com>
Co-authored-by: Eric Lee <eric@hmt.ai>
  • Loading branch information
3 people authored Dec 19, 2023
1 parent 68d7151 commit 6830a31
Show file tree
Hide file tree
Showing 78 changed files with 247 additions and 221 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^27.1.5",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.0.0",
"husky": "^8.0.2",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^14.0.1",
"prettier": "^2.7.1",
"prettier": "^3.1.1",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typescript": "^4.9.3"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'node:fs';
import * as path from 'path';
import { NFTStorage } from 'nft.storage';
import sinon from 'sinon';
import { stub, restore } from 'sinon';
import tmp from 'tmp';
import { test, assert } from 'vitest';
import generateMerkleTree from '../generateMerkleTree';
Expand All @@ -25,7 +25,7 @@ test('generateMerkleTree should return a valid Merkle tree JSON', async () => {

// Mock NFTStorage.storeBlob method
const fakeCid = 'bafybeih42y6g7zkr76j6ax7z6wjc5d56xazsrtxzp6f7j6fsk67djnppmq';
sinon.stub(NFTStorage.prototype, 'storeBlob').resolves(fakeCid);
stub(NFTStorage.prototype, 'storeBlob').resolves(fakeCid);

const origin = 'https://example.com';

Expand All @@ -38,7 +38,7 @@ test('generateMerkleTree should return a valid Merkle tree JSON', async () => {

// Cleanup and restore the actual file system and NFTStorage.storeBlob method
fs.rmdirSync(tmpDir.name, { recursive: true });
sinon.restore();
restore();

// Assertions
assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ export const RequestData: FC<RequestDataProps> = ({
? 'Mining sFUEL'
: 'Sending tokens'
: network?.chainId === ChainId.SKALE
? 'Send sFUEL'
: 'Send me'}
? 'Send sFUEL'
: 'Send me'}
</Button>
</Grid>
<Grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const useHumanProtocolNews = () => {
image: data?.data?.attributes?.image?.data?.attributes?.url,
});
} catch (err) {
// eslint-disable-next-line no-console
console.log(err);
}
setIsLoading(false);
Expand Down
6 changes: 3 additions & 3 deletions packages/apps/dashboard/ui/src/pages/HowToHuman/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import howToHumanSvg from 'src/assets/how-to-human.svg';
import nextArrowSvg from 'src/assets/next-arrow.svg';
import prevArrowSvg from 'src/assets/prev-arrow.svg';
import { PageWrapper, ViewTitle } from 'src/components';
import HOW_TO_HUMAN_DATA from 'src/constants/how-to-human';
import { HOW_TO_HUMAN_DATA } from 'src/constants/how-to-human';

export const HowToHuman = () => {
const [value, setValue] = useState(0);
Expand Down Expand Up @@ -151,15 +151,15 @@ export const HowToHuman = () => {
sx={{ cursor: 'pointer' }}
onClick={() => setValue(Math.max(0, value - 1))}
>
<img src={prevArrowSvg} />
<img src={prevArrowSvg} alt="prev" />
</Box>
<Box
sx={{ cursor: 'pointer' }}
onClick={() =>
setValue(Math.min(HOW_TO_HUMAN_DATA.length - 1, value + 1))
}
>
<img src={nextArrowSvg} />
<img src={nextArrowSvg} alt="next" />
</Box>
</Box>
)}
Expand Down
3 changes: 2 additions & 1 deletion packages/apps/dashboard/ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import * as fs from 'fs';
import path from 'path';
import react from '@vitejs/plugin-react';
import dotenv from 'dotenv';
import * as dotenv from 'dotenv';
import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import generateMerkleTree from './scripts/generateMerkleTree';

dotenv.config();

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
return {
Expand Down
4 changes: 3 additions & 1 deletion packages/apps/faucet-server/src/services/web3.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import hmtAbi from '@human-protocol/core/abis/HMToken.json';
import Web3 from 'web3';
import { HttpProvider } from 'web3-core';

import { ChainId } from '../constants/networks';
import {
AnonymousParams,
Expand Down Expand Up @@ -48,7 +50,7 @@ export const sendFunds = async (
(await web3.eth.getChainId()).toString() === ChainId.SKALE.toString() &&
faucetAddress
) {
const currentProvider = web3.currentProvider as any;
const currentProvider = web3.currentProvider as HttpProvider;
const skalePOW = new AnonymousPoW({
rpcUrl: currentProvider.host,
} as AnonymousParams);
Expand Down
4 changes: 2 additions & 2 deletions packages/apps/fortune/exchange-oracle/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier": "^5.0.0",
"jest": "29.5.0",
"prettier": "^2.3.2",
"prettier": "^3.1.1",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "29.1.1",
Expand Down
10 changes: 5 additions & 5 deletions packages/apps/fortune/recording-oracle/src/common/config/s3.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ConfigType, registerAs } from '@nestjs/config';

export const s3Config = registerAs('s3', () => ({
endPoint: process.env.S3_ENDPOINT!,
port: +process.env.S3_PORT!,
accessKey: process.env.S3_ACCESS_KEY!,
secretKey: process.env.S3_SECRET_KEY!,
bucket: process.env.S3_BUCKET!,
endPoint: process.env.S3_ENDPOINT || '127.0.0.1',
port: +(process.env.S3_PORT || 9000),
accessKey: process.env.S3_ACCESS_KEY || '',
secretKey: process.env.S3_SECRET_KEY || '',
bucket: process.env.S3_BUCKET || '',
useSSL: process.env.S3_USE_SSL === 'true',
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { ConfigType, registerAs } from '@nestjs/config';

export const serverConfig = registerAs('server', () => ({
host: process.env.HOST!,
port: +process.env.PORT!,
sessionSecret: process.env.SESSION_SECRET!,
reputationOracleAddress: process.env.REPUTATION_ORACLE_ADDRESS!,
reputationOracleWebhookUrl: process.env.REPUTATION_ORACLE_WEBHOOK_URL!,
encryptionPrivateKey: process.env.ENCRYPTION_PRIVATE_KEY!,
encryptionPassphrase: process.env.ENCRYPTION_PASSPHRASE!,
host: process.env.HOST || 'localhost',
port: +(process.env.PORT || 5000),
sessionSecret: process.env.SESSION_SECRET || 'session_key',
reputationOracleAddress: process.env.REPUTATION_ORACLE_ADDRESS || '',
reputationOracleWebhookUrl:
process.env.REPUTATION_ORACLE_WEBHOOK_URL || 'http://localhost:4005',
encryptionPrivateKey: process.env.ENCRYPTION_PRIVATE_KEY || '',
encryptionPassphrase: process.env.ENCRYPTION_PASSPHRASE || '',
}));
export const serverConfigKey = serverConfig.KEY;
export type ServerConfigType = ConfigType<typeof serverConfig>;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ConfigType, registerAs } from '@nestjs/config';

export const web3Config = registerAs('web3', () => ({
web3PrivateKey: process.env.WEB3_PRIVATE_KEY!,
web3PrivateKey: process.env.WEB3_PRIVATE_KEY || '',
}));

export const web3ConfigKey = web3Config.KEY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export class GlobalExceptionsFilter implements ExceptionFilter {
exception instanceof HttpException
? exception.getResponse()
: exception instanceof Error
? exception.message
: 'Internal Server Error',
? exception.message
: 'Internal Server Error',
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,26 @@ export class SignatureAuthGuard implements CanActivate {
data.chainId,
data.escrowAddress,
);
if (this.role.includes(Role.JobLaucher))
oracleAdresses.push(escrowData.launcher!);
if (this.role.includes(Role.Exchange))
oracleAdresses.push(escrowData.exchangeOracle!);
if (this.role.includes(Role.Reputation))
oracleAdresses.push(escrowData.reputationOracle!);
if (this.role.includes(Role.JobLaucher) && escrowData.launcher?.length)
oracleAdresses.push(escrowData.launcher);
if (
this.role.includes(Role.Exchange) &&
escrowData.exchangeOracle?.length
)
oracleAdresses.push(escrowData.exchangeOracle);
if (
this.role.includes(Role.Reputation) &&
escrowData.reputationOracle?.length
)
oracleAdresses.push(escrowData.reputationOracle);

const isVerified = verifySignature(data, signature, oracleAdresses);

if (isVerified) {
return true;
}
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
}

Expand Down
1 change: 1 addition & 0 deletions packages/apps/fortune/recording-oracle/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ async function bootstrap() {
app.use(helmet());

await app.listen(port, host, async () => {
// eslint-disable-next-line no-console
console.info(`API server is running on http://${host}:${port}`);
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
import { ConfigModule, ConfigService, registerAs } from '@nestjs/config';
import { ConfigModule, registerAs } from '@nestjs/config';
import { Test } from '@nestjs/testing';
import { Web3Service } from './web3.service';
import {
MOCK_S3_ACCESS_KEY,
MOCK_S3_BUCKET,
MOCK_S3_ENDPOINT,
MOCK_S3_PORT,
MOCK_S3_SECRET_KEY,
MOCK_S3_USE_SSL,
MOCK_WEB3_PRIVATE_KEY,
} from '../../../test/constants';
import { MOCK_WEB3_PRIVATE_KEY } from '../../../test/constants';
import { networkMap } from '../../common/constants/networks';

describe('Web3Service', () => {
let web3Service: Web3Service;

beforeAll(async () => {
const configServiceMock = {
get: jest.fn().mockReturnValue(MOCK_WEB3_PRIVATE_KEY),
};

const moduleRef = await Test.createTestingModule({
imports: [
ConfigModule.forFeature(
Expand Down
4 changes: 2 additions & 2 deletions packages/apps/hufi/exchange-oracle/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier": "^5.0.0",
"jest": "29.5.0",
"prettier": "^2.3.2",
"prettier": "^3.1.1",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "29.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/apps/hufi/job-launcher/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier": "^5.0.0",
"jest": "29.5.0",
"prettier": "^2.3.2",
"prettier": "^3.1.1",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "29.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/apps/hufi/reputation-oracle/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier": "^5.0.0",
"express-session": "^1.17.3",
"jest": "29.5.0",
"prettier": "^2.3.2",
"prettier": "^3.1.1",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "29.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export const RegisterValidationSchema = Yup.object().shape({
password: Yup.string()
.required(ERROR_MESSAGES.requirePassword)
.matches(
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+={}\|'"/`[\]:;<>,.?~\\-]).*$/,
ERROR_MESSAGES.weakPassword
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+={}|'"/`[\]:;<>,.?~\\-]).*$/,
ERROR_MESSAGES.weakPassword,
)
.min(8, ERROR_MESSAGES.invalidPasswordLength)
.max(255, ERROR_MESSAGES.invalidPasswordMaxLength),
Expand All @@ -38,8 +38,8 @@ export const ResetPasswordValidationSchema = Yup.object().shape({
password: Yup.string()
.required(ERROR_MESSAGES.requirePassword)
.matches(
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+={}\|'"/`[\]:;<>,.?~\\-]).*$/,
ERROR_MESSAGES.weakPassword
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+={}|'"/`[\]:;<>,.?~\\-]).*$/,
ERROR_MESSAGES.weakPassword,
)
.min(8, ERROR_MESSAGES.invalidPasswordLength)
.max(255, ERROR_MESSAGES.invalidPasswordMaxLength),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const AuthHeader = () => {
await authServices.signOut(refreshToken);
}
} catch (err) {
// eslint-disable-next-line no-console
console.log(err);
}
dispatch(signOut());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const CreateJob = () => {
if (payMethod === PayMethod.Crypto && chainId !== chain?.id) {
switchNetworkAsync?.(chainId);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [payMethod, chainId]);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ export const CryptoPayForm = ({
const contract = new ethers.Contract(
tokenAddress,
HMTokenABI,
signer
signer,
);

const tx = await contract.transfer(
import.meta.env.VITE_APP_JOB_LAUNCHER_ADDRESS,
ethers.utils.parseUnits(tokenAmount.toFixed(2), 18)
ethers.utils.parseUnits(tokenAmount.toFixed(2), 18),
);

await tx.wait();
Expand All @@ -109,15 +109,15 @@ export const CryptoPayForm = ({
await jobService.createFortuneJob(
chainId,
fortuneRequest,
fundAmount
fundAmount,
);
} else if (jobType === JobType.CVAT && cvatRequest) {
await jobService.createCvatJob(chainId, cvatRequest, fundAmount);
} else if (jobType === JobType.HCAPTCHA && hCaptchaRequest) {
await jobService.createHCaptchaJob(
chainId,
hCaptchaRequest,
fundAmount
fundAmount,
);
}
onFinish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const CvatJobRequestForm = () => {
if (type && Object.values(CvatJobType).includes(type as CvatJobType)) {
setFieldValue('type', type);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
Expand Down
Loading

0 comments on commit 6830a31

Please sign in to comment.