12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- '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 };}
- 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]);
- } };
|