mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
49 lines
6.0 KiB
JavaScript
49 lines
6.0 KiB
JavaScript
'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 () {function create(context) {
|
|
|
|
function checkSourceValue(source) {
|
|
var shouldCheckCase = !_resolve.CASE_SENSITIVE_FS && (
|
|
!context.options[0] || context.options[0].caseSensitive !== false);
|
|
|
|
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 (shouldCheckCase) {
|
|
var cacheSettings = _ModuleCache2['default'].getSettings(context.settings);
|
|
if (!(0, _resolve.fileExistsWithCaseSync)(resolvedPath, cacheSettings)) {
|
|
context.report(source, 'Casing of ' + String(
|
|
source.value) + ' does not match the underlying filesystem.');
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
return (0, _moduleVisitor2['default'])(checkSourceValue, context.options[0]);
|
|
|
|
}return create;}() };
|
|
//# sourceMappingURL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