Skip to content

Commit

Permalink
Add prettier formatted files
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanley-Okwii committed Aug 31, 2021
1 parent 8f733e3 commit bd71ec6
Show file tree
Hide file tree
Showing 598 changed files with 16,195 additions and 8,225 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/run-coverage-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

jobs:
build:

runs-on: ubuntu-latest

strategy:
Expand All @@ -19,19 +18,19 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: canastro/copy-file-action@master
name: "copy env file"
name: 'copy env file'
with:
source: .env.example
target: .env
- uses: borales/[email protected]
name: "yarn install"
name: 'yarn install'
with:
cmd: install # will run `yarn install` command
- uses: borales/[email protected]
name: "build"
name: 'build'
with:
cmd: app:build # will run `yarn app:build` command
- uses: borales/[email protected]
name: "solidity coverage"
name: 'solidity coverage'
with:
cmd: coverage
9 changes: 4 additions & 5 deletions .github/workflows/run-fork-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

jobs:
build:

runs-on: ubuntu-latest

strategy:
Expand All @@ -19,20 +18,20 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: canastro/copy-file-action@master
name: "copy env file"
name: 'copy env file'
with:
source: .env.example
target: .env
- uses: borales/[email protected]
name: "yarn install"
name: 'yarn install'
with:
cmd: install # will run `yarn install` command
- uses: borales/[email protected]
name: "build"
name: 'build'
with:
cmd: app:build # will run `yarn app:build` command
- uses: borales/[email protected]
name: "run tests"
name: 'run tests'
with:
cmd: test:fork
env:
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

jobs:
build:

runs-on: ubuntu-latest

strategy:
Expand All @@ -19,19 +18,19 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: canastro/copy-file-action@master
name: "copy env file"
name: 'copy env file'
with:
source: .env.example
target: .env
- uses: borales/[email protected]
name: "yarn install"
name: 'yarn install'
with:
cmd: install # will run `yarn install` command
- uses: borales/[email protected]
name: "build"
name: 'build'
with:
cmd: app:build # will run `yarn app:build` command
- uses: borales/[email protected]
name: "run tests"
name: 'run tests'
with:
cmd: test
cmd: test
18 changes: 7 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,22 @@
],
"editor.formatOnSave": true,
"[javascript]": {
"editor.formatOnSave": true,
"editor.formatOnSave": true
},
"[javascriptreact]": {
"editor.formatOnSave": true,
"editor.formatOnSave": true
},
"[typescript]": {
"editor.formatOnSave": true,
"editor.formatOnSave": true
},
"[typescriptreact]": {
"editor.formatOnSave": true,
"editor.formatOnSave": true
},
"editor.tabCompletion": "on",
"editor.tabSize": 2,
"prettier.eslintIntegration": true,
"javascript.validate.enable": true,
// "diffEditor.ignoreTrimWhitespace": true,
"editor.rulers": [
80,
120
],
"cSpell.words": [
]
}
"editor.rulers": [80, 120],
"cSpell.words": []
}
33 changes: 16 additions & 17 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Contributor Covenant Code of Conduct

