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

chore: syncing files #408

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
29 changes: 24 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = {
parserOptions: {
sourceType: 'module',
ecmaVersion: 2018,
project: './tsconfig.test.json',
},
env: {
jest: true,
Expand All @@ -11,11 +12,10 @@ module.exports = {
browser: true,
page: true,
},
plugins: ['jest'],
plugins: ['jest', 'unused-imports'],
rules: {
'array-bracket-newline': ['error', 'consistent'],
strict: ['error', 'safe'],
curly: 'error',
'block-scoped-var': 'error',
complexity: 'warn',
'default-case': 'error',
Expand All @@ -27,6 +27,7 @@ module.exports = {
'no-case-declarations': 'error',
'no-console': 'error',
'no-constant-condition': 'error',
'no-continue': 'warn',
'no-div-regex': 'error',
'no-empty': 'warn',
'no-empty-pattern': 'error',
Expand All @@ -41,7 +42,6 @@ module.exports = {
'require-yield': 'error',
'max-nested-callbacks': ['error', 4],
'max-depth': ['error', 4],
'require-await': 'error',
'space-before-function-paren': [
'error',
{
Expand Down Expand Up @@ -72,17 +72,36 @@ module.exports = {
requireLast: true,
},
singleline: {
delimiter: 'comma',
delimiter: 'semi',
requireLast: false,
},
},
],
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-expect-error': 'allow-with-description',
'ts-ignore': 'allow-with-description',
'ts-nocheck': 'allow-with-description',
'ts-check': 'allow-with-description',
minimumDescriptionLength: 6,
},
],
'require-await': 'off',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{ vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' },
],
},
overrides: [
{
files: ['*.spec.ts'],
rules: {
// '@typescript-eslint/ban-ts-ignore': 'off',
'max-nested-callbacks': ['error', 10], // allow describe/it nesting
},
},
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
15 changes: 5 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
lib

# Logs
logs
*.log

# OS files
.DS_Store

# Runtime data
pids
*.pid
Expand All @@ -19,17 +20,11 @@ coverage
# node-waf configuration
.lock-wscript

#babel RC
.babelrc.js

build
dist

# Dependency directory
node_modules

# Test data
test/data/*
!test/data/.gitkeep
!test/data/manifest
!test/data/TestIdentity.*
# Generated files
docs
2 changes: 1 addition & 1 deletion .huskyrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
13 changes: 13 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"bracketSpacing": true,
"semi": false,
"singleQuote": true,
"quoteProps": "as-needed",
"trailingComma": "all",
"endOfLine": "lf",
"arrowParens": "avoid",
"proseWrap": "always"
}
61 changes: 61 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make
participation in our project and our community a harassment-free experience for everyone, regardless of age, body size,
disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education,
socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

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

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take
appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the
project or its community in public spaces. Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting as an appointed representative at an
online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at
[email protected]. All complaints will be reviewed and investigated and will result in a response that is deemed
necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to
the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent
repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
46 changes: 24 additions & 22 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
Copyright (c) 2020 The Swarm Authors. All rights reserved.
BSD 3-Clause License

Copyright (c) 2022, The Swarm Authors
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Swarm nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5 changes: 4 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
rules: {
'body-max-line-length': [0, 'always', Infinity], // disable commit body length restriction
},
}
2 changes: 1 addition & 1 deletion src/command/manifest/manifest-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class ManifestCommand extends RootCommand {
this.console.log(this.resultHash)
}

private load(reference: Uint8Array): Promise<Data> {
private async load(reference: Uint8Array): Promise<Data> {
return this.bee.downloadData(referenceToHex(reference))
}

Expand Down
2 changes: 1 addition & 1 deletion src/command/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class Upload extends RootCommand implements LeafCommand {
}
}

private uploadAny(tag: Tag | undefined, isFolder: boolean): Promise<string> {
private async uploadAny(tag: Tag | undefined, isFolder: boolean): Promise<string> {
if (this.stdin) {
return this.uploadStdin(tag)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/service/identity/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function getSimpleWallet(wallet: SimpleWallet): Wallet {
return new Wallet(Buffer.from(privateKeyBytes))
}

export function getV3Wallet(wallet: V3Keystore, password: string): Promise<Wallet> {
export async function getV3Wallet(wallet: V3Keystore, password: string): Promise<Wallet> {
return Wallet.fromV3(wallet, password)
}

Expand Down
4 changes: 2 additions & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CommandLineError } from './error'
*
* @param ms Number of miliseconds to sleep
*/
export function sleep(ms: number): Promise<void> {
export async function sleep(ms: number): Promise<void> {
return new Promise<void>(resolve => setTimeout(() => resolve(), ms))
}

Expand Down Expand Up @@ -136,7 +136,7 @@ export function referenceToHex(reference: Reference | Uint8Array): string {
return Buffer.from(reference).toString('hex')
}

export function readStdin(commandLog: CommandLog): Promise<Buffer> {
export async function readStdin(commandLog: CommandLog): Promise<Buffer> {
const INTERVAL_SECS = 5

return new Promise((resolve, reject) => {
Expand Down