odin-default-js-exercises/node_modules/eslint-plugin-import/lib/rules/no-absolute-path.js

28 lines
2.5 KiB
JavaScript
Raw Normal View History

2017-12-15 18:56:14 +00:00
'use strict';
var _importType = require('../core/importType');
var _moduleVisitor = require('eslint-module-utils/moduleVisitor');
var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = {
meta: {
docs: {},
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ1bGVzL25vLWFic29sdXRlLXBhdGguanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJkb2NzIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsInJlcG9ydElmQWJzb2x1dGUiLCJzb3VyY2UiLCJ2YWx1ZSIsInJlcG9ydCIsIm9wdGlvbnMiLCJPYmplY3QiLCJhc3NpZ24iLCJlc21vZHVsZSIsImNvbW1vbmpzIl0sIm1hcHBpbmdzIjoiOztBQUFBOztBQUNBOzs7Ozs7QUFFQUEsT0FBT0MsT0FBUCxHQUFpQjtBQUNmQyxRQUFNO0FBQ0pDLFVBQU0sRUFERjtBQUVKQyxZQUFRLENBQUUsdUNBQUY7QUFGSixHQURTOztBQU1mQyxVQUFRLFVBQVVDLE9BQVYsRUFBbUI7QUFDekIsYUFBU0MsZ0JBQVQsQ0FBMEJDLE1BQTFCLEVBQWtDO0FBQ2hDLFVBQUksNEJBQVdBLE9BQU9DLEtBQWxCLENBQUosRUFBOEI7QUFDNUJILGdCQUFRSSxNQUFSLENBQWVGLE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