mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 01:45:15 +00:00
35 lines
3.8 KiB
JavaScript
35 lines
3.8 KiB
JavaScript
|
'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 !== 'default';});
|
||
|
if (someNamed) {
|
||
|
context.report({ node: node, message: message });
|
||
|
}
|
||
|
}return ExportNamedDeclaration;}() };
|
||
|
|
||
|
}return create;}() };
|
||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1leHBvcnQuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJwYXJzZXJPcHRpb25zIiwic291cmNlVHlwZSIsIm1lc3NhZ2UiLCJFeHBvcnRBbGxEZWNsYXJhdGlvbiIsIm5vZGUi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