-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(NODE-4976): ensure all use of BigInt is gated by the useBigInt64…
… flag (#558)
- Loading branch information
Showing
19 changed files
with
3,542 additions
and
116 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
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,16 @@ | ||
#!/bin/bash | ||
|
||
if [ -z "$NODE_VERSION" ]; then | ||
echo "NODE_VERSION environment variable must be specified" | ||
exit 1 | ||
fi | ||
|
||
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts" | ||
|
||
export PATH="/opt/mongodbtoolchain/v2/bin:$PATH" | ||
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | ||
|
||
cd etc/eslint/no-bigint-usage | ||
npm install | ||
npm run test |
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 |
---|---|---|
|
@@ -29,3 +29,5 @@ docs/public | |
*.0x | ||
*.cpuprofile | ||
*.heapprofile | ||
|
||
.nvmrc |
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,5 @@ | ||
# no-bigint-usage | ||
|
||
Simple eslint plugin to disallow the use of BigInt literals and associated APIs. | ||
|
||
Based on [this tutorial by Linus Spukas](https://dev.to/spukas/how-to-write-your-first-eslint-plugin-145) |
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,20 @@ | ||
function noBigIntLiterals(context) { | ||
return { | ||
Literal(node) { | ||
if (node.bigint && /n$/.test(node.raw)) { | ||
context.report( | ||
{ | ||
node, | ||
message: 'BigInt literals not allowed' | ||
} | ||
) | ||
} | ||
} | ||
}; | ||
} | ||
|
||
module.exports = { | ||
rules: { | ||
'no-bigint-literals': { create: noBigIntLiterals } | ||
} | ||
} |
Oops, something went wrong.