import isStaticRequire from '../core/staticRequire'

function reportIfMissing(context, node, name) {
  if (isAbsolute(name)) {
    context.report(node, 'Do not import modules using an absolute path')
  }
}

function isAbsolute(name) {
  return name.indexOf('/') === 0
}

module.exports = {
  meta: {
    docs: {},
  },

  create: function (context) {
    return {
      ImportDeclaration: function handleImports(node) {
        reportIfMissing(context, node, node.source.value)
      },
      CallExpression: function handleRequires(node) {
        if (isStaticRequire(node)) {
          reportIfMissing(context, node, node.arguments[0].value)
        }
      },
    }
  },
}

import isStaticRequire from '../core/staticRequire'

function reportIfAbsolute(context, node, name) {
  if (isAbsolute(name)) {
    context.report(node, 'Do not import modules using an absolute path')
  }
}

function isAbsolute(name) {
  return name.indexOf('/') === 0
}

module.exports = {
  meta: {
    docs: {},
  },

  create: function (context) {
    return {
      ImportDeclaration: function handleImports(node) {
        reportIfAbsolute(context, node, node.source.value)
      },
      CallExpression: function handleRequires(node) {
        if (isStaticRequire(node)) {
          reportIfAbsolute(context, node, node.arguments[0].value)
        }
      },
    }
  },
}

Rename funtion reportIfMissing to reportIfAbsolute
Rename funtion reportIfMissing to reportIfAbsolute

The old name seems wrong. Probably copied from no-extraneuous-dependencies
