%PDF- %PDF-
Direktori : /var/www/html/node_modules/eslint-plugin-import/lib/rules/ |
Current File : /var/www/html/node_modules/eslint-plugin-import/lib/rules/no-default-export.js |
'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-default-export') }, schema: [] }, create: function () {function create(context) { // ignore non-modules if (context.parserOptions.sourceType !== 'module') { return {}; } var preferNamed = 'Prefer named exports.'; var noAliasDefault = function () {function noAliasDefault(_ref) {var local = _ref.local;return 'Do not alias `' + String(local.name) + '` as `default`. Just export `' + String(local.name) + '` itself instead.';}return noAliasDefault;}(); return { ExportDefaultDeclaration: function () {function ExportDefaultDeclaration(node) {var _ref2 = context.getSourceCode().getFirstTokens(node)[1] || {},loc = _ref2.loc; context.report({ node: node, message: preferNamed, loc: loc }); }return ExportDefaultDeclaration;}(), ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) { node.specifiers.filter(function (specifier) {return specifier.exported.name === 'default';}).forEach(function (specifier) {var _ref3 = context.getSourceCode().getFirstTokens(node)[1] || {},loc = _ref3.loc; if (specifier.type === 'ExportDefaultSpecifier') { context.report({ node: node, message: preferNamed, loc: loc }); } else if (specifier.type === 'ExportSpecifier') { context.report({ node: node, message: noAliasDefault(specifier), loc: loc }); } }); }return ExportNamedDeclaration;}() }; }return create;}() }; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1kZWZhdWx0LWV4cG9ydC5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsInBhcnNlck9wdGlvbnMiLCJzb3VyY2VUeXBlIiwicHJlZmVyTmFtZ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