odin-js-fundamentals-part-5/node_modules/eslint-plugin-import/lib/rules/no-named-default.js

31 lines
3.5 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: {
category: 'Style guide',
description: 'Forbid named default exports.',
url: (0, _docsUrl2['default'])('no-named-default') },
schema: [] },
create: function () {function create(context) {
return {
ImportDeclaration: function () {function ImportDeclaration(node) {
node.specifiers.forEach(function (im) {
if (im.importKind === 'type' || im.importKind === 'typeof') {
return;
}
if (im.type === 'ImportSpecifier' && (im.imported.name || im.imported.value) === 'default') {
context.report({
node: im.local,
message: 'Use default import syntax to import \'' + String(im.local.name) + '\'.' });
}
});
}return ImportDeclaration;}() };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1kZWZhdWx0LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsIkltcG9ydERlY2xhcmF0aW9uIiwibm9kZSIsInNwZWNpZmllcnMiLCJmb3JFYWNoIiwiaW0iLCJpbXBvcnRLaW5kIiwiaW1wb3J0ZWQiLCJuYW1lIiwidmFsdWUiLCJyZXBvcnQiLCJsb2NhbCIsIm1lc3NhZ2UiXSwibWFwcGluZ3MiOiJhQUFBLHFDOztBQUVBQSxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFBQU07QUFDSkMsVUFBTSxZQURGO0FBRUpDLFVBQU07QUFDSkMsZ0JBQVUsYUFETjtBQUVKQyxtQkFBYSwrQkFGVDtBQUdKQyxXQUFLLDBCQUFRLGtC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