Skip to content

Commit

Permalink
style: format code with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
cedoor committed Jun 24, 2022
1 parent 8700d3d commit 7f7049b
Show file tree
Hide file tree
Showing 71 changed files with 3,229 additions and 3,223 deletions.
2 changes: 1 addition & 1 deletion .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
"extends": ["@commitlint/config-conventional"]
}
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
indent_size = 2
indent_size = 4

[*.md]
trim_trailing_whitespace = false
72 changes: 36 additions & 36 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
{
"root": true,
"env": {
"es6": true
},
"extends": ["airbnb-base", "airbnb-typescript/base", "plugin:jest/recommended", "plugin:jest/style", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"project": ["./tsconfig.json", "./packages/**/tsconfig.json"]
},
"plugins": ["@typescript-eslint", "jest"],
"rules": {
"no-console": ["warn", { "allow": ["info", "warn", "error"] }],
"no-restricted-syntax": "off",
"no-underscore-dangle": "off",
"no-param-reassign": "off",
"no-await-in-loop": "off",
"import/no-cycle": "off",
"no-bitwise": "off",
"class-methods-use-this": "warn",
"import/no-extraneous-dependencies": "off",
"import/no-relative-packages": "off",
"@typescript-eslint/no-loop-func": "off",
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/lines-between-class-members": "off",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "variable",
"format": ["camelCase", "PascalCase", "UPPER_CASE", "snake_case"],
"leadingUnderscore": "allow"
}
]
}
"root": true,
"env": {
"es6": true
},
"extends": ["airbnb-base", "airbnb-typescript/base", "plugin:jest/recommended", "plugin:jest/style", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"project": ["./tsconfig.json", "./packages/**/tsconfig.json"]
},
"plugins": ["@typescript-eslint", "jest"],
"rules": {
"no-console": ["warn", { "allow": ["info", "warn", "error"] }],
"no-restricted-syntax": "off",
"no-underscore-dangle": "off",
"no-param-reassign": "off",
"no-await-in-loop": "off",
"import/no-cycle": "off",
"no-bitwise": "off",
"class-methods-use-this": "warn",
"import/no-extraneous-dependencies": "off",
"import/no-relative-packages": "off",
"@typescript-eslint/no-loop-func": "off",
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/lines-between-class-members": "off",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "variable",
"format": ["camelCase", "PascalCase", "UPPER_CASE", "snake_case"],
"leadingUnderscore": "allow"
}
]
}
}
26 changes: 13 additions & 13 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

Please check if your PR fulfills the following requirements:

- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features)
- [ ] Build (`yarn build`) was run locally and any changes were pushed
- [ ] Lint (`yarn lint`) has passed locally and any fixes were made for failures
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features)
- [ ] Build (`yarn build`) was run locally and any changes were pushed
- [ ] Lint (`yarn lint`) has passed locally and any fixes were made for failures

## Pull request type

Expand All @@ -17,13 +17,13 @@ Please check if your PR fulfills the following requirements:

Please check the type of change your PR introduces:

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

## What is the current behavior?

Expand All @@ -41,8 +41,8 @@ Issue Number: N/A

## Does this introduce a breaking change?

- [ ] Yes
- [ ] No
- [ ] Yes
- [ ] No

<!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. -->

Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: docs

on:
push:
branches:
- main
push:
branches:
- main

jobs:
gh-pages:
runs-on: ubuntu-latest
gh-pages:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
steps:
- uses: actions/checkout@v2

- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x

- run: yarn --frozen-lockfile
- run: yarn docs
- run: yarn --frozen-lockfile
- run: yarn docs

- name: Github Pages
uses: crazy-max/[email protected]
with:
build_dir: docs
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Github Pages
uses: crazy-max/[email protected]
with:
build_dir: docs
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 18 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: test

on:
pull_request:
push:
branches:
- main
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
steps:
- uses: actions/checkout@v2

- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x

- run: yarn --frozen-lockfile
- run: yarn test:prod
- run: yarn --frozen-lockfile
- run: yarn test:prod

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"**/*.{js,jsx,ts,tsx}": ["prettier --write", "eslint --fix"]
"**/*.{js,jsx,ts,tsx}": ["prettier --write", "eslint --fix"]
}
6 changes: 3 additions & 3 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"semi": false,
"arrowParens": "always",
"trailingComma": "none"
"semi": false,
"arrowParens": "always",
"trailingComma": "none"
}
4 changes: 2 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.2.1.cjs
44 changes: 22 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ The **header** is mandatory and the **scope** of the header is optional.

The type must be one of the following:

- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature (improvements of the code structure)
- perf: A code change that improves the performance
- test: Adding missing or correcting existing tests
- build: Changes that affect the build system or external dependencies (example scopes: gulp, npm)
- ci: Changes to CI configuration files and scripts (example scopes: travis, circle)
- chore: Other changes that don't modify src or test files
- revert: Reverts a previous commit
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature (improvements of the code structure)
- perf: A code change that improves the performance
- test: Adding missing or correcting existing tests
- build: Changes that affect the build system or external dependencies (example scopes: gulp, npm)
- ci: Changes to CI configuration files and scripts (example scopes: travis, circle)
- chore: Other changes that don't modify src or test files
- revert: Reverts a previous commit

#### Scope

Expand All @@ -82,24 +82,24 @@ The scope should be the name of the npm package affected (as perceived by the pe

The subject contains a succinct description of the change:

- Use the imperative, present tense: "change" not "changed" nor "changes"
- Don't capitalize the first letter
- No dot (.) at the end
- Use the imperative, present tense: "change" not "changed" nor "changes"
- Don't capitalize the first letter
- No dot (.) at the end

#### Body

Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.

### Branch rules

- There must be a `main` branch, used only for the releases.
- There must be a `dev` branch, used to merge all the branches under it.
- Avoid long descriptive names for long-lived branches.
- Use kebab-case (no CamelCase).
- Use grouping tokens (words) at the beginning of your branch names (in a similar way to the `type` of commit).
- Define and use short lead tokens to differentiate branches in a way that is meaningful to your workflow.
- Use slashes to separate parts of your branch names.
- Remove branch after merge if it is not important.
- There must be a `main` branch, used only for the releases.
- There must be a `dev` branch, used to merge all the branches under it.
- Avoid long descriptive names for long-lived branches.
- Use kebab-case (no CamelCase).
- Use grouping tokens (words) at the beginning of your branch names (in a similar way to the `type` of commit).
- Define and use short lead tokens to differentiate branches in a way that is meaningful to your workflow.
- Use slashes to separate parts of your branch names.
- Remove branch after merge if it is not important.

Examples:

Expand Down
2 changes: 1 addition & 1 deletion babel.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": [["@babel/preset-env", { "targets": { "node": "current" } }], "@babel/preset-typescript"]
"presets": [["@babel/preset-env", { "targets": { "node": "current" } }], "@babel/preset-typescript"]
}
64 changes: 32 additions & 32 deletions benchmarks/incremental-merkle-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ import { IncrementalMerkleTree } from "../packages/incremental-merkle-tree/src"
const name = "incremental-merkle-tree"

export default async function run() {
const tree1 = new IncrementalMerkleTree(poseidon, 20, BigInt(0), 5)
const tree2 = new IncrementalQuinTree(20, BigInt(0), 5, poseidon)

const numberOfLeaves = 2 ** 7

for (let i = 0; i < numberOfLeaves; i += 1) {
tree1.insert(BigInt(i + 1))
tree2.insert(BigInt(i + 1))
}

b.suite(
name,

b.add(`IncrementalMerkleTree - createProof (${numberOfLeaves} leaves)`, () => {
for (let i = 0; i < numberOfLeaves; i += 1) {
tree1.createProof(i)
}
}),

b.add(`IncrementalQuinTree - genMerklePath (${numberOfLeaves} leaves)`, () => {
for (let i = 0; i < numberOfLeaves; i += 1) {
tree2.genMerklePath(i)
}
}),

b.cycle(),
b.complete(),

b.save({ folder: "benchmarks/results", file: name, version: "1.0.0", details: true }),
b.save({ folder: "benchmarks/results", file: name, format: "chart.html", details: true }),
b.save({ folder: "benchmarks/results", file: name, format: "table.html", details: true })
)
const tree1 = new IncrementalMerkleTree(poseidon, 20, BigInt(0), 5)
const tree2 = new IncrementalQuinTree(20, BigInt(0), 5, poseidon)

const numberOfLeaves = 2 ** 7

for (let i = 0; i < numberOfLeaves; i += 1) {
tree1.insert(BigInt(i + 1))
tree2.insert(BigInt(i + 1))
}

b.suite(
name,

b.add(`IncrementalMerkleTree - createProof (${numberOfLeaves} leaves)`, () => {
for (let i = 0; i < numberOfLeaves; i += 1) {
tree1.createProof(i)
}
}),

b.add(`IncrementalQuinTree - genMerklePath (${numberOfLeaves} leaves)`, () => {
for (let i = 0; i < numberOfLeaves; i += 1) {
tree2.genMerklePath(i)
}
}),

b.cycle(),
b.complete(),

b.save({ folder: "benchmarks/results", file: name, version: "1.0.0", details: true }),
b.save({ folder: "benchmarks/results", file: name, format: "chart.html", details: true }),
b.save({ folder: "benchmarks/results", file: name, format: "table.html", details: true })
)
}
Loading

0 comments on commit 7f7049b

Please sign in to comment.