%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/named.js |
'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();var _path = require('path');var path = _interopRequireWildcard(_path); 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 };}function _interopRequireWildcard(obj) {if (obj && obj.__esModule) {return obj;} else {var newObj = {};if (obj != null) {for (var key in obj) {if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];}}newObj['default'] = obj;return newObj;}} module.exports = { meta: { type: 'problem', docs: { url: (0, _docsUrl2['default'])('named') }, schema: [ { type: 'object', properties: { commonjs: { type: 'boolean' } }, additionalProperties: false }] }, create: function () {function create(context) { var options = context.options[0] || {}; function checkSpecifiers(key, type, node) { // ignore local exports and type imports/exports if ( node.source == null || node.importKind === 'type' || node.importKind === 'typeof' || node.exportKind === 'type') { return; } if (!node.specifiers.some(function (im) {return im.type === type;})) { return; // no named imports/exports } var imports = _ExportMap2['default'].get(node.source.value, context); if (imports == null || imports.parseGoal === 'ambiguous') { return; } if (imports.errors.length) { imports.reportErrors(context, node); return; } node.specifiers.forEach(function (im) { if ( im.type !== type // ignore type imports || im.importKind === 'type' || im.importKind === 'typeof') { return; } var deepLookup = imports.hasDeep(im[key].name); if (!deepLookup.found) { if (deepLookup.path.length > 1) { var deepPath = deepLookup.path. map(function (i) {return path.relative(path.dirname(context.getPhysicalFilename ? context.getPhysicalFilename() : context.getFilename()), i.path);}). join(' -> '); context.report(im[key], String(im[key].name) + ' not found via ' + String(deepPath)); } else { context.report(im[key], im[key].name + ' not found in \'' + node.source.value + '\''); } } }); } function checkRequire(node) { if ( !options.commonjs || node.type !== 'VariableDeclarator' // return if it's not an object destructure or it's an empty object destructure || !node.id || node.id.type !== 'ObjectPattern' || node.id.properties.length === 0 // return if there is no call expression on the right side || !node.init || node.init.type !== 'CallExpression') { return; } var call = node.init;var _call$arguments = _slicedToArray( call.arguments, 1),source = _call$arguments[0]; var variableImports = node.id.properties; var variableExports = _ExportMap2['default'].get(source.value, context); if ( // return if it's not a commonjs require statement call.callee.type !== 'Identifier' || call.callee.name !== 'require' || call.arguments.length !== 1 // return if it's not a string source || source.type !== 'Literal' || variableExports == null || variableExports.parseGoal === 'ambiguous') { return; } if (variableExports.errors.length) { variableExports.reportErrors(context, node); return; } variableImports.forEach(function (im) { if (im.type !== 'Property' || !im.key || im.key.type !== 'Identifier') { return; } var deepLookup = variableExports.hasDeep(im.key.name); if (!deepLookup.found) { if (deepLookup.path.length > 1) { var deepPath = deepLookup.path. map(function (i) {return path.relative(path.dirname(context.getFilename()), i.path);}). join(' -> '); context.report(im.key, String(im.key.name) + ' not found via ' + String(deepPath)); } else { context.report(im.key, im.key.name + ' not found in \'' + source.value + '\''); } } }); } return { ImportDeclaration: checkSpecifiers.bind(null, 'imported', 'ImportSpecifier'), ExportNamedDeclaration: checkSpecifiers.bind(null, 'local', 'ExportSpecifier'), VariableDeclarator: checkRequire }; }return create;}() }; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uYW1lZC5qcyJdLCJuYW1lcyI6WyJwYXRoIiwibW9kdWxlIiwiZXhwb3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A9PSBudWxsXG4gICAgICAgIHx8IG5vZGUuaW1wb3J0S2luZCA9PT0gJ3R5cGUnXG4gICAgICAgIHx8IG5vZGUuaW1wb3J0S2luZCA9PT0gJ3R5cGVvZidcbiAgICAgICAgfHwgbm9kZS5leHBvcnRLaW5kID09PSAndHlwZSdcbiAgICAgICkge1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIGlmICghbm9kZS5zcGVjaWZpZXJzLnNvbWUoKGltKSA9PiBpbS50eXBlID09PSB0eXBlKSkge1xuICAgICAgICByZXR1cm47IC8vIG5vIG5hbWVkIGltcG9ydHMvZXhwb3J0c1xuICAgICAgfVxuXG4gICAgICBjb25zdCBpbXBvcnRzID0gRXhwb3J0cy5nZXQobm9kZS5zb3VyY2UudmFsdWUsIGNvbnRleHQpO1xuICAgICAgaWYgKGltcG9ydHMgPT0gbnVsbCB8fCBpbXBvcnRzLnBhcnNlR29hbCA9PT0gJ2FtYmlndW91cycpIHtcbiAgICAgICAgcmV0dXJuO1xuICAgICAgfVxuXG4gICAgICBpZiAoaW1wb3J0cy5lcnJvcnMubGVuZ3RoKSB7XG4gICAgICAgIGltcG9ydHMucmVwb3J0RXJyb3JzKGNvbnRleHQsIG5vZGUpO1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIG5vZGUuc3BlY2lmaWVycy5mb3JFYWNoKGZ1bmN0aW9uIChpbSkge1xuICAgICAgICBpZiAoXG4gICAgICAgICAgaW0udHlwZSAhPT0gdHlwZVxuICAgICAgICAgIC8vIGlnbm9yZSB0eXBlIGltcG9ydHNcbiAgICAgICAgICB8fCBpbS5pbXBvcnRLaW5kID09PSAndHlwZScgfHwgaW0uaW1wb3J0S2luZCA9PT0gJ3R5cGVvZidcbiAgICAgICAgKSB7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgY29uc3QgZGVlcExvb2t1cCA9IGltcG9ydHMuaGFzRGVlcChpbVtrZXldLm5hbWUp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lhYmxlRXhwb3J0cy5yZXBvcnRFcnJvcnMoY29udGV4dCwgbm9kZSk7XG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cblxuICAgICAgdmFyaWFibGVJbXBvcnRzLmZvckVhY2goZnVuY3Rpb24gKGltKSB7XG4gICAgICAgIGlmIChpbS50eXBlICE9PSAnUHJvcGVydHknIHx8ICFpbS5rZXkgfHwgaW0ua2V5LnR5cGUgIT09ICdJZGVudGlmaWVyJykge1xuICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN0IGRlZXBMb29rdXAgPSB2YXJpYWJsZUV4cG9ydHMuaGFzRGVlcChpbS5rZXkubmFtZSk7XG5cbiAgICAgICAgaWYgKCFkZWVwTG9va3VwLmZvdW5kKSB7XG4gICAgICAgICAgaWYgKGRlZXBMb29rdXAucGF0aC5sZW5ndGggPiAxKSB7XG4gICAgICAgICAgICBjb25zdCBkZWVwUGF0aCA9IGRlZXBMb29rdXAucGF0aFxuICAgICAgICAgICAgICAubWFwKGkgPT4gcGF0aC5yZWxhdGl2ZShwYXRoLmRpcm5hbWUoY29udGV4dC5nZXRGaWxlbmFtZSgpKSwgaS5wYXRoKSlcbiAgICAgICAgICAgICAgLmpvaW4oJyAtPiAnKTtcblxuICAgICAgICAgICAgY29udGV4dC5yZXBvcnQoaW0ua2V5LCBgJHtpbS5rZXkubmFtZX0gbm90IGZvdW5kIHZpYSAke2RlZXBQYXRofWApO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBjb250ZXh0LnJlcG9ydChpbS5rZXksIGltLmtleS5uYW1lICsgJyBub3QgZm91bmQgaW4gXFwnJyArIHNvdXJjZS52YWx1ZSArICdcXCcnKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICBJbXBvcnREZWNsYXJhdGlvbjogY2hlY2tTcGVjaWZpZXJzLmJpbmQobnVsbCwgJ2ltcG9ydGVkJywgJ0ltcG9ydFNwZWNpZmllcicpLFxuXG4gICAgICBFeHBvcnROYW1lZERlY2xhcmF0aW9uOiBjaGVja1NwZWNpZmllcnMuYmluZChudWxsLCAnbG9jYWwnLCAnRXhwb3J0U3BlY2lmaWVyJyksXG5cbiAgICAgIFZhcmlhYmxlRGVjbGFyYXRvcjogY2hlY2tSZXF1aXJlLFxuICAgIH07XG4gIH0sXG59O1xuIl19