'use strict'; var _docsUrl = require('../docsUrl'); var _docsUrl2 = _interopRequireDefault(_docsUrl); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function isNonExportStatement(_ref) { let type = _ref.type; return type !== 'ExportDefaultDeclaration' && type !== 'ExportNamedDeclaration' && type !== 'ExportAllDeclaration'; } module.exports = { meta: { docs: { url: (0, _docsUrl2.default)('exports-last') } }, create: function (context) { return { Program: function (_ref2) { let body = _ref2.body; const lastNonExportStatementIndex = body.reduce(function findLastIndex(acc, item, index) { if (isNonExportStatement(item)) { return index; } return acc; }, -1); if (lastNonExportStatementIndex !== -1) { body.slice(0, lastNonExportStatementIndex).forEach(function checkNonExport(node) { if (!isNonExportStatement(node)) { context.report({ node, message: 'Export statements should appear at the end of the file' }); } }); } } }; } }; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL2V4cG9ydHMtbGFzdC5qcyJdLCJuYW1lcyI6WyJpc05vbkV4cG9ydFN0YXRlbWVudCIsInR5cGUiLCJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsImRvY3MiLCJ1cmwiLCJjcmVhdGUiLCJjb250ZXh0IiwiUHJvZ3JhbSIsImJvZHkiLCJsYXN0Tm9uRXhwb3J0U3RhdGVtZW50SW5kZXgiLCJyZWR1Y2UiLCJmaW5kTGFzdEluZGV4IiwiYWNjIiwiaXRlbSIsImluZGV4Iiwic2xpY2UiLCJmb3JFYWNoIiwiY2hlY2tOb25FeHBvcnQiLCJub2RlIiwicmVwb3J0IiwibWVzc2FnZSJdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7Ozs7O0FBRUEsU0FBU0Esb0JBQVQsT0FBd0M7QUFBQSxNQUFSQyxJQUFRLFFBQVJBLElBQVE7O0FBQ3RDLFNBQU9BLFNBQVMsMEJBQVQsSUFDTEEsU0FBUyx3QkFESixJQUVMQSxTQUFTLHNCQUZYO0FBR0Q7O0FBRURDLE9BQ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