Skip to content

Commit

Permalink
chore(prettier): sort imports & exports
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Sep 12, 2023
1 parent b7a4b79 commit 3fd578a
Show file tree
Hide file tree
Showing 28 changed files with 117 additions and 77 deletions.
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "always"
"proseWrap": "always",
"plugins": ["prettier-plugin-organize-imports"]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"npm-run-all": "^4.1.5",
"open-cli": "^7.2.0",
"prettier": "^2.8.8",
"prettier-plugin-organize-imports": "^3.2.3",
"sort-package-json": "^2.5.1",
"ts-jest": "^29.1.1",
"ts-jest-resolver": "^2.0.1",
Expand Down
28 changes: 14 additions & 14 deletions packages/pre/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@
// What goes into the pre module? Should we re-export the basic building blocks and/or remake the helper methods?
export {
Alice,
BlockchainPolicyParameters,
Bob,
RemoteBob,
Cohort,
DeployedPreStrategy,
EnactedPolicy,
Enrico,
PreDecrypter,
PorterClient,
PreEnactedPolicy,
Keyring,
getPorterUri,
PolicyMessageKit,
conditions,
BlockchainPolicyParameters,
EnactedPolicy,
Cohort,
DeployedPreStrategy,
PorterClient,
PreDecrypter,
PreEnactedPolicy,
PreStrategy,
RemoteBob,
conditions,
getPorterUri,
} from '@nucypher/shared';

export {
PublicKey,
SecretKey,
Ciphertext,
EncryptedTreasureMap,
HRAC,
MessageKit,
PublicKey,
SecretKey,
Signer,
TreasureMap,
MessageKit,
Ciphertext,
} from '@nucypher/nucypher-core';
2 changes: 1 addition & 1 deletion packages/pre/test/pre.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from 'vitest';
import { expect, test } from 'vitest';

test('pre', () => {
expect('pre').toBe('pre');
Expand Down
8 changes: 4 additions & 4 deletions packages/shared/src/conditions/base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export class TimeCondition extends Condition {
}
}

export { type ContractConditionProps, ContractConditionType } from './contract';
export { type RpcConditionProps, RpcConditionType } from './rpc';
export { ContractConditionType, type ContractConditionProps } from './contract';
export { RpcConditionType, type RpcConditionProps } from './rpc';
export {
type TimeConditionProps,
TimeConditionType,
TimeConditionMethod,
TimeConditionType,
type TimeConditionProps,
} from './time';
12 changes: 6 additions & 6 deletions packages/shared/src/conditions/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as base from './base';
import * as predefined from './predefined';

export { predefined, base };
export {
CompoundConditionType,
type CompoundConditionProps,
} from './compound-condition';
export { Condition, type ConditionProps } from './condition';
export {
ConditionExpression,
type ConditionExpressionJSON,
} from './condition-expr';
export { ConditionContext, type CustomContextParam } from './context';
export { Condition, type ConditionProps } from './condition';
export {
type CompoundConditionProps,
CompoundConditionType,
} from './compound-condition';
export { base, predefined };
16 changes: 8 additions & 8 deletions packages/shared/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export * from './characters';
export * from './cohort';
export * from './conditions';
export * from './contracts';
export * from './kits';
export * from './policy';
export * from './strategy';
export * from './cohort';
export * from './dkg';
export * from './keyring';
export * from './kits';
export * from './policy';
export * from './porter';
export * from './strategy';
export * from './types';
export * from './utils';
export * from './web3';
Expand All @@ -20,12 +20,12 @@ export { conditions };

// Re-exports
export {
PublicKey,
SecretKey,
Ciphertext,
EncryptedTreasureMap,
HRAC,
MessageKit,
PublicKey,
SecretKey,
Signer,
TreasureMap,
MessageKit,
Ciphertext,
} from '@nucypher/nucypher-core';
2 changes: 1 addition & 1 deletion packages/shared/src/strategy/cbd-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
ThresholdDecrypterJSON,
} from '../characters/cbd-recipient';
import { Enrico } from '../characters/enrico';
import { Cohort, CohortJSON } from '../cohort';
import { ConditionExpression, ConditionExpressionJSON } from '../conditions';
import { DkgClient, DkgRitual } from '../dkg';
import { fromJSON, toJSON } from '../utils';
import { Cohort, CohortJSON } from '../cohort';

