Skip to content

Commit 9e2a071

Browse files
committed
add: explanation to script
1 parent cd0cd04 commit 9e2a071

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/rules/best-practises/explicit-types.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,16 @@ class ExplicitTypesChecker extends BaseChecker {
182182
fixStatement(node, errorVar) {
183183
const range = this.findTypeRanges(node, errorVar)
184184

185-
// previous script searches all json and if two unit are in the same line
185+
// previous script searches all json and if two uint/uint256/ufixed/etc are in the same line
186186
// it will return two set of range values
187+
// this is to remove the first one if it's already been corrected
188+
// and to push it to the array to store the corrected ones
187189
if (alreadyFixedRanges.includes(range[0])) {
188190
range.shift()
189191
}
190192
alreadyFixedRanges.push(range[0])
191193

194+
// only check the first range returned when findTypesRanges return two or more
192195
const charsToReplace = errorVar.length - 1
193196
range[0][1] = range[0][0] + charsToReplace
194197

0 commit comments

Comments
 (0)