Constnium/node_modules/eslint-plugin-import/lib/rules/no-named-export.js

35 lines
4 KiB
JavaScript
Raw Normal View History

2022-06-23 02:27:43 +02: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: function () {function create(context) {
// ignore non-modules
if (context.parserOptions.sourceType !== 'module') {
return {};
}
var message = 'Named exports are not allowed.';
return {
ExportAllDeclaration: function () {function ExportAllDeclaration(node) {
context.report({ node: node, message: message });
}return ExportAllDeclaration;}(),
ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) {
if (node.specifiers.length === 0) {
return context.report({ node: node, message: message });
}
var someNamed = node.specifiers.some(function (specifier) {return (specifier.exported.name || specifier.exported.value) !== 'default';});
if (someNamed) {
context.report({ node: node, message: message });
}
}return ExportNamedDeclaration;}() };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1leHBvcnQuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJwYXJzZXJPcHRpb25zIiwic291cmNlVHlwZSIsIm1lc3NhZ2UiLCJFeHBvcnRBbGxEZWNsYXJhdGlvbiIsIm5vZGUiLCJyZXBvcnQiLCJFeHBvcnROYW1lZERlY2xhcmF0aW9uIiwic3BlY2lmaWVycyIsImxlbmd0aCIsInNvbWVOYW1lZCIsInNvbWUiLCJzcGVjaWZpZXIiLCJleHBvcnRlZCIsIm5hbWUiLCJ2YWx1ZSJdLCJtYXBwaW5ncyI6ImFBQUEscUM7O0FBRUFBLE9BQU9DLE9BQVAsR0FB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