Skip to content

Commit

Permalink
prettier introduced + eslint cleanup (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
adam4leos authored Sep 8, 2023
1 parent 8ead4d3 commit f2cae01
Show file tree
Hide file tree
Showing 38 changed files with 8,188 additions and 7,421 deletions.
94 changes: 36 additions & 58 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,73 +1,51 @@
module.exports = {
parser : '@typescript-eslint/parser',
parserOptions : {
ecmaVersion : 'latest', // Allows the use of modern ECMAScript features
sourceType : 'module', // Allows for the use of imports
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest', // Allows the use of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
plugins: [
'@typescript-eslint',
'todo-plz' // for enforcing TODO formatting to require "github.com/TBD54566975/dwn-server/issues/"
'prettier',
'todo-plz', // for enforcing TODO formatting to require "github.com/TBD54566975/dwn-server/issues/"
],
env: {
node : true, // Enable Node.js global variables
browser : true
node: true, // Enable Node.js global variables
browser: true,
},
rules: {
'curly' : ['error', 'all'],
'no-console' : 'off',
'indent' : [
'error',
2
],
'object-curly-spacing' : ['error', 'always'],
'linebreak-style' : [
'error',
'unix'
],
'quotes': [
'error',
'single',
{ 'allowTemplateLiterals': true }
],
'@typescript-eslint/semi' : ['error', 'always'],
'semi' : ['off'],
'no-multi-spaces' : ['error'],
'no-trailing-spaces' : ['error'],
'max-len' : ['error', { 'code': 150, 'ignoreStrings': true }],
'key-spacing' : [
'prettier/prettier': 'error',
curly: ['error', 'all'],
'no-console': 'off',
'@typescript-eslint/explicit-function-return-type': ['error'],
// enforce `import type` when an import is not used at runtime, allowing transpilers/bundlers to drop imports as an optimization
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{
'align': {
'beforeColon' : true,
'afterColon' : true,
'on' : 'colon'
}
}
vars: 'all',
args: 'after-used',
ignoreRestSiblings: true,
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'keyword-spacing' : ['error', { 'before': true, 'after': true }],
'@typescript-eslint/explicit-function-return-type' : ['error'],
'no-unused-vars' : 'off',
// enforce `import type` when an import is not used at runtime, allowing transpilers/bundlers to drop imports as an optimization
'@typescript-eslint/consistent-type-imports' : 'error',
'@typescript-eslint/no-unused-vars' : [
'prefer-const': ['error', { destructuring: 'all' }],
'sort-imports': [
'error',
{
'vars' : 'all',
'args' : 'after-used',
'ignoreRestSiblings' : true,
'argsIgnorePattern' : '^_',
'varsIgnorePattern' : '^_'
}
ignoreCase: true,
ignoreDeclarationSort: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'],
allowSeparatedGroups: true,
},
],
'prefer-const' : ['error', { 'destructuring': 'all' }],
'sort-imports' : ['error', {
'ignoreCase' : true,
'ignoreDeclarationSort' : false,
'ignoreMemberSort' : false,
'memberSyntaxSortOrder' : ['none', 'all', 'single', 'multiple'],
'allowSeparatedGroups' : true
}],
// enforce github issue reference for every TO-DO comment
'todo-plz/ticket-ref': ['error', { 'commentPattern': '.*github\.com\/TBD54566975\/dwn-server\/issues\/.*' }],
}
};
'todo-plz/ticket-ref': [
'error',
{ commentPattern: '.*github.com/TBD54566975/dwn-server/issues/.*' },
],
},
extends: ['prettier'],
};
26 changes: 13 additions & 13 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Check out repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 18
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 18

- name: Install dependencies
run: npm install
- name: Install dependencies
run: npm install

- name: Run tests
run: npm run test
- name: Run linter
run: npm run lint
- name: Run tests
run: npm run test

- name: Run linter
run: npm run lint
4 changes: 2 additions & 2 deletions .github/workflows/docker-image-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ jobs:
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Retrieve DWN SDK version
run: |
echo "dwn_sdk_image_tag=${{ env.REGISTRY }}/${IMAGE_NAME,,}:dwn-sdk-$(jq -r '.dependencies."@tbd54566975/dwn-sdk-js"' package.json)" >> $GITHUB_OUTPUT
id: dwn_sdk_version
env:
IMAGE_NAME: ${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish package to NPM Registry
on:
release:
types: [created]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand Down Expand Up @@ -82,4 +82,4 @@ jobs:
if: env.IS_LATEST == 'true'
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
run: npm publish --access public --provenance
run: npm publish --access public --provenance
2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"enable-source-maps": true
}
}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*.yaml
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
24 changes: 11 additions & 13 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

# TBD Code of Conduct

