123456789101112131415161718192021222324 |
- 'use strict';var _moduleVisitor = require('eslint-module-utils/moduleVisitor');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: {
- 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);
- } };
|