'use strict'; var _resolve = require('eslint-module-utils/resolve'); var _resolve2 = _interopRequireDefault(_resolve); var _ModuleCache = require('eslint-module-utils/ModuleCache'); var _ModuleCache2 = _interopRequireDefault(_ModuleCache); var _moduleVisitor = require('eslint-module-utils/moduleVisitor'); var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor); var _docsUrl = require('../docsUrl'); var _docsUrl2 = _interopRequireDefault(_docsUrl); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * @fileOverview Ensures that an imported path exists, given resolution rules. * @author Ben Mosher */ module.exports = { meta: { type: 'problem', docs: { url: (0, _docsUrl2.default)('no-unresolved') }, schema: [(0, _moduleVisitor.makeOptionsSchema)({ caseSensitive: { type: 'boolean', default: true } })] }, create: function (context) { function checkSourceValue(source) { const shouldCheckCase = !_resolve.CASE_SENSITIVE_FS && (!context.options[0] || context.options[0].caseSensitive !== false); const resolvedPath = (0, _resolve2.default)(source.value, context); if (resolvedPath === undefined) { context.report(source, `Unable to resolve path to module '${source.value}'.`); } else if (shouldCheckCase) { const cacheSettings = _ModuleCache2.default.getSettings(context.settings); if (!(0, _resolve.fileExistsWithCaseSync)(resolvedPath, cacheSettings)) { context.report(source, `Casing of ${source.value} does not match the underlying filesystem.`); } } } return (0, _moduleVisitor2.default)(checkSourceValue, context.options[0]); } }; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vLXVucmVzb2x2ZWQuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsInNjaGVtYSIsImNhc2VTZW5zaXRpdmUiLCJkZWZhdWx0IiwiY3JlYXRlIiwiY29udGV4dCIsImNoZWNrU291cmNlVmFsdWUiLCJzb3VyY2UiLCJzaG91bGRDaGVja0Nhc2UiLCJDQVNFX1NFTlNJVElWRV9GUyIsIm9wdGlvbnMiLCJyZXNvbHZ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