| 1 | module.exports = { |
| 2 | meta: { |
| 3 | type: "problem", |
| 4 | }, |
| 5 | create(context) { |
| 6 | let hasExport = false; |
| 7 | |
| 8 | return { |
| 9 | ExportDefaultDeclaration() { |
| 10 | hasExport = true; |
| 11 | }, |
| 12 | 'ExportSpecifier[exported.name="default"]': function (node) { |
| 13 | hasExport = true; |
| 14 | }, |
| 15 | "Program:exit": function (node) { |
| 16 | if (!hasExport) { |
| 17 | context.report({ |
| 18 | node, |
| 19 | message: "File must default export a completion spec object", |
| 20 | }); |
| 21 | } |
| 22 | }, |
| 23 | }; |
| 24 | }, |
| 25 | }; |