github-pages-deploy-action/node_modules/eslint-plugin-import/lib/rules/no-named-export.js

42 lines
3.5 KiB
JavaScript
Raw Normal View History

2020-03-07 11:45:40 +08:00
'use strict';
var _docsUrl = require('../docsUrl');
var _docsUrl2 = _interopRequireDefault(_docsUrl);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = {
meta: {
type: 'suggestion',
docs: { url: (0, _docsUrl2.default)('no-named-export') },
schema: []
},
create(context) {
// ignore non-modules
if (context.parserOptions.sourceType !== 'module') {
return {};
}
const message = 'Named exports are not allowed.';
return {
ExportAllDeclaration(node) {
context.report({ node, message });
},
ExportNamedDeclaration(node) {
if (node.specifiers.length === 0) {
return context.report({ node, message });
}
const someNamed = node.specifiers.some(specifier => specifier.exported.name !== 'default');
if (someNamed) {
context.report({ node, message });
}
}
};
}
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1leHBvcnQuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJwYXJzZXJPcHRpb25zIiwic291cmNlVHlwZSIsIm1lc3NhZ2UiLCJFeHBvcnRBbGxEZWNsYXJhdGlvbiIsIm5vZGUiLCJyZXBvcnQiLCJFeHBvcnROYW1lZERlY2xhcmF0aW9uIiwic3BlY2lmaWVycyIsImxlbmd0aCIsInNvbWVOYW1lZCIsInNvbWUiLCJzcGVjaWZpZXIiLCJleHBvcnRlZCIsIm5hbWUiXSwibWFwcGluZ3MiOiI7O0FBQUE7Ozs7OztBQUVBQSxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFBQU07QUFDSkMsVUFBTSxZQURGO0FBRUpDLFVBQU0sRUFBRUMsS0FBSyx1QkFBUSxpQkFBUixDQUFQLEVBRkY7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