TBD builds infrastructure for the next wave of innovation in financial services — which we believe will be decentralized, permissionless, and non-custodial. This means opening the global economy to everyone. We extend the same principles of inclusion to our developer ecosystem. We are excited to build with you. So we will ensure our community is truly open, transparent and inclusive. Because of the global nature of our project, diversity and inclusivity is paramount to our success. We not only welcome diverse perspectives, we **need** them!

The code of conduct below reflects the expectations for ourselves and for our community.


## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
Expand All @@ -22,23 +20,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 and welcoming 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 and welcoming 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 overall
- 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 advances of
- 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 address,
- 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 @@ -90,7 +88,7 @@ actions.
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media and forums.
like social media and forums.

Although this list cannot be exhaustive, we explicitly honor diversity in age, culture, ethnicity, gender identity or expression, language, national origin, political beliefs, profession, race, religion, sexual orientation, socioeconomic status, and technical ability. We will not tolerate discrimination based on any of the protected characteristics above, including participants with disabilities.

Expand Down
60 changes: 30 additions & 30 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,66 @@

<!-- TOC -->

* [Contributors](#contributors)
* [Maintainers](#maintainers)
* [Governance Committee](#governance-committee)
- [Contributors](#contributors)
- [Maintainers](#maintainers)
- [Governance Committee](#governance-committee)

<!-- /TOC -->

## Contributors

Anyone may be a contributor to TBD projects. Contribution may take the form of:

* Asking and answering questions on the development forums
* Filing an issue
* Offering a feature or bug fix via a Pull Request
* Suggesting documentation improvements
* ...and more!
- Asking and answering questions on the development forums
- Filing an issue
- Offering a feature or bug fix via a Pull Request
- Suggesting documentation improvements
- ...and more!

Anyone with a GitHub account may use the project issue trackers and communications channels. We welcome newcomers, so don't hesitate to say hi!

## Maintainers

Maintainers have write access to GitHub repositories and act as project administrators. They approve and merge pull requests, cut releases, and guide collaboration with the community. They have:

* Commit access to their project's repositories
* Write access to continuous integration (CI) jobs
- Commit access to their project's repositories
- Write access to continuous integration (CI) jobs

Both maintainers and non-maintainers may propose changes to
Both maintainers and non-maintainers may propose changes to
source code. The mechanism to propose such a change is a GitHub pull request. Maintainers review and merge (_land_) pull requests.

If a maintainer opposes a proposed change, then the change cannot land. The exception is if the Governance Committee (GC) votes to approve the change despite the opposition. Usually, involving the GC is unnecessary.

See:

* [List of maintainers - `MAINTAINERS.md`](./MAINTAINERS.md)
* [Contribution Guide - `CONTRIBUTING.md`](./CONTRIBUTING.md)
- [List of maintainers - `MAINTAINERS.md`](./MAINTAINERS.md)
- [Contribution Guide - `CONTRIBUTING.md`](./CONTRIBUTING.md)

### Maintainer activities

* Helping users and novice contributors
* Contributing code and documentation changes that improve the project
* Reviewing and commenting on issues and pull requests
* Participation in working groups
* Merging pull requests
- Helping users and novice contributors
- Contributing code and documentation changes that improve the project
- Reviewing and commenting on issues and pull requests
- Participation in working groups
- Merging pull requests

## Governance Committee

The TBD Open Source Governance Committee (GC) has final authority over this project, including:

* Technical direction
* Project governance and process (including this policy)
* Contribution policy
* GitHub repository hosting
* Conduct guidelines
* Maintaining the list of maintainers
- Technical direction
- Project governance and process (including this policy)
- Contribution policy
- GitHub repository hosting
- Conduct guidelines
- Maintaining the list of maintainers

The current GC members are:

* Angie Jones, Head of Developer Relations, TBD
* Julie Kim, Head of Legal, TBD
* Nidhi Nahar, Head of Patents and Open Source, Block
* Andrew Lee Rubinger, Head of Open Source, TBD
* Max Sills, Counsel for Intellectual Property, Block
- Angie Jones, Head of Developer Relations, TBD
- Julie Kim, Head of Legal, TBD
- Nidhi Nahar, Head of Patents and Open Source, Block
- Andrew Lee Rubinger, Head of Open Source, TBD
- Max Sills, Counsel for Intellectual Property, Block

Members are not to be contacted individually. The GC may be reached through `[email protected]` and is an available resource in mediation or for sensitive cases beyond the scope of project maintainers. It operates as a "Self-appointing council or board" as defined by Red Hat: [Open Source Governance Models](https://www.redhat.com/en/blog/understanding-open-source-governance-models).
Members are not to be contacted individually. The GC may be reached through `[email protected]` and is an available resource in mediation or for sensitive cases beyond the scope of project maintainers. It operates as a "Self-appointing council or board" as defined by Red Hat: [Open Source Governance Models](https://www.redhat.com/en/blog/understanding-open-source-governance-models).
Loading

0 comments on commit f2cae01

Please sign in to comment.