Skip to content

Commit f39b02a

Browse files
authored
Various fixes (#2808)
1 parent 396a8fa commit f39b02a

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const config = [
4747
},
4848
{
4949
rules: {
50+
'no-sequences': ['error', {allowInParentheses: false}],
5051
'unicorn/escape-case': 'off',
5152
'unicorn/expiring-todo-comments': 'off',
5253
'unicorn/no-hex-escape': 'off',

rules/no-anonymous-default-export.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ const create = context => {
185185
optional: false,
186186
})
187187
|| (
188-
node.left.type === 'Identifier',
189-
node.left.name === 'exports'
188+
node.left.type === 'Identifier'
189+
&& node.left.name === 'exports'
190190
)
191191
)
192192
) {

rules/shared/simple-array-search-rule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function simpleArraySearchRule({method, replacement}) {
3838
const SUGGESTION = `${MESSAGE_ID_PREFIX}suggestion`;
3939
const ERROR_MESSAGES = {
4040
findIndex: 'Use `.indexOf()` instead of `.findIndex()` when looking for the index of an item.',
41-
findLastIndex: 'Use `.lastIndexOf()` instead of `findLastIndex() when looking for the index of an item.`',
41+
findLastIndex: 'Use `.lastIndexOf()` instead of `.findLastIndex() when looking for the index of an item.`',
4242
some: `Use \`.${replacement}()\` instead of \`.${method}()\` when checking value existence.`,
4343
};
4444

test/snapshots/prefer-array-index-of.js.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ Generated by [AVA](https://avajs.dev).
323323
`␊
324324
Message:␊
325325
> 1 | values.findLastIndex(x => x === "foo")␊
326-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
326+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
327327
328328
Output:␊
329329
1 | values.lastIndexOf("foo")␊
@@ -342,7 +342,7 @@ Generated by [AVA](https://avajs.dev).
342342
`␊
343343
Message:␊
344344
> 1 | values?.findLastIndex(x => x === "foo")␊
345-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
345+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
346346
347347
Output:␊
348348
1 | values?.lastIndexOf("foo")␊
@@ -361,7 +361,7 @@ Generated by [AVA](https://avajs.dev).
361361
`␊
362362
Message:␊
363363
> 1 | values.findLastIndex(x => "foo" === x)␊
364-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
364+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
365365
366366
Output:␊
367367
1 | values.lastIndexOf("foo")␊
@@ -380,7 +380,7 @@ Generated by [AVA](https://avajs.dev).
380380
`␊
381381
Message:␊
382382
> 1 | values.findLastIndex(x => {return x === "foo";})␊
383-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
383+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
384384
385385
Output:␊
386386
1 | values.lastIndexOf("foo")␊
@@ -399,7 +399,7 @@ Generated by [AVA](https://avajs.dev).
399399
`␊
400400
Message:␊
401401
> 1 | values.findLastIndex(function (x) {return x === "foo";})␊
402-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
402+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
403403
404404
Output:␊
405405
1 | values.lastIndexOf("foo")␊
@@ -427,7 +427,7 @@ Generated by [AVA](https://avajs.dev).
427427
2 | (0, values)␊
428428
3 | // 2␊
429429
> 4 | ./* 3 */findLastIndex /* 3 */ (␊
430-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
430+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
431431
5 | /* 4 */␊
432432
6 | x /* 5 */ => /* 6 */ x /* 7 */ === /* 8 */ "foo" /* 9 */␊
433433
7 | ) /* 10 */␊
@@ -457,7 +457,7 @@ Generated by [AVA](https://avajs.dev).
457457
`␊
458458
Message:␊
459459
> 1 | foo.findLastIndex(function (element) {␊
460-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
460+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
461461
2 | return element === bar.findLastIndex(x => x === 1);␊
462462
3 | });␊
463463
@@ -471,7 +471,7 @@ Generated by [AVA](https://avajs.dev).
471471
Message:␊
472472
1 | foo.findLastIndex(function (element) {␊
473473
> 2 | return element === bar.findLastIndex(x => x === 1);␊
474-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
474+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
475475
3 | });␊
476476
477477
Output:␊
@@ -493,7 +493,7 @@ Generated by [AVA](https://avajs.dev).
493493
`␊
494494
Message:␊
495495
> 1 | values.findLastIndex(x => x === (0, "foo"))␊
496-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
496+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
497497
498498
Output:␊
499499
1 | values.lastIndexOf((0, "foo"))␊
@@ -512,7 +512,7 @@ Generated by [AVA](https://avajs.dev).
512512
`␊
513513
Message:␊
514514
> 1 | values.findLastIndex((x => x === (0, "foo")))␊
515-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
515+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
516516
517517
Output:␊
518518
1 | values.lastIndexOf((0, "foo"))␊
@@ -534,7 +534,7 @@ Generated by [AVA](https://avajs.dev).
534534
Message:␊
535535
1 | function fn() {␊
536536
> 2 | foo.findLastIndex(x => x === arguments.length)␊
537-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
537+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
538538
3 | }␊
539539
540540
Output:␊
@@ -559,7 +559,7 @@ Generated by [AVA](https://avajs.dev).
559559
Message:␊
560560
1 | function fn() {␊
561561
> 2 | foo.findLastIndex(x => x === this[1])␊
562-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
562+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
563563
3 | }␊
564564
565565
Output:␊
@@ -581,7 +581,7 @@ Generated by [AVA](https://avajs.dev).
581581
`␊
582582
Message:␊
583583
> 1 | values.findLastIndex(x => x === foo())␊
584-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
584+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
585585
586586
Suggestion 1/1: Replace \`.findLastIndex()\` with \`.lastIndexOf()\`.:␊
587587
1 | values.lastIndexOf(foo())␊
@@ -604,7 +604,7 @@ Generated by [AVA](https://avajs.dev).
604604
`␊
605605
Message:␊
606606
> 1 | foo.findLastIndex(function a(x) {␊
607-
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`findLastIndex() when looking for the index of an item.\`␊
607+
| ^^^^^^^^^^^^^ Use \`.lastIndexOf()\` instead of \`.findLastIndex() when looking for the index of an item.\`␊
608608
2 | return x === (function (a) {␊
609609
3 | return a(this) === arguments[1]␊
610610
4 | }).call(thisObject, anotherFunctionNamedA, secondArgument)␊
4 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)