Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 }; }
// todo: cache cycles / deep relationships for faster repeat evaluation
module.exports = {
meta: {
type: 'suggestion',
docs: { url: (0, _docsUrl2.default)('no-cycle') },
schema: [(0, _moduleVisitor.makeOptionsSchema)({
maxDepth: {
description: 'maximum dependency depth to traverse',
type: 'integer',
minimum: 1
}
})]
},
create: function (context) {
const myPath = context.getFilename();
if (myPath === '
var _resolve2 = _interopRequireDefault(_resolve);
var _importType = require('../core/importType');
var _importType2 = _interopRequireDefault(_importType);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2.default)('no-relative-parent-imports')
},
schema: [(0, _moduleVisitor.makeOptionsSchema)()]
},
create: function noRelativePackages(context) {
const myPath = context.getFilename();
if (myPath === '
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)) {
var _importType = require('../core/importType');
var _docsUrl = require('../docsUrl');
var _docsUrl2 = _interopRequireDefault(_docsUrl);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2.default)('no-absolute-path')
},
schema: [(0, _moduleVisitor.makeOptionsSchema)()]
},
create: function (context) {
function reportIfAbsolute(source) {
if ((0, _importType.isAbsolute)(source.value)) {
context.report(source, 'Do not import modules using an absolute path');
}
}
const options = Object.assign({ esmodule: true, commonjs: true }, context.options[0]);
return (0, _moduleVisitor2.default)(reportIfAbsolute, options);
}
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vLWFic29sdXRlLXBhdGguanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJyZXBvcnRJZkFic29sdXRlIiwic291cmNlIiwidmFsdWUiLCJyZXBvcnQiLCJvcHRpb25zIiwiT2JqZWN0IiwiYXNzaWduIiwiZXNtb2R1bGUiLCJjb21tb25qcyJdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7OztBQUNBOztBQUNBOzs7Ozs7QUFFQUEsT0FBT0MsT0FBUCxHQUFpQjtBQUNmQyxRQUFNO0FBQ0pDLFVBQU0sWUFERjtBQUVKQyxVQUFNO0FBQ0pDLFdBQUssdUJBQVEsa0JBQVI7QUFERCxLQUZGO0FBS0pDLFlBQVEsQ0FBRSx1Q0FBRjtBQUxKLEdBRFM7O0FBU2ZDLFVBQVEsVUFBVUMsT0FBVixFQUFtQjtBQUN6QixhQUFTQyxnQkFBVCxDQUEwQkMsTUFBMUIsRUFBa0M7QUFDaEMsVUFBSSw0QkFBV0EsT0FBT0MsS0FBbEIsQ0FBSixFQUE4QjtBQUM1QkgsZ0JBQVFJLE1BQV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gIH1cblxuICAgIGNvbnN0IG9wdGlvbnMgPSBPYmplY3QuYXNzaWduKHsgZXNtb2R1bGU6IHRydWUsIGNvbW1vbmpzOiB0cnVlIH0sIGNvbnRleHQub3B0aW9uc1swXSlcbiAgICByZXR1cm4gbW9kdWxlVmlzaXRvcihyZXBvcnRJZkFic29sdXRlLCBvcHRpb25zKVxuICB9LFxufVxuIl19
var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor);
var _importType = require('../core/importType');
var _docsUrl = require('../docsUrl');
var _docsUrl2 = _interopRequireDefault(_docsUrl);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = {
meta: {
docs: {
url: (0, _docsUrl2.default)('no-absolute-path')
},
schema: [(0, _moduleVisitor.makeOptionsSchema)()]
},
create: function (context) {
function reportIfAbsolute(source) {
if ((0, _importType.isAbsolute)(source.value)) {
context.report(source, 'Do not import modules using an absolute path');
}
}
const options = Object.assign({ esmodule: true, commonjs: true }, context.options[0]);
return (0, _moduleVisitor2.default)(reportIfAbsolute, options);
}
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vLWFic29sdXRlLXBhdGguanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJkb2NzIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsInJlcG9ydElmQWJzb2x1dGUiLCJzb3VyY2UiLCJ2YWx1ZSIsInJlcG9ydCIsIm9wdGlvbnMiLCJPYmplY3QiLCJhc3NpZ24iLCJlc21vZHVsZSIsImNvbW1vbmpzIl0sIm1hcHBpbmdzIjoiOztBQUFBOzs7O0FBQ0E7O0FBQ0E7Ozs7OztBQUVBQSxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFBQU07QUFDSkMsVUFBTTtBQUNKQyxXQUFLLHVCQUFRLGtCQUFSO0FBREQsS0FERjtBQUlKQy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pIHtcbiAgICAgIGlmIChpc0Fic29sdXRlKHNvdXJjZS52YWx1ZSkpIHtcbiAgICAgICAgY29udGV4dC5yZXBvcnQoc291cmNlLCAnRG8gbm90IGltcG9ydCBtb2R1bGVzIHVzaW5nIGFuIGFic29sdXRlIHBhdGgnKVxuICAgICAgfVxuICAgIH1cblxuICAgIGNvbnN0IG9wdGlvbnMgPSBPYmplY3QuYXNzaWduKHsgZXNtb2R1bGU6IHRydWUsIGNvbW1vbmpzOiB0cnVlIH0sIGNvbnRleHQub3B0aW9uc1swXSlcbiAgICByZXR1cm4gbW9kdWxlVmlzaXRvcihyZXBvcnRJZkFic29sdXRlLCBvcHRpb25zKVxuICB9LFxufVxuIl19
var _importType = require('../core/importType');
var _docsUrl = require('../docsUrl');
var _docsUrl2 = _interopRequireDefault(_docsUrl);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2.default)('no-absolute-path')
},
schema: [(0, _moduleVisitor.makeOptionsSchema)()]
},
create: function (context) {
function reportIfAbsolute(source) {
if (typeof source.value === 'string' && (0, _importType.isAbsolute)(source.value)) {
context.report(source, 'Do not import modules using an absolute path');
}
}
const options = Object.assign({ esmodule: true, commonjs: true }, context.options[0]);
return (0, _moduleVisitor2.default)(reportIfAbsolute, options);
}
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1hYnNvbHV0ZS1wYXRoLmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJ1cmwiLCJzY2hlbWEiLCJjcmVhdGUiLCJjb250ZXh0IiwicmVwb3J0SWZBYnNvbHV0ZSIsInNvdXJjZSIsInZhbHVlIiwicmVwb3J0Iiwib3B0aW9ucyIsIk9iamVjdCIsImFzc2lnbiIsImVzbW9kdW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yA9IHtcbiAgbWV0YToge1xuICAgIHR5cGU6ICdzdWdnZXN0aW9uJyxcbiAgICBkb2NzOiB7XG4gICAgICB1cmw6IGRvY3NVcmwoJ25vLWFic29sdXRlLXBhdGgnKSxcbiAgICB9LFxuICAgIHNjaGVtYTogWyBtYWtlT3B0aW9uc1NjaGVtYSgpIF0sXG4gIH0sXG5cbiAgY3JlYXRlOiBmdW5jdGlvbiAoY29udGV4dCkge1xuICAgIGZ1bmN0aW9uIHJlcG9ydElmQWJzb2x1dGUoc291cmNlKSB7XG4gICAgICBpZiAodHlwZW9mIHNvdXJjZS52YWx1ZSA9PT0gJ3N0cmluZycgJiYgaXNBYnNvbHV0ZShzb3VyY2UudmFsdWUpKSB7XG4gICAgICAgIGNvbnRleHQucmVwb3J0KHNvdXJjZSwgJ0RvIG5vdCBpbXBvcnQgbW9kdWxlcyB1c2luZyBhbiBhYnNvbHV0ZSBwYXRoJylcbiAgICAgIH1cbiAgICB9XG5cbiAgICBjb25zdCBvcHRpb25zID0gT2JqZWN0LmFzc2lnbih7IGVzbW9kdWxlOiB0cnVlLCBjb21tb25qczogdHJ1ZSB9LCBjb250ZXh0Lm9wdGlvbnNbMF0pXG4gICAgcmV0dXJuIG1vZHVsZVZpc2l0b3IocmVwb3J0SWZBYnNvbHV0ZSwgb3B0aW9ucylcbiAgfSxcbn1cbiJdfQ==
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)) {
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: {
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)) {