mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-11-29 19:05:22 +01:00
40 lines
No EOL
4.3 KiB
JavaScript
40 lines
No EOL
4.3 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 (context) {
|
|
|
|
function checkDefault(specifierType, node) {
|
|
|
|
const defaultSpecifier = node.specifiers.find(
|
|
specifier => 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 "${node.source.value}".` });
|
|
|
|
}
|
|
}
|
|
|
|
return {
|
|
'ImportDeclaration': checkDefault.bind(null, 'ImportDefaultSpecifier'),
|
|
'ExportNamedDeclaration': checkDefault.bind(null, 'ExportDefaultSpecifier') };
|
|
|
|
} };
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9kZWZhdWx0LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJ1cmwiLCJzY2hlbWEiLCJjcmVhdGUiLCJjb250ZXh0IiwiY2hlY2tEZWZhdWx0Iiwic3BlY2lmaWVyVHlwZSIsIm5vZGUiLCJkZWZhdWx0U3BlY2lmaWVyIiwic3BlY2lmaWVycyIsImZpbmQ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