generated from ChainSafe/typescript-lib-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from ChainSafe/update-project
fix!: rename project, use automated release, update configs and dependencies
- Loading branch information
Showing
19 changed files
with
961 additions
and
2,239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,111 +1,3 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
browser: true, | ||
node: true, | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint', 'header', 'deprecation', 'eslint-plugin-tsdoc', 'no-null'], | ||
extends: [ | ||
'airbnb-base', | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:@typescript-eslint/recommended-requiring-type-checking', | ||
'prettier', | ||
'plugin:import/errors', | ||
'plugin:import/warnings', | ||
'plugin:import/typescript', | ||
], | ||
rules: { | ||
'deprecation/deprecation': 'error', | ||
'class-methods-use-this': ['error'], | ||
'no-unused-expressions': ['error'], | ||
'no-continue': 'off', | ||
'no-underscore-dangle': 'off', | ||
'import/prefer-default-export': 'off', | ||
'lines-between-class-members': 'off', | ||
'no-use-before-define': ['error'], | ||
'no-shadow': 'off', | ||
'@typescript-eslint/no-shadow': ['error'], | ||
'no-console': ['error', { allow: ['error', 'info', 'warn'] }], | ||
'@typescript-eslint/no-floating-promises': ['error'], | ||
'@typescript-eslint/prefer-for-of': ['error'], | ||
'@typescript-eslint/consistent-type-assertions': ['error'], | ||
'@typescript-eslint/explicit-member-accessibility': ['error'], | ||
'@typescript-eslint/member-delimiter-style': ['error'], | ||
'@typescript-eslint/member-ordering': [ | ||
'error', | ||
{ default: ['public-static-field', 'public-instance-method'] }, | ||
], | ||
'@typescript-eslint/no-extraneous-class': ['error'], | ||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': ['error'], | ||
'@typescript-eslint/no-unnecessary-qualifier': ['error'], | ||
'@typescript-eslint/no-unnecessary-type-arguments': ['error'], | ||
'@typescript-eslint/prefer-function-type': ['error'], | ||
'@typescript-eslint/prefer-includes': ['error'], | ||
'@typescript-eslint/prefer-nullish-coalescing': ['error'], | ||
'@typescript-eslint/prefer-optional-chain': ['error'], | ||
'@typescript-eslint/prefer-readonly': ['error'], | ||
'@typescript-eslint/prefer-reduce-type-parameter': ['error'], | ||
'@typescript-eslint/prefer-string-starts-ends-with': ['error'], | ||
'@typescript-eslint/prefer-ts-expect-error': ['error'], | ||
'@typescript-eslint/promise-function-async': ['error'], | ||
'@typescript-eslint/require-array-sort-compare': ['error'], | ||
'@typescript-eslint/switch-exhaustiveness-check': ['error'], | ||
'@typescript-eslint/type-annotation-spacing': ['error'], | ||
// Multiple constructors are more readable | ||
'@typescript-eslint/unified-signatures': 'off', | ||
'@typescript-eslint/no-unused-expressions': ['error'], | ||
'@typescript-eslint/no-useless-constructor': ['error'], | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/ban-types': [ | ||
'error', | ||
{ | ||
types: { | ||
null: "Use 'undefined' instead of 'null'", | ||
}, | ||
}, | ||
], | ||
'@typescript-eslint/no-unused-vars': 'warn', | ||
'import/extensions': [ | ||
'error', | ||
'ignorePackages', | ||
{ | ||
js: 'never', | ||
jsx: 'never', | ||
ts: 'never', | ||
tsx: 'never', | ||
}, | ||
], | ||
'no-await-in-loop': ['error'], | ||
'no-restricted-syntax': [ | ||
'error', | ||
{ | ||
selector: 'ForInStatement', | ||
message: | ||
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.', | ||
}, | ||
{ | ||
selector: 'LabeledStatement', | ||
message: | ||
'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.', | ||
}, | ||
{ | ||
selector: 'WithStatement', | ||
message: | ||
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.', | ||
}, | ||
], | ||
'no-null/no-null': ['error'], | ||
'tsdoc/syntax': 'warn', | ||
}, | ||
globals: { | ||
BigInt: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2016, | ||
project: './tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
extends: "@chainsafe" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "yarn" | ||
schedule: | ||
interval: weekly | ||
requiredLabels: | ||
- dependencies | ||
commit-message: | ||
prefix: fix | ||
prefix-development: chore | ||
include: scope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: "Semantic PR" | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
main: | ||
name: Validate PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
types: | | ||
fix | ||
feat | ||
chore | ||
revert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
maybe-release: | ||
name: release | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
steps: | ||
|
||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
release-type: node | ||
package-name: release-please-action | ||
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":true},{"type":"revert","hidden":true}]' | ||
|
||
- uses: actions/checkout@v3 | ||
if: ${{ steps.release.outputs.releases_created }} | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: 'yarn' | ||
node-version: 18 | ||
registry-url: 'https://registry.npmjs.org' | ||
if: ${{ steps.release.outputs.releases_created }} | ||
|
||
- run: corepack enable | ||
if: ${{ steps.release.outputs.releases_created }} | ||
|
||
- run: yarn install --immutable | ||
if: ${{ steps.release.outputs.releases_created }} | ||
|
||
- run: yarn build | ||
if: ${{ steps.release.outputs.releases_created }} | ||
|
||
- run: yarn build:web | ||
if: ${{ steps.release.outputs.releases_created }} | ||
|
||
- env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
if: ${{ steps.release.outputs.releases_created }} | ||
run: | | ||
echo npmAuthToken: "$NODE_AUTH_TOKEN" >> ./.yarnrc.yml | ||
- run: yarn publish --access public | ||
if: ${{ steps.release.outputs.releases_created }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,10 +21,10 @@ yarn add @chainsafe/web3.js-chainlink-plugin | |
|
||
### Installing Version `4.x` of `web3` | ||
|
||
When adding the `web3` package to your project, make sure to use version `4.x`. You can append `@4.0.2-dev.af57eae.0` tag to install the latest version of 4 that this plugin was tested with: | ||
When adding the `web3` package to your project, make sure to use version `4.x`: | ||
|
||
- `npm i -S [email protected].2-dev.af57eae.0` | ||
- `yarn add [email protected].2-dev.af57eae.0` | ||
- `npm i -S [email protected].3` | ||
- `yarn add [email protected].3` | ||
|
||
> **_NOTE_** | ||
> If 4.x was already released, you are good to just use `web3` without appending anything to it. | ||
|
@@ -33,16 +33,16 @@ To verify you have the correct `web3` version installed, after adding the packag | |
|
||
```json | ||
"dependencies": { | ||
"web3": "4.0.2-dev.af57eae.0" | ||
"web3": "4.0.3" | ||
} | ||
``` | ||
|
||
### Registering the Plugin with a web3.js Instance | ||
|
||
After importing `ChainlinkPlugin` from `@chainsafe/web3.js-chainlink-plugin` and `Web3` from `web3`, register an instance of `ChainlinkPlugin` with an instance of `Web3` like so: | ||
After importing `ChainlinkPlugin` from `@chainsafe/web3-plugin-chainlink` and `Web3` from `web3`, register an instance of `ChainlinkPlugin` with an instance of `Web3` like so: | ||
|
||
```typescript | ||
import { ChainlinkPlugin } from '@chainsafe/web3.js-chainlink-plugin'; | ||
import { ChainlinkPlugin } from '@chainsafe/web3-plugin-chainlink'; | ||
import { Web3 } from 'web3'; | ||
|
||
const web3 = new Web3('YOUR_PROVIDER_URL'); | ||
|
@@ -81,7 +81,7 @@ The `getPrice` method, accepts `MainnetPriceFeeds | GoerliPriceFeeds | Address` | |
Under the hood, this method is calling the `latestRoundData` for the specified price feed, more information about it can be found [here](https://docs.chain.link/data-feeds/price-feeds/api-reference#latestrounddata). | ||
|
||
```typescript | ||
import { ChainlinkPlugin, MainnetPriceFeeds } from '@chainsafe/web3.js-chainlink-plugin'; | ||
import { ChainlinkPlugin, MainnetPriceFeeds } from '@chainsafe/web3-plugin-chainlink'; | ||
import { Web3 } from 'web3'; | ||
|
||
const web3 = new Web3('YOUR_PROVIDER_URL'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.