From 314af44bde3ccbebc620625b2931d77688525976 Mon Sep 17 00:00:00 2001 From: koooge Date: Wed, 24 Nov 2021 00:52:53 +0100 Subject: [PATCH] feat(eslint-plugin): `array-type` distinguish whether readonly or not (#4066) * feat(eslint-plugin): distinguish whether readonly or not Signed-off-by: koooge * refactor: template messages Signed-off-by: koooge --- .../eslint-plugin/src/rules/array-type.ts | 20 +- .../tests/rules/array-type.test.ts | 288 ++++++++++++------ 2 files changed, 209 insertions(+), 99 deletions(-) diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts index da2bfdef518..35045fdd985 100644 --- a/packages/eslint-plugin/src/rules/array-type.ts +++ b/packages/eslint-plugin/src/rules/array-type.ts @@ -80,9 +80,9 @@ type Options = [ ]; type MessageIds = | 'errorStringGeneric' - | 'errorStringGenericSimple' | 'errorStringArray' - | 'errorStringArraySimple'; + | 'errorStringArraySimple' + | 'errorStringGenericSimple'; const arrayOption = { enum: ['array', 'generic', 'array-simple'] }; @@ -98,13 +98,13 @@ export default util.createRule({ fixable: 'code', messages: { errorStringGeneric: - "Array type using '{{type}}[]' is forbidden. Use 'Array<{{type}}>' instead.", - errorStringGenericSimple: - "Array type using '{{type}}[]' is forbidden for non-simple types. Use 'Array<{{type}}>' instead.", + "Array type using '{{readonlyPrefix}}{{type}}[]' is forbidden. Use '{{className}}<{{type}}>' instead.", errorStringArray: - "Array type using 'Array<{{type}}>' is forbidden. Use '{{type}}[]' instead.", + "Array type using '{{className}}<{{type}}>' is forbidden. Use '{{readonlyPrefix}}{{type}}[]' instead.", errorStringArraySimple: - "Array type using 'Array<{{type}}>' is forbidden for simple types. Use '{{type}}[]' instead.", + "Array type using '{{className}}<{{type}}>' is forbidden for simple types. Use '{{readonlyPrefix}}{{type}}[]' instead.", + errorStringGenericSimple: + "Array type using '{{readonlyPrefix}}{{type}}[]' is forbidden for non-simple types. Use '{{className}}<{{type}}>' instead.", }, schema: [ { @@ -163,6 +163,8 @@ export default util.createRule({ node: errorNode, messageId, data: { + className: isReadonly ? 'ReadonlyArray' : 'Array', + readonlyPrefix: isReadonly ? 'readonly ' : '', type: getMessageType(node.elementType), }, fix(fixer) { @@ -216,6 +218,8 @@ export default util.createRule({ node, messageId, data: { + className: isReadonlyArrayType ? 'ReadonlyArray' : 'Array', + readonlyPrefix, type: 'any', }, fix(fixer) { @@ -250,6 +254,8 @@ export default util.createRule({ node, messageId, data: { + className: isReadonlyArrayType ? 'ReadonlyArray' : 'Array', + readonlyPrefix, type: getMessageType(type), }, fix(fixer) { diff --git a/packages/eslint-plugin/tests/rules/array-type.test.ts b/packages/eslint-plugin/tests/rules/array-type.test.ts index 3c2c1893a3f..eafd9a912cf 100644 --- a/packages/eslint-plugin/tests/rules/array-type.test.ts +++ b/packages/eslint-plugin/tests/rules/array-type.test.ts @@ -375,7 +375,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 8, }, @@ -388,7 +388,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -401,7 +401,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'number' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'number', + }, line: 1, column: 8, }, @@ -414,7 +418,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'T', + }, line: 1, column: 8, }, @@ -427,7 +435,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 8, }, @@ -440,7 +448,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -453,7 +461,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'number' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'number', + }, line: 1, column: 8, }, @@ -466,7 +478,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'T', + }, line: 1, column: 8, }, @@ -479,7 +495,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 8, }, @@ -492,7 +508,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -505,7 +521,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'number' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'number', + }, line: 1, column: 8, }, @@ -518,7 +538,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'T', + }, line: 1, column: 8, }, @@ -531,7 +555,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 8, }, @@ -544,7 +568,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -557,7 +581,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'number' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'number', + }, line: 1, column: 8, }, @@ -570,7 +598,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'T', + }, line: 1, column: 8, }, @@ -583,7 +615,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 8, }, @@ -596,7 +628,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -609,7 +641,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'number' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'number', + }, line: 1, column: 8, }, @@ -622,7 +658,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'T', + }, line: 1, column: 8, }, @@ -635,7 +675,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 8, }, @@ -648,7 +688,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -661,7 +701,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'number' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'number', + }, line: 1, column: 8, }, @@ -674,7 +718,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'T', + }, line: 1, column: 8, }, @@ -687,7 +735,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 8, }, @@ -700,7 +748,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -713,7 +761,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'number' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'number', + }, line: 1, column: 8, }, @@ -726,7 +778,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'T', + }, line: 1, column: 8, }, @@ -739,7 +795,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 8, }, @@ -752,7 +808,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -765,7 +821,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'number' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'number', + }, line: 1, column: 8, }, @@ -778,7 +838,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'T', + }, line: 1, column: 8, }, @@ -791,7 +855,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 8, }, @@ -804,7 +868,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -817,7 +881,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'number' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'number', + }, line: 1, column: 8, }, @@ -830,7 +898,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'T', + }, line: 1, column: 8, }, @@ -843,7 +915,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 8, }, @@ -856,7 +928,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -869,7 +941,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'number' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'number', + }, line: 1, column: 8, }, @@ -882,7 +958,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'T', + }, line: 1, column: 8, }, @@ -895,7 +975,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 8, }, @@ -908,7 +988,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -921,7 +1001,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'number' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'number', + }, line: 1, column: 8, }, @@ -934,7 +1018,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'T', + }, line: 1, column: 8, }, @@ -947,7 +1035,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 8, }, @@ -960,7 +1048,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -973,7 +1061,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'number' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'number', + }, line: 1, column: 8, }, @@ -986,7 +1078,11 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'T', + }, line: 1, column: 8, }, @@ -1001,7 +1097,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'Bar' }, + data: { className: 'Array', readonlyPrefix: '', type: 'Bar' }, line: 1, column: 15, }, @@ -1014,7 +1110,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'Bar' }, + data: { className: 'Array', readonlyPrefix: '', type: 'Bar' }, line: 1, column: 21, }, @@ -1027,7 +1123,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'Bar' }, + data: { className: 'Array', readonlyPrefix: '', type: 'Bar' }, line: 1, column: 27, }, @@ -1040,13 +1136,13 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'Bar' }, + data: { className: 'Array', readonlyPrefix: '', type: 'Bar' }, line: 1, column: 17, }, { messageId: 'errorStringArray', - data: { type: 'Bar' }, + data: { className: 'Array', readonlyPrefix: '', type: 'Bar' }, line: 1, column: 30, }, @@ -1059,7 +1155,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'undefined' }, + data: { className: 'Array', readonlyPrefix: '', type: 'undefined' }, line: 1, column: 8, }, @@ -1072,7 +1168,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'string' }, + data: { className: 'Array', readonlyPrefix: '', type: 'string' }, line: 1, column: 20, }, @@ -1085,7 +1181,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'any' }, + data: { className: 'Array', readonlyPrefix: '', type: 'any' }, line: 1, column: 8, }, @@ -1098,7 +1194,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 24, }, @@ -1111,7 +1207,7 @@ function bazFunction(baz: Arr>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 15, }, @@ -1130,7 +1226,7 @@ let yyyy: Arr>>> = [[[['2']]]]; errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 3, column: 15, }, @@ -1157,7 +1253,7 @@ interface ArrayClass { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 3, column: 8, }, @@ -1178,7 +1274,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 2, column: 27, }, @@ -1191,7 +1287,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 13, }, @@ -1204,7 +1300,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 17, }, @@ -1217,7 +1313,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 24, }, @@ -1230,7 +1326,11 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'fooName.BarType' }, + data: { + className: 'Array', + readonlyPrefix: '', + type: 'fooName.BarType', + }, line: 1, column: 8, }, @@ -1243,7 +1343,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringGenericSimple', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 8, }, @@ -1256,7 +1356,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'undefined' }, + data: { className: 'Array', readonlyPrefix: '', type: 'undefined' }, line: 1, column: 8, }, @@ -1269,7 +1369,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'string' }, + data: { className: 'Array', readonlyPrefix: '', type: 'string' }, line: 1, column: 20, }, @@ -1282,7 +1382,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'any' }, + data: { className: 'Array', readonlyPrefix: '', type: 'any' }, line: 1, column: 8, }, @@ -1295,7 +1395,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 15, }, @@ -1314,7 +1414,7 @@ let yyyy: Arr[][]> = [[[['2']]]]; errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 3, column: 15, }, @@ -1339,7 +1439,7 @@ interface ArrayClass { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 3, column: 8, }, @@ -1360,7 +1460,7 @@ function fooFunction(foo: ArrayClass[]) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 2, column: 27, }, @@ -1373,7 +1473,7 @@ function fooFunction(foo: ArrayClass[]) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 13, }, @@ -1386,7 +1486,7 @@ function fooFunction(foo: ArrayClass[]) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 17, }, @@ -1399,7 +1499,7 @@ function fooFunction(foo: ArrayClass[]) { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 24, }, @@ -1412,7 +1512,7 @@ function fooFunction(foo: ArrayClass[]) { errors: [ { messageId: 'errorStringArray', - data: { type: 'any' }, + data: { className: 'Array', readonlyPrefix: '', type: 'any' }, line: 1, column: 8, }, @@ -1425,7 +1525,7 @@ function fooFunction(foo: ArrayClass[]) { errors: [ { messageId: 'errorStringArray', - data: { type: 'any' }, + data: { className: 'Array', readonlyPrefix: '', type: 'any' }, line: 1, column: 8, }, @@ -1438,7 +1538,7 @@ function fooFunction(foo: ArrayClass[]) { errors: [ { messageId: 'errorStringArraySimple', - data: { type: 'any' }, + data: { className: 'Array', readonlyPrefix: '', type: 'any' }, line: 1, column: 8, }, @@ -1463,7 +1563,7 @@ function fooFunction(foo: ArrayClass[]) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'number' }, + data: { className: 'Array', readonlyPrefix: '', type: 'number' }, line: 1, column: 31, }, @@ -1476,7 +1576,7 @@ function fooFunction(foo: ArrayClass[]) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'string' }, + data: { className: 'Array', readonlyPrefix: '', type: 'string' }, line: 1, column: 8, }, @@ -1489,7 +1589,7 @@ function fooFunction(foo: ArrayClass[]) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 24, }, @@ -1508,7 +1608,7 @@ let yyyy: Arr>>> = [[[['2']]]]; errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 3, column: 15, }, @@ -1533,7 +1633,7 @@ interface ArrayClass { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 4, column: 8, }, @@ -1554,7 +1654,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 2, column: 27, }, @@ -1567,7 +1667,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 13, }, @@ -1580,7 +1680,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 17, }, @@ -1593,7 +1693,7 @@ function barFunction(bar: Array>) { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 24, }, @@ -1614,7 +1714,7 @@ interface FooInterface { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'string' }, + data: { className: 'Array', readonlyPrefix: '', type: 'string' }, line: 3, column: 18, }, @@ -1628,7 +1728,7 @@ interface FooInterface { errors: [ { messageId: 'errorStringArray', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 28, }, @@ -1642,7 +1742,7 @@ interface FooInterface { errors: [ { messageId: 'errorStringGeneric', - data: { type: 'T' }, + data: { className: 'Array', readonlyPrefix: '', type: 'T' }, line: 1, column: 28, }, @@ -1655,7 +1755,11 @@ interface FooInterface { errors: [ { messageId: 'errorStringArray', - data: { type: 'object' }, + data: { + className: 'ReadonlyArray', + readonlyPrefix: 'readonly ', + type: 'object', + }, line: 1, column: 12, },