mirror of
https://github.com/tornadocash/provider.git
synced 2024-11-26 11:39:02 +01:00
43 lines
579 B
JavaScript
43 lines
579 B
JavaScript
|
|
const errors = [ {
|
|
} ];
|
|
|
|
module.exports = (ruleTester, rule) => ruleTester.run('prefer-string-slice', rule, {
|
|
valid: [
|
|
'foo.slice()',
|
|
'foo.slice(0)',
|
|
'foo.slice(1, 2)',
|
|
'foo.slice(-3, -2)',
|
|
],
|
|
|
|
invalid: [
|
|
{
|
|
code: 'foo.substr()',
|
|
output: 'foo.slice()',
|
|
errors,
|
|
},
|
|
{
|
|
code: '"foo".substr()',
|
|
output: '"foo".slice()',
|
|
errors,
|
|
},
|
|
|
|
{
|
|
code: 'foo.substr(start)',
|
|
errors,
|
|
},
|
|
{
|
|
code: '"foo".substr(1)',
|
|
errors,
|
|
},
|
|
{
|
|
code: 'foo.substr(start, length)',
|
|
errors,
|
|
},
|
|
{
|
|
code: '"foo".substr(1, 3)',
|
|
errors,
|
|
},
|
|
],
|
|
});
|