export type CbdStrategyJSON = {
cohort: CohortJSON;
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/strategy/pre-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { Alice } from '../characters/alice';
import { Bob } from '../characters/bob';
import { Enrico } from '../characters/enrico';
import { PreDecrypter, PreDecrypterJSON } from '../characters/pre-recipient';
import { Cohort, CohortJSON } from '../cohort';
import { ConditionExpression } from '../conditions';
import { EnactedPolicy } from '../policy';
import { base64ToU8Receiver, toJSON } from '../utils';
import { Cohort, CohortJSON } from '../cohort';

export type PreStrategyJSON = {
cohort: CohortJSON;
Expand Down
11 changes: 7 additions & 4 deletions packages/shared/test/acceptance/alice-grants.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import {
} from '@nucypher/nucypher-core';
import { test } from 'vitest';

import { EnactedPolicy, Enrico } from '../../src';
import { Ursula } from '../../src';
import { ChecksumAddress } from '../../src';
import { toBytes } from '../../src';
import {
ChecksumAddress,
EnactedPolicy,
Enrico,
Ursula,
toBytes,
} from '../../src';
import {
bytesEqual,
fakeAlice,
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/test/acceptance/delay-enact.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test } from 'vitest';
import {
bytesEqual,
fakeAlice,
Expand All @@ -11,7 +12,6 @@ import {
mockGetUrsulas,
mockPublishToBlockchain,
} from '../utils';
import { test } from 'vitest';

test('story: alice creates a policy but someone else enacts it', () => {
const threshold = 2;
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/test/docs/cbd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
getPorterUri,
PreStrategy,
SecretKey,
toBytes,
Ursula,
} from '../../src';
import { Ursula } from '../../src';
import { toBytes } from '../../src';
import {
ContractCondition,
ContractConditionProps,
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/test/integration/dkg-client.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SecretKey } from '@nucypher/nucypher-core';
import { test, vi, afterEach } from 'vitest';
import { afterEach, test, vi } from 'vitest';

import { DkgCoordinatorAgent } from '../../src';
import {
Expand Down
12 changes: 8 additions & 4 deletions packages/shared/test/integration/enrico.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
// Disabling because we want to access Alice.keyring which is a private property
/* eslint-disable @typescript-eslint/no-explicit-any */
import { ConditionExpression, Enrico, PolicyMessageKit } from '../../src';
import { RetrievalResult } from '../../src';
import { toBytes } from '../../src';
import { test } from 'vitest';
import {
ConditionExpression,
Enrico,
PolicyMessageKit,
RetrievalResult,
toBytes,
} from '../../src';
import { ERC721Ownership } from '../../src/conditions/predefined';
import {
bytesEqual,
Expand All @@ -11,7 +16,6 @@ import {
fromBytes,
reencryptKFrags,
} from '../utils';
import { test } from 'vitest';

test('enrico', () => {
test('alice decrypts message encrypted by enrico', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/test/integration/message-kit.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test } from 'vitest';
import { MessageKit } from '../../src';
import { toBytes } from '../../src/utils';
import { fakeBob } from '../utils';
import { test } from 'vitest';

test('message kit', () => {
test('bob decrypts', () => {
Expand Down
7 changes: 4 additions & 3 deletions packages/shared/test/integration/pre.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import {
Enrico,
MessageKit,
PolicyMessageKit,
RetrievalResult,
toBytes,
zip,
} from '../../src';
import { RetrievalResult } from '../../src';
import { toBytes, zip } from '../../src';
import { CompoundCondition } from '../../src/conditions/base';
import { fakeAlice, fakeBob, fakeUrsulas, reencryptKFrags } from '../utils';
import { ERC721Ownership } from '../../src/conditions/predefined';
import { fakeAlice, fakeBob, fakeUrsulas, reencryptKFrags } from '../utils';

test('proxy reencryption', () => {
const plaintext = toBytes('plaintext-message');
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/test/unit/cbd-strategy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
CbdStrategy,
ConditionExpression,
DeployedCbdStrategy,
ThresholdDecrypter,
toBytes,
} from '../../src';
import { ThresholdDecrypter } from '../../src';
import { toBytes } from '../../src';
import { ERC721Ownership } from '../../src/conditions/predefined';
import {
fakeDkgFlow,
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/test/unit/cohort.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test } from 'vitest';
import { Cohort } from '../../src';
import { fakeUrsulas, makeCohort } from '../utils';
import { test } from 'vitest';

test('Cohort', () => {
const mockedUrsulas = fakeUrsulas();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test } from 'vitest';
import { Condition } from '../../../../src/conditions';
import { ContractCondition } from '../../../../src/conditions/base';
import {
Expand All @@ -9,7 +10,6 @@ import {
TEST_CONTRACT_ADDR,
testContractConditionObj,
} from '../../testVariables';
import { test } from 'vitest';

test('validation', () => {
const condition = new ERC721Balance({
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/test/unit/conditions/base/contract.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { test } from 'vitest';
import { ConditionExpression, CustomContextParam } from '../../../../src';
import {
ContractCondition,
ContractConditionProps,
} from '../../../../src/conditions/base';
import {
contractConditionSchema,
FunctionAbiProps,
contractConditionSchema,
} from '../../../../src/conditions/base/contract';
import { USER_ADDRESS_PARAM } from '../../../../src/conditions/const';
import { fakeProvider, fakeSigner } from '../../../utils';
import { testContractConditionObj, testFunctionAbi } from '../../testVariables';
import { test } from 'vitest';

test('validation', () => {
test('accepts on a valid schema', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/test/unit/conditions/base/rpc.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test } from 'vitest';
import { RpcCondition } from '../../../../src/conditions/base';
import { rpcConditionSchema } from '../../../../src/conditions/base/rpc';
import { testRpcConditionObj } from '../../testVariables';
import { test } from 'vitest';

test('validation', () => {
test('accepts on a valid schema', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/test/unit/conditions/base/time.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { test } from 'vitest';
import {
TimeCondition,
TimeConditionProps,
} from '../../../../src/conditions/base';
import { ReturnValueTestProps } from '../../../../src/conditions/base/shared';
import {
TimeConditionMethod,
timeConditionSchema,
TimeConditionType,
timeConditionSchema,
} from '../../../../src/conditions/base/time';
import { test } from 'vitest';

test('validation', () => {
const returnValueTest: ReturnValueTestProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test } from 'vitest';
import { Condition } from '../../../src/conditions';
import { CompoundCondition } from '../../../src/conditions/base';
import {
Expand All @@ -9,7 +10,6 @@ import {
testRpcConditionObj,
testTimeConditionObj,
} from '../testVariables';
import { test } from 'vitest';

test('validation', () => {
test('accepts or operator', () => {
Expand Down
6 changes: 2 additions & 4 deletions packages/shared/test/unit/conditions/condition-expr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,19 @@ import {
ContractCondition,
ContractConditionProps,
RpcCondition,
RpcConditionType,
TimeCondition,
TimeConditionProps,
} from '../../../src/conditions/base';
import { RpcConditionType } from '../../../src/conditions/base';
import { USER_ADDRESS_PARAM } from '../../../src/conditions/const';
import { ERC721Balance } from '../../../src/conditions/predefined';
import { objectEquals, toJSON } from '../../../src/utils';
import {
TEST_CHAIN_ID,
TEST_CONTRACT_ADDR,
testContractConditionObj,
testFunctionAbi,
testReturnValueTest,
} from '../testVariables';
import {
testContractConditionObj,
testRpcConditionObj,
testTimeConditionObj,
} from '../testVariables';
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/test/unit/pre-strategy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
DeployedPreStrategy,
PreDecrypter,
PreStrategy,
Ursula,
toBytes,
} from '../../src';
import { Ursula } from '../../src';
import { toBytes } from '../../src';
import { ERC721Ownership } from '../../src/conditions/predefined';
import {
fakeProvider,
Expand Down
Loading

0 comments on commit 3fd578a

Please sign in to comment.