## Our Pledge
Expand All @@ -18,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down Expand Up @@ -106,7 +105,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand All @@ -118,15 +117,15 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][mozilla coc].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
[https://www.contributor-covenant.org/faq][faq]. Translations are available
at [https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[mozilla coc]: https://github.com/mozilla/diversity
[faq]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
40 changes: 20 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Contributing


Welcome aboard as an Popcorn developer.

This document will get you up to speed on our expectations for contributing to the codebase. Please read through this and our [code of conduct](./CODE_OF_CONDUCT.md).


## Style guide

If you elect to use VS Code, maintaining a consistent style is easy because of the prettier integration.
Expand All @@ -14,51 +12,53 @@ Regardless, please ensure that you are using 2 space tabs.

## Inclusive language: replacement terms

In an effort to develop software with language free from expressions or words that reflect prejudice the following terminology is recommended instead of blacklist/whitelist and master/slave:
In an effort to develop software with language free from expressions or words that reflect prejudice the following terminology is recommended instead of blacklist/whitelist and master/slave:

Replace blacklist/whitelist with:

```
blocklist / allowlist
exclude list / include list
avoid list / prefer list
```

Replace master/slave with:

```
leading / subordinate
source / replica
```



## Recommended Tools:
- `vscode` - because we are using typescript this is very important to download. It makes the development experience much easier. free download available here: https://code.visualstudio.com/
- recommended plugins:
- gitlens
- Move TS
- ESLint
- Docker
- Prettier
- Todo Tree
- TSLint

- `vscode` - because we are using typescript this is very important to download. It makes the development experience much easier. free download available here: https://code.visualstudio.com/
- recommended plugins:
- gitlens
- Move TS
- ESLint
- Docker
- Prettier
- Todo Tree
- TSLint

## Git flow - submitting features/bugs:

- New features are branched off of `develop`. To create a new feature, create a new branch off of develop with the name: `feature/name-of-feature`
- To submit a bug fix create a new branch off of develop with the name `bugfix/name-of-bug`
- When your feature is ready for QA, create a pull request and share a link to the pull request

## Code standards

- All code is subject to review. If it does not meet quality standards, it may not be merged until the issues are addressed;

### General guidelines:
### General guidelines:

*Function length*: functions should __rarely be greater than 20 lines of code__. Exceptions can be made. Please do not submit a PR unless the code has been refactored in an attempt to meet this standard.
_Function length_: functions should **rarely be greater than 20 lines of code**. Exceptions can be made. Please do not submit a PR unless the code has been refactored in an attempt to meet this standard.

*Declarative vs imperative* - When possible aim to write declarative code. https://tylermcginnis.com/imperative-vs-declarative-programming/
_Declarative vs imperative_ - When possible aim to write declarative code. https://tylermcginnis.com/imperative-vs-declarative-programming/

*Use classes or es6 modules* - Use classes or es6 modules to contain your code - https://exploringjs.com/es6/ch_modules.html#sec_basics-of-es6-modules
_Use classes or es6 modules_ - Use classes or es6 modules to contain your code - https://exploringjs.com/es6/ch_modules.html#sec_basics-of-es6-modules

*const vs let vs var* - Always prefer `let` over `var`. Always prefer `const` to `let` when a variable does not need to be reassigned. Avoid variable reassignment. This makes code easier to understand and less prone to bugs.
_const vs let vs var_ - Always prefer `let` over `var`. Always prefer `const` to `let` when a variable does not need to be reassigned. Avoid variable reassignment. This makes code easier to understand and less prone to bugs.

*any types* - when writing in typescript avoid using `any` types - always create interfaces for the inputs and outputs of your functions. On very rare occassions it is ok to use `any`.
_any types_ - when writing in typescript avoid using `any` types - always create interfaces for the inputs and outputs of your functions. On very rare occassions it is ok to use `any`.
2 changes: 1 addition & 1 deletion packages/app/__test__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import React from 'react';
import Index from '../pages/index';

describe('Index page', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/components/Beneficiaries/BeneficiaryPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Displays a beneficiary or a preview of a proposal

import { BeneficiaryApplication } from '@popcorn/contracts/adapters';
import BeneficiaryInformation from 'components/CommonComponents/BeneficiaryInformation';
import ImageHeader from 'components/CommonComponents/ImageHeader';
import VideoSideBar from 'components/CommonComponents/VideoSideBar';
import NavBar from 'components/NavBar/NavBar';
import { BeneficiaryApplication } from '@popcorn/contracts/adapters';
import PhotoSideBar from '../CommonComponents/PhotoSideBar';
import TriggerTakedownProposal from '../CommonComponents/TriggerTakedownProposal';

Expand Down
5 changes: 1 addition & 4 deletions packages/app/components/CommonComponents/ImageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ export interface ImageHeaderProps {
title?: string;
}

const ImageHeader: React.FC<ImageHeaderProps> = ({
beneficiary,
title,
}) => {
const ImageHeader: React.FC<ImageHeaderProps> = ({ beneficiary, title }) => {
return (
<div>
<div>
Expand Down
2 changes: 1 addition & 1 deletion packages/app/components/Grants/ElectionProps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PendingVotes, Vote } from 'pages/grant-elections/[type]';
import { ElectionMetadata } from '@popcorn/contracts/adapters';
import { PendingVotes, Vote } from 'pages/grant-elections/[type]';

export interface ElectionProps {
election: ElectionMetadata;
Expand Down
8 changes: 5 additions & 3 deletions packages/app/components/Grants/GrantRound.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
IpfsClient,
} from '@popcorn/utils';
import { ElectionMetadata, BeneficiaryRegistryAdapter, BeneficiaryApplication } from '@popcorn/contracts/adapters';
BeneficiaryApplication,
BeneficiaryRegistryAdapter,
ElectionMetadata,
} from '@popcorn/contracts/adapters';
import { IpfsClient } from '@popcorn/utils';
import { ContractsContext } from 'context/Web3/contracts';
import { BigNumber, utils } from 'ethers';
import { PendingVotes, Vote, Votes } from 'pages/grant-elections/[type]';
Expand Down
6 changes: 3 additions & 3 deletions packages/app/components/Grants/VoteSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const VoteSlider: React.FC<VoteSliderProps> = ({
function handleSliderChange(value: number) {
if (
electionProps.voiceCredits -
electionProps.pendingVotes[electionProps.election.electionTerm].total <=
electionProps.pendingVotes[electionProps.election.electionTerm].total <=
0
) {
if (
electionProps.pendingVotes[electionProps.election.electionTerm].votes[
beneficiary.beneficiaryAddress
beneficiary.beneficiaryAddress
] > value
) {
setVotesAssignedByUser(value);
Expand Down Expand Up @@ -82,7 +82,7 @@ const VoteSlider: React.FC<VoteSliderProps> = ({
activeDotStyle={{ backgroundColor: '#3B82F6', border: '#3B82F6' }}
railStyle={{ backgroundColor: '#93C5FD', height: '4px' }}
trackStyle={{ backgroundColor: '#3B82F6', height: '4px' }}
/* handleStyle={{
/* handleStyle={{
border: '#F29F05',
backgroundColor: '#fff',
height: '14px',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Fragment, useContext, useEffect } from 'react';
import { hideNotification, unsetNotification } from '../../context/actions';
import { store } from '../../context/store';


const NotificationsContainer: React.FC = () => {
const {
dispatch,
Expand Down
Loading

0 comments on commit bd71ec6

Please sign in to comment.