mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 17:35:16 +00:00
40 lines
4.4 KiB
JavaScript
40 lines
4.4 KiB
JavaScript
|
'use strict';var _ExportMap = require('../ExportMap');var _ExportMap2 = _interopRequireDefault(_ExportMap);
|
||
|
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
|
||
|
|
||
|
module.exports = {
|
||
|
meta: {
|
||
|
type: 'problem',
|
||
|
docs: {
|
||
|
url: (0, _docsUrl2['default'])('default') },
|
||
|
|
||
|
schema: [] },
|
||
|
|
||
|
|
||
|
create: function () {function create(context) {
|
||
|
|
||
|
function checkDefault(specifierType, node) {
|
||
|
|
||
|
var defaultSpecifier = node.specifiers.find(
|
||
|
function (specifier) {return specifier.type === specifierType;});
|
||
|
|
||
|
|
||
|
if (!defaultSpecifier) return;
|
||
|
var imports = _ExportMap2['default'].get(node.source.value, context);
|
||
|
if (imports == null) return;
|
||
|
|
||
|
if (imports.errors.length) {
|
||
|
imports.reportErrors(context, node);
|
||
|
} else if (imports.get('default') === undefined) {
|
||
|
context.report({
|
||
|
node: defaultSpecifier,
|
||
|
message: 'No default export found in imported module "' + String(node.source.value) + '".' });
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
'ImportDeclaration': checkDefault.bind(null, 'ImportDefaultSpecifier'),
|
||
|
'ExportNamedDeclaration': checkDefault.bind(null, 'ExportDefaultSpecifier') };
|
||
|
|
||
|
}return create;}() };
|
||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9kZWZhdWx0LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJ1cmwiLCJzY2hlbWEiLCJjcmVhdGUiLCJjb250ZXh0IiwiY2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