This plugin converts all evm addresses to their checksummed version
Test it on Stackblitz
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-evm-address-to-checksummed
:
npm install eslint-plugin-evm-address-to-checksummed --save-dev
Add evm-address-to-checksummed
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"evm-address-to-checksummed"
]
}
Then, configure the rules you want to use under the rules section.
{
"rules": {
"evm-address-to-checksummed/evm-address-to-checksummed": "error",
"evm-address-to-checksummed/case-typo-in-evm-address": "error"
}
}
There are two rules:
case-typo-in-evm-address
evm-address-to-checksummed
The reason for rule 1 is, some address can be invalid due to uppercase values in an incorrect place (could be due to invalid checksumming or just a typo). This would not hit the rule 2 (main) rule as that rule only seeks to lint valid addresses.
This ensures flexibility as that function can be disabled at will rather than bundling both functions in a single rule
🔧 Automatically fixable by the --fix
CLI option.
Name | Description | 🔧 |
---|---|---|
case-typo-in-evm-address | This rule checks if the address is close to validity (invalid due to incorrect uppercase) | 🔧 |
evm-address-to-checksummed | This converts valid evm addresses to the checksummed version | 🔧 |