|
| 1 | +export default { |
| 2 | + invalid: [ |
| 3 | + { |
| 4 | + code: 'type X = Array<string>', |
| 5 | + errors: [{message: 'Use "SimpleType[]", not "Array<SimpleType>"'}] |
| 6 | + }, |
| 7 | + { |
| 8 | + code: 'type X = string[]', |
| 9 | + errors: [{message: 'Use "Array<SimpleType>", not "SimpleType[]"'}], |
| 10 | + options: ['verbose'] |
| 11 | + }, |
| 12 | + { |
| 13 | + code: 'type X = Array<string>', |
| 14 | + errors: [{message: 'Use "SimpleType[]", not "Array<SimpleType>"'}], |
| 15 | + options: ['shorthand'] |
| 16 | + }, |
| 17 | + { |
| 18 | + code: 'type X = Array<Date>', |
| 19 | + errors: [{message: 'Use "SimpleType[]", not "Array<SimpleType>"'}] |
| 20 | + }, |
| 21 | + { |
| 22 | + code: 'type X = Array<Promise<string>>', |
| 23 | + errors: [{message: 'Use "SimpleType[]", not "Array<SimpleType>"'}] |
| 24 | + }, |
| 25 | + { |
| 26 | + code: 'type X = Array<$Keys<{ foo: string }>>', |
| 27 | + errors: [{message: 'Use "SimpleType[]", not "Array<SimpleType>"'}] |
| 28 | + }, |
| 29 | + { |
| 30 | + code: 'type X = Array<any>', |
| 31 | + errors: [{message: 'Use "SimpleType[]", not "Array<SimpleType>"'}] |
| 32 | + }, |
| 33 | + { |
| 34 | + code: 'type X = Array<mixed>', |
| 35 | + errors: [{message: 'Use "SimpleType[]", not "Array<SimpleType>"'}] |
| 36 | + }, |
| 37 | + { |
| 38 | + code: 'type X = Array<void>', |
| 39 | + errors: [{message: 'Use "SimpleType[]", not "Array<SimpleType>"'}] |
| 40 | + }, |
| 41 | + { |
| 42 | + code: 'type X = Array<null>', |
| 43 | + errors: [{message: 'Use "SimpleType[]", not "Array<SimpleType>"'}] |
| 44 | + }, |
| 45 | + { |
| 46 | + code: 'type X = Array<string[]>', |
| 47 | + errors: [{message: 'Use "SimpleType[]", not "Array<SimpleType>"'}] |
| 48 | + } |
| 49 | + ], |
| 50 | + misconfigured: [ |
| 51 | + { |
| 52 | + errors: [ |
| 53 | + { |
| 54 | + data: 'normal', |
| 55 | + dataPath: '[0]', |
| 56 | + keyword: 'enum', |
| 57 | + message: 'should be equal to one of the allowed values', |
| 58 | + params: { |
| 59 | + allowedValues: [ |
| 60 | + 'verbose', |
| 61 | + 'shorthand' |
| 62 | + ] |
| 63 | + }, |
| 64 | + parentSchema: { |
| 65 | + enum: [ |
| 66 | + 'verbose', |
| 67 | + 'shorthand' |
| 68 | + ], |
| 69 | + type: 'string' |
| 70 | + }, |
| 71 | + schema: [ |
| 72 | + 'verbose', |
| 73 | + 'shorthand' |
| 74 | + ], |
| 75 | + schemaPath: '#/items/0/enum' |
| 76 | + } |
| 77 | + ], |
| 78 | + options: ['normal'] |
| 79 | + } |
| 80 | + ], |
| 81 | + valid: [ |
| 82 | + { |
| 83 | + code: 'type X = string[]' |
| 84 | + }, |
| 85 | + { |
| 86 | + code: 'type X = Array<string>', |
| 87 | + options: ['verbose'] |
| 88 | + }, |
| 89 | + { |
| 90 | + code: 'type X = string[]', |
| 91 | + options: ['shorthand'] |
| 92 | + }, |
| 93 | + { |
| 94 | + code: 'type X = string[][]' |
| 95 | + }, |
| 96 | + { |
| 97 | + code: 'type X = (?string)[]', |
| 98 | + options: ['verbose'] |
| 99 | + }, |
| 100 | + { |
| 101 | + code: 'type X = string[]', |
| 102 | + options: ['verbose'], |
| 103 | + settings: { |
| 104 | + flowtype: { |
| 105 | + onlyFilesWithFlowAnnotation: true |
| 106 | + } |
| 107 | + } |
| 108 | + } |
| 109 | + ] |
| 110 | +}; |
0 commit comments