Skip to content

Commit 317834e

Browse files
armano2JamesHenry
authored andcommitted
[CHORE] [adjacent-overload-signatures] migrate error message to messageId (typescript-eslint#221)
1 parent 0017a0e commit 317834e

File tree

2 files changed

+66
-33
lines changed

2 files changed

+66
-33
lines changed

Diff for: packages/eslint-plugin-typescript/lib/rules/adjacent-overload-signatures.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module.exports = {
1818
url: util.metaDocsUrl("adjacent-overload-signatures"),
1919
},
2020
schema: [],
21+
messages: {
22+
adjacentSignature: "All '{{name}}' signatures should be adjacent.",
23+
},
2124
},
2225

2326
create(context) {
@@ -93,8 +96,7 @@ module.exports = {
9396
if (index > -1 && lastName !== name) {
9497
context.report({
9598
node: member,
96-
message:
97-
"All '{{name}}' signatures should be adjacent.",
99+
messageId: "adjacentSignature",
98100
data: {
99101
name,
100102
},

Diff for: packages/eslint-plugin-typescript/tests/lib/rules/adjacent-overload-signatures.js

+62-31
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ export function foo(sn: string | number) {}
228228
`,
229229
errors: [
230230
{
231-
message: "All 'foo' signatures should be adjacent.",
231+
messageId: "adjacentSignature",
232+
data: { name: "foo" },
232233
line: 6,
233234
column: 1,
234235
},
@@ -244,7 +245,8 @@ export function foo(sn: string | number) {}
244245
`,
245246
errors: [
246247
{
247-
message: "All 'foo' signatures should be adjacent.",
248+
messageId: "adjacentSignature",
249+
data: { name: "foo" },
248250
line: 6,
249251
column: 1,
250252
},
@@ -260,7 +262,8 @@ function foo(sn: string | number) {}
260262
`,
261263
errors: [
262264
{
263-
message: "All 'foo' signatures should be adjacent.",
265+
messageId: "adjacentSignature",
266+
data: { name: "foo" },
264267
line: 6,
265268
column: 1,
266269
},
@@ -276,7 +279,8 @@ function foo(sn: string | number) {}
276279
`,
277280
errors: [
278281
{
279-
message: "All 'foo' signatures should be adjacent.",
282+
messageId: "adjacentSignature",
283+
data: { name: "foo" },
280284
line: 6,
281285
column: 1,
282286
},
@@ -292,7 +296,8 @@ function foo(sn: string | number) {}
292296
`,
293297
errors: [
294298
{
295-
message: "All 'foo' signatures should be adjacent.",
299+
messageId: "adjacentSignature",
300+
data: { name: "foo" },
296301
line: 6,
297302
column: 1,
298303
},
@@ -307,7 +312,8 @@ function foo(sn: string | number) {}
307312
`,
308313
errors: [
309314
{
310-
message: "All 'foo' signatures should be adjacent.",
315+
messageId: "adjacentSignature",
316+
data: { name: "foo" },
311317
line: 5,
312318
column: 1,
313319
},
@@ -327,7 +333,8 @@ class Bar {
327333
`,
328334
errors: [
329335
{
330-
message: "All 'foo' signatures should be adjacent.",
336+
messageId: "adjacentSignature",
337+
data: { name: "foo" },
331338
line: 9,
332339
column: 5,
333340
},
@@ -343,7 +350,8 @@ declare function foo(sn: string | number);
343350
`,
344351
errors: [
345352
{
346-
message: "All 'foo' signatures should be adjacent.",
353+
messageId: "adjacentSignature",
354+
data: { name: "foo" },
347355
line: 6,
348356
column: 1,
349357
},
@@ -359,7 +367,8 @@ declare function foo(sn: string | number);
359367
`,
360368
errors: [
361369
{
362-
message: "All 'foo' signatures should be adjacent.",
370+
messageId: "adjacentSignature",
371+
data: { name: "foo" },
363372
line: 6,
364373
column: 1,
365374
},
@@ -377,7 +386,8 @@ declare module "Foo" {
377386
`,
378387
errors: [
379388
{
380-
message: "All 'foo' signatures should be adjacent.",
389+
messageId: "adjacentSignature",
390+
data: { name: "foo" },
381391
line: 7,
382392
column: 5,
383393
},
@@ -397,7 +407,8 @@ declare module "Foo" {
397407
`,
398408
errors: [
399409
{
400-
message: "All 'baz' signatures should be adjacent.",
410+
messageId: "adjacentSignature",
411+
data: { name: "baz" },
401412
line: 8,
402413
column: 5,
403414
},
@@ -415,7 +426,8 @@ declare namespace Foo {
415426
`,
416427
errors: [
417428
{
418-
message: "All 'foo' signatures should be adjacent.",
429+
messageId: "adjacentSignature",
430+
data: { name: "foo" },
419431
line: 7,
420432
column: 5,
421433
},
@@ -435,7 +447,8 @@ declare namespace Foo {
435447
`,
436448
errors: [
437449
{
438-
message: "All 'baz' signatures should be adjacent.",
450+
messageId: "adjacentSignature",
451+
data: { name: "baz" },
439452
line: 8,
440453
column: 5,
441454
},
@@ -453,7 +466,8 @@ type Foo = {
453466
`,
454467
errors: [
455468
{
456-
message: "All 'foo' signatures should be adjacent.",
469+
messageId: "adjacentSignature",
470+
data: { name: "foo" },
457471
line: 7,
458472
column: 5,
459473
},
@@ -471,7 +485,8 @@ type Foo = {
471485
`,
472486
errors: [
473487
{
474-
message: "All 'foo' signatures should be adjacent.",
488+
messageId: "adjacentSignature",
489+
data: { name: "foo" },
475490
line: 7,
476491
column: 5,
477492
},
@@ -490,7 +505,8 @@ type Foo = {
490505
`,
491506
errors: [
492507
{
493-
message: "All 'foo' signatures should be adjacent.",
508+
messageId: "adjacentSignature",
509+
data: { name: "foo" },
494510
line: 5,
495511
column: 5,
496512
},
@@ -509,7 +525,8 @@ interface Foo {
509525
`,
510526
errors: [
511527
{
512-
message: "All 'call' signatures should be adjacent.",
528+
messageId: "adjacentSignature",
529+
data: { name: "call" },
513530
line: 5,
514531
column: 5,
515532
},
@@ -527,7 +544,8 @@ interface Foo {
527544
`,
528545
errors: [
529546
{
530-
message: "All 'foo' signatures should be adjacent.",
547+
messageId: "adjacentSignature",
548+
data: { name: "foo" },
531549
line: 7,
532550
column: 5,
533551
},
@@ -545,7 +563,8 @@ interface Foo {
545563
`,
546564
errors: [
547565
{
548-
message: "All 'foo' signatures should be adjacent.",
566+
messageId: "adjacentSignature",
567+
data: { name: "foo" },
549568
line: 7,
550569
column: 5,
551570
},
@@ -563,7 +582,8 @@ interface Foo {
563582
`,
564583
errors: [
565584
{
566-
message: "All 'foo' signatures should be adjacent.",
585+
messageId: "adjacentSignature",
586+
data: { name: "foo" },
567587
line: 7,
568588
column: 5,
569589
},
@@ -582,7 +602,8 @@ interface Foo {
582602
`,
583603
errors: [
584604
{
585-
message: "All 'foo' signatures should be adjacent.",
605+
messageId: "adjacentSignature",
606+
data: { name: "foo" },
586607
line: 5,
587608
column: 5,
588609
},
@@ -602,7 +623,8 @@ interface Foo {
602623
`,
603624
errors: [
604625
{
605-
message: "All 'baz' signatures should be adjacent.",
626+
messageId: "adjacentSignature",
627+
data: { name: "baz" },
606628
line: 8,
607629
column: 9,
608630
},
@@ -620,7 +642,8 @@ interface Foo {
620642
`,
621643
errors: [
622644
{
623-
message: "All 'new' signatures should be adjacent.",
645+
messageId: "adjacentSignature",
646+
data: { name: "new" },
624647
line: 7,
625648
column: 5,
626649
},
@@ -638,12 +661,14 @@ interface Foo {
638661
`,
639662
errors: [
640663
{
641-
message: "All 'new' signatures should be adjacent.",
664+
messageId: "adjacentSignature",
665+
data: { name: "new" },
642666
line: 5,
643667
column: 5,
644668
},
645669
{
646-
message: "All 'new' signatures should be adjacent.",
670+
messageId: "adjacentSignature",
671+
data: { name: "new" },
647672
line: 7,
648673
column: 5,
649674
},
@@ -661,7 +686,8 @@ class Foo {
661686
`,
662687
errors: [
663688
{
664-
message: "All 'constructor' signatures should be adjacent.",
689+
messageId: "adjacentSignature",
690+
data: { name: "constructor" },
665691
line: 7,
666692
column: 5,
667693
},
@@ -679,7 +705,8 @@ class Foo {
679705
`,
680706
errors: [
681707
{
682-
message: "All 'foo' signatures should be adjacent.",
708+
messageId: "adjacentSignature",
709+
data: { name: "foo" },
683710
line: 7,
684711
column: 5,
685712
},
@@ -697,7 +724,8 @@ class Foo {
697724
`,
698725
errors: [
699726
{
700-
message: "All 'foo' signatures should be adjacent.",
727+
messageId: "adjacentSignature",
728+
data: { name: "foo" },
701729
line: 7,
702730
column: 5,
703731
},
@@ -715,7 +743,8 @@ class Foo {
715743
`,
716744
errors: [
717745
{
718-
message: "All 'foo' signatures should be adjacent.",
746+
messageId: "adjacentSignature",
747+
data: { name: "foo" },
719748
line: 7,
720749
column: 5,
721750
},
@@ -734,7 +763,8 @@ class Foo {
734763
`,
735764
errors: [
736765
{
737-
message: "All 'constructor' signatures should be adjacent.",
766+
messageId: "adjacentSignature",
767+
data: { name: "constructor" },
738768
line: 5,
739769
column: 5,
740770
},
@@ -753,7 +783,8 @@ class Foo {
753783
`,
754784
errors: [
755785
{
756-
message: "All 'foo' signatures should be adjacent.",
786+
messageId: "adjacentSignature",
787+
data: { name: "foo" },
757788
line: 5,
758789
column: 5,
759790
},

0 commit comments

Comments
 (0)