File tree Expand file tree Collapse file tree 5 files changed +10
-6
lines changed Expand file tree Collapse file tree 5 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -212,6 +212,10 @@ module.exports = {
212212 selector : 'ThrowStatement > CallExpression[callee.name=/Error$/]' ,
213213 message : 'Use `new` keyword when throwing an `Error`.' ,
214214 } ,
215+ {
216+ selector : "CallExpression[callee.property.name='substr']" ,
217+ message : 'Use String.prototype.slice() or String.prototype.substring() instead of String.prototype.substr()' ,
218+ } ,
215219 {
216220 selector : "CallExpression[callee.name='isNaN']" ,
217221 message : 'Use Number.isNaN() instead of the global isNaN() function.' ,
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ function main({ len, n }) {
4646 let header = `GET /hello HTTP/1.1${ CRLF } Content-Type: text/plain${ CRLF } ` ;
4747
4848 for ( let i = 0 ; i < len ; i ++ ) {
49- header += `X-Filler${ i } : ${ Math . random ( ) . toString ( 36 ) . substr ( 2 ) } ${ CRLF } ` ;
49+ header += `X-Filler${ i } : ${ Math . random ( ) . toString ( 36 ) . substring ( 2 ) } ${ CRLF } ` ;
5050 }
5151 header += CRLF ;
5252
Original file line number Diff line number Diff line change @@ -958,7 +958,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
958958 srcPath . unshift ( '' ) ;
959959 }
960960
961- if ( hasTrailingSlash && ( srcPath . join ( '/' ) . substr ( - 1 ) !== '/' ) ) {
961+ if ( hasTrailingSlash && ( srcPath . join ( '/' ) . slice ( - 1 ) !== '/' ) ) {
962962 srcPath . push ( '' ) ;
963963 }
964964
Original file line number Diff line number Diff line change @@ -394,8 +394,8 @@ function versionSort(a, b) {
394394 b = minVersion ( b ) . trim ( ) ;
395395 let i = 0 ; // Common prefix length.
396396 while ( i < a . length && i < b . length && a [ i ] === b [ i ] ) i ++ ;
397- a = a . substr ( i ) ;
398- b = b . substr ( i ) ;
397+ a = a . substring ( i ) ;
398+ b = b . substring ( i ) ;
399399 return + b . match ( numberRe ) [ 0 ] - + a . match ( numberRe ) [ 0 ] ;
400400}
401401
Original file line number Diff line number Diff line change @@ -320,8 +320,8 @@ function parseSignature(text, sig) {
320320
321321 const eq = sigParam . indexOf ( '=' ) ;
322322 if ( eq !== - 1 ) {
323- defaultValue = sigParam . substr ( eq + 1 ) ;
324- sigParam = sigParam . substr ( 0 , eq ) ;
323+ defaultValue = sigParam . substring ( eq + 1 ) ;
324+ sigParam = sigParam . substring ( 0 , eq ) ;
325325 }
326326
327327 // At this point, the name should match. If it doesn't find one that does.
You can’t perform that action at this time.
0 commit comments