12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- '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 },
- caseSensitiveStrict: { type: 'boolean', 'default': false } })] },
- create: function () {function create(context) {
- var options = context.options[0] || {};
- function checkSourceValue(source, node) {
- // ignore type-only imports
- if (node.importKind === 'type') {
- return;
- }
- var caseSensitive = !_resolve.CASE_SENSITIVE_FS && options.caseSensitive !== false;
- var caseSensitiveStrict = !_resolve.CASE_SENSITIVE_FS && options.caseSensitiveStrict;
- var resolvedPath = (0, _resolve2['default'])(source.value, context);
- if (resolvedPath === undefined) {
- context.report(
- source, 'Unable to resolve path to module \'' + String(
- source.value) + '\'.');
- } else if (caseSensitive || caseSensitiveStrict) {
- var cacheSettings = _ModuleCache2['default'].getSettings(context.settings);
- if (!(0, _resolve.fileExistsWithCaseSync)(resolvedPath, cacheSettings, caseSensitiveStrict)) {
- context.report(
- source, 'Casing of ' + String(
- source.value) + ' does not match the underlying filesystem.');
- }
- }
- }
- return (0, _moduleVisitor2['default'])(checkSourceValue, options);
- }return create;}() };
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby11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