|
| 1 | +export default { |
| 2 | + invalid: [ |
| 3 | + { |
| 4 | + code: 'const foo = 3;\ntype Foo = number;', |
| 5 | + errors: [{message: 'All type declaration should be at the top of the file, after any import declarations.'}] |
| 6 | + }, |
| 7 | + { |
| 8 | + code: 'const foo = 3;\nopaque type Foo = number;', |
| 9 | + errors: [{message: 'All type declaration should be at the top of the file, after any import declarations.'}] |
| 10 | + }, |
| 11 | + { |
| 12 | + code: 'const foo = 3;\nexport type Foo = number;', |
| 13 | + errors: [{message: 'All type declaration should be at the top of the file, after any import declarations.'}] |
| 14 | + }, |
| 15 | + { |
| 16 | + code: 'const foo = 3;\nexport opaque type Foo = number;', |
| 17 | + errors: [{message: 'All type declaration should be at the top of the file, after any import declarations.'}] |
| 18 | + }, |
| 19 | + { |
| 20 | + code: 'const foo = 3;\ntype Foo = number | string;', |
| 21 | + errors: [{message: 'All type declaration should be at the top of the file, after any import declarations.'}] |
| 22 | + }, |
| 23 | + { |
| 24 | + code: 'import bar from "./bar";\nconst foo = 3;\ntype Foo = number;', |
| 25 | + errors: [{message: 'All type declaration should be at the top of the file, after any import declarations.'}] |
| 26 | + } |
| 27 | + ], |
| 28 | + misconfigured: [ |
| 29 | + { |
| 30 | + errors: [ |
| 31 | + { |
| 32 | + data: 'sometimes', |
| 33 | + dataPath: '[0]', |
| 34 | + keyword: 'enum', |
| 35 | + message: 'should be equal to one of the allowed values', |
| 36 | + params: { |
| 37 | + allowedValues: [ |
| 38 | + 'always', |
| 39 | + 'never' |
| 40 | + ] |
| 41 | + }, |
| 42 | + parentSchema: { |
| 43 | + enum: [ |
| 44 | + 'always', |
| 45 | + 'never' |
| 46 | + ], |
| 47 | + type: 'string' |
| 48 | + }, |
| 49 | + schema: [ |
| 50 | + 'always', |
| 51 | + 'never' |
| 52 | + ], |
| 53 | + schemaPath: '#/items/0/enum' |
| 54 | + } |
| 55 | + ], |
| 56 | + options: ['sometimes'] |
| 57 | + } |
| 58 | + ], |
| 59 | + valid: [ |
| 60 | + { |
| 61 | + code: 'type Foo = number;\nconst foo = 3;' |
| 62 | + }, |
| 63 | + { |
| 64 | + code: 'opaque type Foo = number;\nconst foo = 3;' |
| 65 | + }, |
| 66 | + { |
| 67 | + code: 'export type Foo = number;\nconst foo = 3;' |
| 68 | + }, |
| 69 | + { |
| 70 | + code: 'export opaque type Foo = number;\nconst foo = 3;' |
| 71 | + }, |
| 72 | + { |
| 73 | + code: 'type Foo = number;\nconst foo = 3;' |
| 74 | + }, |
| 75 | + { |
| 76 | + code: 'import bar from "./bar";\ntype Foo = number;' |
| 77 | + }, |
| 78 | + { |
| 79 | + code: 'type Foo = number;\nimport bar from "./bar";' |
| 80 | + }, |
| 81 | + { |
| 82 | + code: 'const foo = 3;\ntype Foo = number;', |
| 83 | + options: ['never'] |
| 84 | + } |
| 85 | + ] |
| 86 | +}; |
0 commit comments