-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add ESLint rule for BN imports #197
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8c243a7
separate bn conversion script from pre-commit
tatomir-streamflow 06b683a
add eslint rule and improve script
tatomir-streamflow cc99722
fix missing .js extensions in exports and bump alpha version
tatomir-streamflow 4a547b9
more missing .js extensions and BigNumber fixes
tatomir-streamflow cc158ff
replace npm with pnpm
tatomir-streamflow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 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 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 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 +1 @@ | ||
export * as StreamflowDistributorSolana from "./solana"; | ||
export * as StreamflowDistributorSolana from "./solana/index.js"; | ||
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 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,13 +1,13 @@ | ||
export { default as SolanaDistributorClient } from "./client"; | ||
|
||
export * from "./generated/accounts"; | ||
export * from "./generated/accounts/index.js"; | ||
|
||
export * from "./generated/errors"; | ||
export * from "./generated/errors/index.js"; | ||
|
||
export * from "./generated/instructions"; | ||
export * from "./generated/instructions/index.js"; | ||
|
||
export * from "./utils"; | ||
export * from "./utils.js"; | ||
|
||
export * from "./types"; | ||
export * from "./types.js"; | ||
|
||
export * as constants from "./constants"; | ||
export * as constants from "./constants.js"; |
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 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 |
---|---|---|
|
@@ -19,6 +19,13 @@ module.exports = { | |
}, | ||
ignorePatterns: ["**/dist/**/*"], | ||
rules: { | ||
"no-restricted-imports": [ | ||
"error", | ||
{ | ||
name: "bn.js", | ||
message: "We no longer use BN.js for big number calculations. Switch to using bignumber.js instead. Run npm run convert-bn to automatically switch BN to BigNumber in all folders" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since we use pnpm maybe we can stick to it? |
||
} | ||
], | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
|
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 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 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,7 +1,7 @@ | ||
export { default, default as AptosStreamClient } from "./StreamClient.js"; | ||
|
||
export * from "./utils"; | ||
export * from "./utils.js"; | ||
|
||
export * from "./types"; | ||
export * from "./types.js"; | ||
|
||
export * as constants from "./constants"; | ||
export * as constants from "./constants.js"; |
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 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 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,11 +1,11 @@ | ||
export * as StreamflowAptos from "./aptos"; | ||
export * as StreamflowEVM from "./evm"; | ||
export * as StreamflowSolana from "./solana"; | ||
export * as StreamflowSui from "./sui"; | ||
export * as StreamflowAptos from "./aptos/index.js"; | ||
export * as StreamflowEVM from "./evm/index.js"; | ||
export * as StreamflowSolana from "./solana/index.js"; | ||
export * as StreamflowSui from "./sui/index.js"; | ||
|
||
export * from "./common/types"; | ||
export * from "./common/utils"; | ||
export * from "./common/constants"; | ||
export * from "./common/contractUtils"; | ||
export * from "./common/types.js"; | ||
export * from "./common/utils.js"; | ||
export * from "./common/constants.js"; | ||
export * from "./common/contractUtils.js"; | ||
|
||
export { default as GenericStreamClient } from "./common/GenericStreamClient"; | ||
export { default as GenericStreamClient } from "./common/GenericStreamClient.js"; |
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 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,21 @@ | ||
#!/bin/sh | ||
|
||
if [ $# -eq 0 ]; then | ||
TARGET_FOLDERS="packages" | ||
else | ||
TARGET_FOLDERS=$@ | ||
fi | ||
|
||
OS=$(uname) | ||
|
||
if [ "$OS" = "Darwin" ]; then | ||
SED_NO_BACKUP=( -i '' ) | ||
else | ||
SED_NO_BACKUP=( -i ) | ||
fi | ||
|
||
for FOLDER in $TARGET_FOLDERS | ||
do | ||
echo "Replacing 'BN' with 'BigNumber' in $FOLDER and its subfolders" | ||
find "$FOLDER" -type f -name "*.ts[x]" -exec sed "${SED_NO_BACKUP[@]}" -e 's/BN/BigNumber/g' -e 's/bn/bignumber/g' {} + | ||
done |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you said you were planning to migrate scoped exports here, do I miss anything here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave up on that - there are issues with v7 even with that, right now I paused that work in favour of more prio work (aligned unlocks/airdrops)