The actual snapshot is saved in prefer-at.mjs.snap
.
Generated by AVA.
1 | array[array.length - 1];
Output
`␊
1 | array.at(-1);␊
`
Error 1/1
`␊
> 1 | array[array.length - 1];␊
| ^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | array[array.length -1];
Output
`␊
1 | array.at(-1);␊
`
Error 1/1
`␊
> 1 | array[array.length -1];␊
| ^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | array[array.length - /* comment */ 1];
Output
`␊
1 | array.at(- /* comment */ 1);␊
`
Error 1/1
`␊
> 1 | array[array.length - /* comment */ 1];␊
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | array[array.length - 1.];
Output
`␊
1 | array.at(- 1.);␊
`
Error 1/1
`␊
> 1 | array[array.length - 1.];␊
| ^^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | array[array.length - 0b1];
Output
`␊
1 | array.at(- 0b1);␊
`
Error 1/1
`␊
> 1 | array[array.length - 0b1];␊
| ^^^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | array[array.length - 9];
Output
`␊
1 | array.at(-9);␊
`
Error 1/1
`␊
> 1 | array[array.length - 9];␊
| ^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | array[0][array[0].length - 1];
Output
`␊
1 | array[0].at(-1);␊
`
Error 1/1
`␊
> 1 | array[0][array[0].length - 1];␊
| ^^^^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | array[(( array.length )) - 1];
Output
`␊
1 | array.at(-1);␊
`
Error 1/1
`␊
> 1 | array[(( array.length )) - 1];␊
| ^^^^^^^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | array[array.length - (( 1 ))];
Output
`␊
1 | array.at(- (( 1 )));␊
`
Error 1/1
`␊
> 1 | array[array.length - (( 1 ))];␊
| ^^^^^^^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | array[(( array.length - 1 ))];
Output
`␊
1 | array.at((( -1 )));␊
`
Error 1/1
`␊
> 1 | array[(( array.length - 1 ))];␊
| ^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | (( array ))[array.length - 1];
Output
`␊
1 | (( array )).at(-1);␊
`
Error 1/1
`␊
> 1 | (( array ))[array.length - 1];␊
| ^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | (( array[array.length - 1] ));
Output
`␊
1 | (( array.at(-1) ));␊
`
Error 1/1
`␊
> 1 | (( array[array.length - 1] ));␊
| ^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | array[array.length - 1].pop().shift()[0];
Output
`␊
1 | array.at(-1).pop().shift()[0];␊
`
Error 1/1
`␊
> 1 | array[array.length - 1].pop().shift()[0];␊
| ^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | a = array[array.length - 1]
Output
`␊
1 | a = array.at(-1)␊
`
Error 1/1
`␊
> 1 | a = array[array.length - 1]␊
| ^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | const a = array[array.length - 1]
Output
`␊
1 | const a = array.at(-1)␊
`
Error 1/1
`␊
> 1 | const a = array[array.length - 1]␊
| ^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | const {a = array[array.length - 1]} = {}
Output
`␊
1 | const {a = array.at(-1)} = {}␊
`
Error 1/1
`␊
> 1 | const {a = array[array.length - 1]} = {}␊
| ^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | typeof array[array.length - 1]
Output
`␊
1 | typeof array.at(-1)␊
`
Error 1/1
`␊
> 1 | typeof array[array.length - 1]␊
| ^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | function foo() {return arguments[arguments.length - 1]}
Error 1/1
`␊
> 1 | function foo() {return arguments[arguments.length - 1]}␊
| ^^^^^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | class Foo {bar; baz() {return this.bar[this.bar.length - 1]}}
Output
`␊
1 | class Foo {bar; baz() {return this.bar.at(-1)}}␊
`
Error 1/1
`␊
> 1 | class Foo {bar; baz() {return this.bar[this.bar.length - 1]}}␊
| ^^^^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | class Foo {#bar; baz() {return this.#bar[this.#bar.length - 1]}}
Output
`␊
1 | class Foo {#bar; baz() {return this.#bar.at(-1)}}␊
`
Error 1/1
`␊
> 1 | class Foo {#bar; baz() {return this.#bar[this.#bar.length - 1]}}␊
| ^^^^^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | string.charAt(string.length - 1);
Error 1/1
`␊
> 1 | string.charAt(string.length - 1);␊
| ^^^^^^^^^^^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(….length - index)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | string.at(- 1);␊
`
1 | string.charAt(string.length - 0o11);
Error 1/1
`␊
> 1 | string.charAt(string.length - 0o11);␊
| ^^^^^^^^^^^^^^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(….length - index)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | string.at(- 0o11);␊
`
1 | some.string.charAt(some.string.length - 1);
Error 1/1
`␊
> 1 | some.string.charAt(some.string.length - 1);␊
| ^^^^^^^^^^^^^^^^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(….length - index)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | some.string.at(- 1);␊
`
1 | string.charAt((( string.length )) - 0xFF);
Error 1/1
`␊
> 1 | string.charAt((( string.length )) - 0xFF);␊
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(….length - index)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | string.at(- 0xFF);␊
`
1 | string.charAt(string.length - (( 1 )));
Error 1/1
`␊
> 1 | string.charAt(string.length - (( 1 )));␊
| ^^^^^^^^^^^^^^^^^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(….length - index)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | string.at(- (( 1 )));␊
`
1 | string.charAt((( string.length - 1 )));
Error 1/1
`␊
> 1 | string.charAt((( string.length - 1 )));␊
| ^^^^^^^^^^^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(….length - index)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | string.at((( - 1 )));␊
`
1 | (( string )).charAt(string.length - 1);
Error 1/1
`␊
> 1 | (( string )).charAt(string.length - 1);␊
| ^^^^^^^^^^^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(….length - index)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | (( string )).at(- 1);␊
`
1 | (( string.charAt ))(string.length - 1);
Error 1/1
`␊
> 1 | (( string.charAt ))(string.length - 1);␊
| ^^^^^^^^^^^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(….length - index)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | (( string.at ))(- 1);␊
`
1 | (( string.charAt(string.length - 1) ));
Error 1/1
`␊
> 1 | (( string.charAt(string.length - 1) ));␊
| ^^^^^^^^^^^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(….length - index)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | (( string.at(- 1) ));␊
`
1 | array.slice(-1)[0]
Output
`␊
1 | array.at(-1)␊
`
Error 1/1
`␊
> 1 | array.slice(-1)[0]␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-1).pop()
Output
`␊
1 | array.at(-1)␊
`
Error 1/1
`␊
> 1 | array.slice(-1).pop()␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-1.0).shift()
Output
`␊
1 | array.at(-1.0)␊
`
Error 1/1
`␊
> 1 | array.slice(-1.0).shift()␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-9)[0]
Output
`␊
1 | array.at(-9)␊
`
Error 1/1
`␊
> 1 | array.slice(-9)[0]␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-0xA)[0b000]
Output
`␊
1 | array.at(-0xA)␊
`
Error 1/1
`␊
> 1 | array.slice(-0xA)[0b000]␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-9).shift()
Output
`␊
1 | array.at(-9)␊
`
Error 1/1
`␊
> 1 | array.slice(-9).shift()␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-1)[(( 0 ))];
Output
`␊
1 | array.at(-1);␊
`
Error 1/1
`␊
> 1 | array.slice(-1)[(( 0 ))];␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-(( 1 )))[0];
Output
`␊
1 | array.at(-(( 1 )));␊
`
Error 1/1
`␊
> 1 | array.slice(-(( 1 )))[0];␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice((( -1 )))[0];
Output
`␊
1 | array.at((( -1 )));␊
`
Error 1/1
`␊
> 1 | array.slice((( -1 )))[0];␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | (( array.slice(-1) ))[0];
Output
`␊
1 | (( array.at(-1) ));␊
`
Error 1/1
`␊
> 1 | (( array.slice(-1) ))[0];␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | (( array )).slice(-1)[0];
Output
`␊
1 | (( array )).at(-1);␊
`
Error 1/1
`␊
> 1 | (( array )).slice(-1)[0];␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | (( array.slice(-1)[0] ));
Output
`␊
1 | (( array.at(-1) ));␊
`
Error 1/1
`␊
> 1 | (( array.slice(-1)[0] ));␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | (( array.slice(-1) )).pop();
Output
`␊
1 | (( array.at(-1) ));␊
`
Error 1/1
`␊
> 1 | (( array.slice(-1) )).pop();␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | (( array.slice(-1).pop ))();
Output
`␊
1 | (( array.at(-1) ));␊
`
Error 1/1
`␊
> 1 | (( array.slice(-1).pop ))();␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | (( array.slice(-1).pop() ));
Output
`␊
1 | (( array.at(-1) ));␊
`
Error 1/1
`␊
> 1 | (( array.slice(-1).pop() ));␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-1)[0].pop().shift().slice(-1)
Output
`␊
1 | array.at(-1).pop().shift().slice(-1)␊
`
Error 1/1
`␊
> 1 | array.slice(-1)[0].pop().shift().slice(-1)␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-9, -8)[0]
Output
`␊
1 | array.at(-9)␊
`
Error 1/1
`␊
> 1 | array.slice(-9, -8)[0]␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-9, -0o10)[0]
Output
`␊
1 | array.at(-9)␊
`
Error 1/1
`␊
> 1 | array.slice(-9, -0o10)[0]␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-9, -8).pop()
Output
`␊
1 | array.at(-9)␊
`
Error 1/1
`␊
> 1 | array.slice(-9, -8).pop()␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-9, -8).shift()
Output
`␊
1 | array.at(-9)␊
`
Error 1/1
`␊
> 1 | array.slice(-9, -8).shift()␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice((( -9 )), (( -8 )), ).shift()
Output
`␊
1 | array.at((( -9 )))␊
`
Error 1/1
`␊
> 1 | array.slice((( -9 )), (( -8 )), ).shift()␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | (( array.slice(-9, -8).shift ))()
Output
`␊
1 | (( array.at(-9) ))␊
`
Error 1/1
`␊
> 1 | (( array.slice(-9, -8).shift ))()␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
`
1 | array.slice(-9, unknown)[0]
Error 1/1
`␊
> 1 | array.slice(-9, unknown)[0]␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | array.at(-9)␊
`
1 | array.slice(-0o11, -7)[0]
Error 1/1
`␊
> 1 | array.slice(-0o11, -7)[0]␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | array.at(-0o11)␊
`
1 | array.slice(-9, unknown).shift()
Error 1/1
`␊
> 1 | array.slice(-9, unknown).shift()␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | array.at(-9)␊
`
1 | const KNOWN = -8; array.slice(-9, KNOWN).shift()
Error 1/1
`␊
> 1 | const KNOWN = -8; array.slice(-9, KNOWN).shift()␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | const KNOWN = -8; array.at(-9)␊
`
1 | array.slice(-9, 0)[0]
Error 1/1
`␊
> 1 | array.slice(-9, 0)[0]␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | array.at(-9)␊
`
1 | (( (( array.slice( ((-9)), ((unknown)), ).shift ))() ));
Error 1/1
`␊
> 1 | (( (( array.slice( ((-9)), ((unknown)), ).shift ))() ));␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | (( (( array.at( ((-9))) )) ));␊
`
1 | array.slice(-9, (a, really, _really, complicated, second) => argument)[0]
Error 1/1
`␊
> 1 | array.slice(-9, (a, really, _really, complicated, second) => argument)[0]␊
| ^^^^^ Prefer \`.at(…)\` over the first element from \`.slice(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | array.at(-9)␊
`
1 | _.last(array)
Output
`␊
1 | array.at(-1)␊
`
Error 1/1
`␊
> 1 | _.last(array)␊
| ^^^^^^ Prefer \`.at(-1)\` over \`_.last(…)\` to get the last element.␊
`
1 | lodash.last(array)
Output
`␊
1 | array.at(-1)␊
`
Error 1/1
`␊
> 1 | lodash.last(array)␊
| ^^^^^^^^^^^ Prefer \`.at(-1)\` over \`lodash.last(…)\` to get the last element.␊
`
1 | underscore.last(array)
Output
`␊
1 | array.at(-1)␊
`
Error 1/1
`␊
> 1 | underscore.last(array)␊
| ^^^^^^^^^^^^^^^ Prefer \`.at(-1)\` over \`underscore.last(…)\` to get the last element.␊
`
1 | _.last(new Array)
Output
`␊
1 | (new Array).at(-1)␊
`
Error 1/1
`␊
> 1 | _.last(new Array)␊
| ^^^^^^ Prefer \`.at(-1)\` over \`_.last(…)\` to get the last element.␊
`
1 | const foo = []
2 | _.last([bar])
Output
`␊
1 | const foo = []␊
2 | ;[bar].at(-1)␊
`
Error 1/1
`␊
1 | const foo = []␊
> 2 | _.last([bar])␊
| ^^^^^^ Prefer \`.at(-1)\` over \`_.last(…)\` to get the last element.␊
`
1 | const foo = []
2 | _.last( new Array )
Output
`␊
1 | const foo = []␊
2 | ;(new Array).at(-1)␊
`
Error 1/1
`␊
1 | const foo = []␊
> 2 | _.last( new Array )␊
| ^^^^^^ Prefer \`.at(-1)\` over \`_.last(…)\` to get the last element.␊
`
1 | const foo = []
2 | _.last( (( new Array )) )
Output
`␊
1 | const foo = []␊
2 | ;(( new Array )).at(-1)␊
`
Error 1/1
`␊
1 | const foo = []␊
> 2 | _.last( (( new Array )) )␊
| ^^^^^^ Prefer \`.at(-1)\` over \`_.last(…)\` to get the last element.␊
`
1 | if (foo) _.last([bar])
Output
`␊
1 | if (foo) [bar].at(-1)␊
`
Error 1/1
`␊
> 1 | if (foo) _.last([bar])␊
| ^^^^^^ Prefer \`.at(-1)\` over \`_.last(…)\` to get the last element.␊
`
1 | _.last(getLast(utils.lastOne(array)))
Options
`␊
[␊
{␊
"getLastElementFunctions": [␊
"getLast",␊
" utils.lastOne "␊
]␊
}␊
]␊
`
Output
`␊
1 | array.at(-1).at(-1).at(-1)␊
`
Error 1/3
`␊
> 1 | _.last(getLast(utils.lastOne(array)))␊
| ^^^^^^ Prefer \`.at(-1)\` over \`_.last(…)\` to get the last element.␊
`
Error 2/3
`␊
> 1 | _.last(getLast(utils.lastOne(array)))␊
| ^^^^^^^ Prefer \`.at(-1)\` over \`getLast(…)\` to get the last element.␊
`
Error 3/3
`␊
> 1 | _.last(getLast(utils.lastOne(array)))␊
| ^^^^^^^^^^^^^ Prefer \`.at(-1)\` over \`utils.lastOne(…)\` to get the last element.␊
`
1 | function foo() {return _.last(arguments)}
Error 1/1
`␊
> 1 | function foo() {return _.last(arguments)}␊
| ^^^^^^ Prefer \`.at(-1)\` over \`_.last(…)\` to get the last element.␊
`
1 | array[0]
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Output
`␊
1 | array.at(0)␊
`
Error 1/1
`␊
> 1 | array[0]␊
| ^ Prefer \`.at(…)\` over index access.␊
`
1 | array[1]
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Output
`␊
1 | array.at(1)␊
`
Error 1/1
`␊
> 1 | array[1]␊
| ^ Prefer \`.at(…)\` over index access.␊
`
1 | array[5 + 9]
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Output
`␊
1 | array.at(5 + 9)␊
`
Error 1/1
`␊
> 1 | array[5 + 9]␊
| ^^^^^ Prefer \`.at(…)\` over index access.␊
`
1 | const offset = 5;array[offset + 9]
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Output
`␊
1 | const offset = 5;array.at(offset + 9)␊
`
Error 1/1
`␊
> 1 | const offset = 5;array[offset + 9]␊
| ^^^^^^^^^^ Prefer \`.at(…)\` over index access.␊
`
1 | array[array.length - 1]
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Output
`␊
1 | array.at(-1)␊
`
Error 1/1
`␊
> 1 | array[array.length - 1]␊
| ^^^^^^^^^^^^^^^^ Prefer \`.at(…)\` over \`[….length - index]\`.␊
`
1 | string.charAt(9)
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Error 1/1
`␊
> 1 | string.charAt(9)␊
| ^ Prefer \`String#at(…)\` over \`String#charAt(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | string.at(9)␊
`
1 | string.charAt(5 + 9)
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Error 1/1
`␊
> 1 | string.charAt(5 + 9)␊
| ^^^^^ Prefer \`String#at(…)\` over \`String#charAt(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | string.at(5 + 9)␊
`
1 | const offset = 5;string.charAt(offset + 9)
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Error 1/1
`␊
> 1 | const offset = 5;string.charAt(offset + 9)␊
| ^^^^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | const offset = 5;string.at(offset + 9)␊
`
1 | string.charAt(unknown)
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Error 1/1
`␊
> 1 | string.charAt(unknown)␊
| ^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | string.at(unknown)␊
`
1 | string.charAt(-1)
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Error 1/1
`␊
> 1 | string.charAt(-1)␊
| ^^ Prefer \`String#at(…)\` over \`String#charAt(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | string.at(-1)␊
`
1 | string.charAt(1.5)
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Error 1/1
`␊
> 1 | string.charAt(1.5)␊
| ^^^ Prefer \`String#at(…)\` over \`String#charAt(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | string.at(1.5)␊
`
1 | string.charAt(1n)
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Error 1/1
`␊
> 1 | string.charAt(1n)␊
| ^^ Prefer \`String#at(…)\` over \`String#charAt(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | string.at(1n)␊
`
1 | string.charAt(string.length - 1)
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Error 1/1
`␊
> 1 | string.charAt(string.length - 1)␊
| ^^^^^^^^^^^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(….length - index)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | string.at(- 1)␊
`
1 | foo.charAt(bar.length - 1)
Options
`␊
[␊
{␊
"checkAllIndexAccess": true␊
}␊
]␊
`
Error 1/1
`␊
> 1 | foo.charAt(bar.length - 1)␊
| ^^^^^^^^^^^^^^ Prefer \`String#at(…)\` over \`String#charAt(…)\`.␊
␊
--------------------------------------------------------------------------------␊
Suggestion 1/1: Use \`.at(…)\`.␊
1 | foo.at(bar.length - 1)␊
`