mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-11-29 19:05:22 +01:00
49 lines
5.9 KiB
JavaScript
49 lines
5.9 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 (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.`);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
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