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

Add a global .prettierrc #201

Merged
merged 1 commit into from
Aug 12, 2020
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
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": false,
"singleQuote": true
}
4 changes: 0 additions & 4 deletions examples/connect-react-intro/.prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion examples/connect-react-intro/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root'),
document.getElementById('root')
)

// Hot Module Replacement (HMR) - Remove this snippet to remove HMR.
Expand Down
2 changes: 1 addition & 1 deletion examples/list-balances-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function printBalances(holders: any, tokenSymbol: string): void {

main()
.then(() => process.exit(0))
.catch(err => {
.catch((err) => {
console.error('')
console.error(err)
console.log(
Expand Down
2 changes: 1 addition & 1 deletion examples/nodejs/src/create-karma-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export async function getOrgAddress(

main()
.then(() => process.exit(0))
.catch(err => {
.catch((err) => {
console.log(`Error: `, err)
console.log(
'\nPlease report any problem to https://github.com/aragon/connect/issues'
Expand Down
2 changes: 1 addition & 1 deletion examples/nodejs/src/create-org.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function main() {

main()
.then(() => process.exit(0))
.catch(err => {
.catch((err) => {
console.log(`Error: `, err)
console.log(
'\nPlease report any problem to https://github.com/aragon/connect/issues'
Expand Down
4 changes: 2 additions & 2 deletions examples/nodejs/src/describe-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function main() {

const votes = await voting.votes()

const { script } = votes.find(vote => voteId(vote) === '#54')!
const { script } = votes.find((vote) => voteId(vote) === '#54')!

const description = await describeScript(script, apps)

Expand All @@ -30,7 +30,7 @@ async function main() {

main()
.then(() => process.exit(0))
.catch(err => {
.catch((err) => {
console.error('')
console.error(err)
console.log(
Expand Down
2 changes: 1 addition & 1 deletion examples/nodejs/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ethers } from 'ethers'
import { GraphQLWrapper } from '@aragon/connect-thegraph'

export async function keepRunning() {
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(() => {
resolve()
}, 1000000000)
Expand Down
2 changes: 1 addition & 1 deletion examples/nodejs/src/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function main() {

main()
.then(() => process.exit(0))
.catch(err => {
.catch((err) => {
console.log(`Error: `, err)
console.log(
'\nPlease report any problem to https://github.com/aragon/connect/issues'
Expand Down
14 changes: 9 additions & 5 deletions examples/nodejs/src/subscriptions-low-level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { keepRunning } from './helpers'

const DAO_ADDRESS = '0x059bcfbc477c46ab39d76c05b7b40f3a42e7de3b'
const VOTING_APP_ADDRESS = '0xc73e86aab9d232495399d62fc80a36ae52952b81'
const ALL_VOTING_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby'
const ALL_VOTING_SUBGRAPH_URL =
'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby'

async function main() {
console.log('\nLow-level inspection of a voting app using subscriptions:')
const wrapper = new GraphQLWrapper(ALL_VOTING_SUBGRAPH_URL)

const subscription = wrapper.subscribeToQuery(
gql`
subscription {
Expand All @@ -25,7 +26,9 @@ async function main() {
{},
(results: any) => {
console.log(JSON.stringify(results.data, null, 2))
console.log(`\nTry creating a new vote at https://rinkeby.aragon.org/#/${DAO_ADDRESS}/${VOTING_APP_ADDRESS}/`)
console.log(
`\nTry creating a new vote at https://rinkeby.aragon.org/#/${DAO_ADDRESS}/${VOTING_APP_ADDRESS}/`
)
}
)

Expand All @@ -36,11 +39,12 @@ async function main() {
subscription.unsubscribe()
}


main()
.then(() => process.exit(0))
.catch((err) => {
console.log(`Error: `, err)
console.log('\nPlease report any problem to https://github.com/aragon/connect/issues')
console.log(
'\nPlease report any problem to https://github.com/aragon/connect/issues'
)
process.exit(1)
})
2 changes: 1 addition & 1 deletion examples/nodejs/src/subscriptions-org.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function main() {

main()
.then(() => process.exit(0))
.catch(err => {
.catch((err) => {
console.log(`Error: `, err)
console.log(
'\nPlease report any problem to https://github.com/aragon/connect/issues'
Expand Down
2 changes: 1 addition & 1 deletion examples/nodejs/src/subscriptions-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function main() {

main()
.then(() => process.exit(0))
.catch(err => {
.catch((err) => {
console.log(`Error: `, err)
console.log(
'\nPlease report any problem to https://github.com/aragon/connect/issues'
Expand Down
21 changes: 12 additions & 9 deletions examples/nodejs/src/subscriptions-voting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { keepRunning } from './helpers'

const ORG_ADDRESS = '0x7cee20f778a53403d4fc8596e88deb694bc91c98'
const VOTING_APP_ADDRESS = '0xf7f9a33ed13b01324884bd87137609251b5f7c88'
const ALL_VOTING_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby'
const ALL_VOTING_SUBGRAPH_URL =
'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby'

async function main() {
const voting = new Voting(
VOTING_APP_ADDRESS,
ALL_VOTING_SUBGRAPH_URL
)
const voting = new Voting(VOTING_APP_ADDRESS, ALL_VOTING_SUBGRAPH_URL)

const votesSubscription = voting.onVotes((votes: Vote[]) => {
console.log('\nVotes: ')
votes.map(console.log)
console.log(`\nTry creating a new vote at https://rinkeby.aragon.org/#/${ORG_ADDRESS}/${VOTING_APP_ADDRESS}/\n`)
console.log(
`\nTry creating a new vote at https://rinkeby.aragon.org/#/${ORG_ADDRESS}/${VOTING_APP_ADDRESS}/\n`
)
})

const votes = await voting.votes()
Expand All @@ -24,7 +24,9 @@ async function main() {
const castsSubscription = vote1.onCasts((casts: Cast[]) => {
console.log(`\nCasts:`)
casts.map(console.log)
console.log(`\nTry casting a vote on https://rinkeby.aragon.org/#/${ORG_ADDRESS}/${VOTING_APP_ADDRESS}/vote/1 (You must first mint yourself a token in the Token Manager)\n`)
console.log(
`\nTry casting a vote on https://rinkeby.aragon.org/#/${ORG_ADDRESS}/${VOTING_APP_ADDRESS}/vote/1 (You must first mint yourself a token in the Token Manager)\n`
)
})

await keepRunning()
Expand All @@ -34,11 +36,12 @@ async function main() {
castsSubscription.unsubscribe()
}


main()
.then(() => process.exit(0))
.catch((err) => {
console.log(`Error: `, err)
console.log('\nPlease report any problem to https://github.com/aragon/connect/issues')
console.log(
'\nPlease report any problem to https://github.com/aragon/connect/issues'
)
process.exit(1)
})
2 changes: 1 addition & 1 deletion examples/nodejs/src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function main() {

main()
.then(() => process.exit(0))
.catch(err => {
.catch((err) => {
console.log(`Error: `, err)
console.log(
'\nPlease report any problem to https://github.com/aragon/connect/issues'
Expand Down
3 changes: 1 addition & 2 deletions examples/nodejs/src/transaction-path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ async function main() {

main()
.then(() => process.exit(0))
.catch(err => {
.catch((err) => {
console.log(`Error: `, err)
console.log(
'\nPlease report any problem to https://github.com/aragon/connect/issues'
)
process.exit(1)
})

7 changes: 5 additions & 2 deletions examples/nodejs/src/voting-low-level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import gql from 'graphql-tag'
import { GraphQLWrapper } from '@aragon/connect-thegraph'

const VOTING_APP_ADDRESS = '0xc73e86aab9d232495399d62fc80a36ae52952b81'
const ALL_VOTING_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby'
const ALL_VOTING_SUBGRAPH_URL =
'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby'

const QUERY = `
query {
Expand All @@ -28,6 +29,8 @@ main()
.then(() => process.exit(0))
.catch((err) => {
console.log(`Error: `, err)
console.log('\nPlease report any problem to https://github.com/aragon/connect/issues')
console.log(
'\nPlease report any problem to https://github.com/aragon/connect/issues'
)
process.exit(1)
})
7 changes: 4 additions & 3 deletions examples/nodejs/src/voting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function voteId(vote: Vote) {
async function main() {
const org = await connect(env.org, 'thegraph', { chainId: env.chainId })
const apps = await org.apps()
const votingApp = apps.find(app => app.appName === 'voting.aragonpm.eth')
const votingApp = apps.find((app) => app.appName === 'voting.aragonpm.eth')

console.log('\nOrganization:', org.location, `(${org.address})`)

Expand All @@ -60,7 +60,8 @@ async function main() {
const votes = await voting.votes()

console.log(
votes.map(vote => `\n * ${voteId(vote)} ${voteTitle(vote)}`).join('') + '\n'
votes.map((vote) => `\n * ${voteId(vote)} ${voteTitle(vote)}`).join('') +
'\n'
)

if (votes.length === 0) {
Expand All @@ -85,7 +86,7 @@ async function main() {

main()
.then(() => process.exit(0))
.catch(err => {
.catch((err) => {
console.error('')
console.error(err)
console.log(
Expand Down
2 changes: 1 addition & 1 deletion examples/org-viewer-react/src/OrgInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type OrgInputProps = {
}

export default function OrgInput({ orgName, onChange }: OrgInputProps) {
const onInputChange = useCallback(event => {
const onInputChange = useCallback((event) => {
onChange(event.target.value)
}, [])

Expand Down
2 changes: 1 addition & 1 deletion examples/org-viewer-react/src/TextButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function TextButton({ ...props }) {
border: 0;
background: none;
padding: 0;
color: #DF33A4;
color: #df33a4;
cursor: pointer;
&:active {
transform: translateY(0.5px);
Expand Down
2 changes: 1 addition & 1 deletion examples/org-viewer-react/src/generic-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function useCancellableAsync<Result>(
setLoading(true)

asyncCall(stop)
.then(result => {
.then((result) => {
if (!cancelled) {
setResult(result)
setLoading(false)
Expand Down
2 changes: 1 addition & 1 deletion examples/org-viewer-web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default function App() {
Enter an org location:
</div>
<input
onChange={event => openOrg(event.target.value)}
onChange={(event) => openOrg(event.target.value)}
placeholder="e.g. xyz.aragonid.eth"
type="text"
value={orgName}
Expand Down
2 changes: 1 addition & 1 deletion examples/org-viewer-web/src/TextButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function TextButton({ ...props }) {
border: 0;
background: none;
padding: 0;
color: #DF33A4;
color: #df33a4;
cursor: pointer;
&:active {
transform: translateY(0.5px);
Expand Down
2 changes: 1 addition & 1 deletion examples/org-viewer-web/src/generic-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function useCancellableAsync<Result>(
setLoading(true)

asyncCall(stop)
.then(result => {
.then((result) => {
if (!cancelled) {
setResult(result)
setLoading(false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { AgreementData } from '../../types'
import { AgreementConnectorTheGraph } from '../../../src'

const AGREEMENT_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/facuspagnuolo/aragon-agreement-rinkeby-staging'
const AGREEMENT_SUBGRAPH_URL =
'https://api.thegraph.com/subgraphs/name/facuspagnuolo/aragon-agreement-rinkeby-staging'
const AGREEMENT_APP_ADDRESS = '0x40bb5003d24a0f58da03b19287e20ce2a3db9b54'

describe('Agreement', () => {
Expand All @@ -25,8 +26,12 @@ describe('Agreement', () => {
test('returns the agreement data', () => {
expect(agreement.id).toBe(AGREEMENT_APP_ADDRESS)
expect(agreement.dao).toBe('0xa6e4b08981ae324f16d6be39362f6de2da22882a')
expect(agreement.stakingFactory).toBe('0x07429001eea415e967c57b8d43484233d57f8b0b')
expect(agreement.currentVersionId).toBe(`${AGREEMENT_APP_ADDRESS}-version-3`)
expect(agreement.stakingFactory).toBe(
'0x07429001eea415e967c57b8d43484233d57f8b0b'
)
expect(agreement.currentVersionId).toBe(
`${AGREEMENT_APP_ADDRESS}-version-3`
)
})
})
})
21 changes: 16 additions & 5 deletions packages/connect-agreement/src/__test__/connector/signers.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AgreementConnectorTheGraph, Signer, Signature } from '../../../src'

const AGREEMENT_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/facuspagnuolo/aragon-agreement-rinkeby-staging'
const AGREEMENT_SUBGRAPH_URL =
'https://api.thegraph.com/subgraphs/name/facuspagnuolo/aragon-agreement-rinkeby-staging'
const AGREEMENT_APP_ADDRESS = '0x40bb5003d24a0f58da03b19287e20ce2a3db9b54'
const SIGNER_ADDRESS = '0x0090aed150056316e37fe6dfa10dc63e79d173b6'

Expand All @@ -19,11 +20,15 @@ describe('Agreement signers', () => {
let signer: Signer

beforeAll(async () => {
signer = await connector.signer(`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`)
signer = await connector.signer(
`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`
)
})

test('allows fetching signer information', async () => {
expect(signer.id).toBe(`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`)
expect(signer.id).toBe(
`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`
)
expect(signer.address).toBe(SIGNER_ADDRESS)
expect(signer.agreementId).toBe(AGREEMENT_APP_ADDRESS)
})
Expand All @@ -33,14 +38,20 @@ describe('Agreement signers', () => {
let signatures: Signature[]

beforeAll(async () => {
signatures = await connector.signatures(`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`, 1000, 0)
signatures = await connector.signatures(
`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`,
1000,
0
)
})

test('allows fetching signer information', async () => {
expect(signatures.length).toBeGreaterThan(1)

const lastSignature = signatures[signatures.length - 1]
expect(lastSignature.signerId).toBe(`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`)
expect(lastSignature.signerId).toBe(
`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`
)
expect(lastSignature.versionId).toBe(`${AGREEMENT_APP_ADDRESS}-version-3`)
expect(lastSignature.createdAt).toBe('1596201298')
})
Expand Down
Loading