How to use the eslint-import-resolver-node.resolve function in eslint-import-resolver-node

To help you get started, we’ve selected a few eslint-import-resolver-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / kibana / packages / kbn-eslint-import-resolver-kibana / import_resolver_kibana.js View on Github external
function tryNodeResolver(importRequest, file, config) {
  return nodeResolver.resolve(
    importRequest,
    file,
    // we use Object.assign so that this file is compatible with slightly older
    // versions of node.js used by IDEs (eg. resolvers are run in the Electron
    // process in Atom)
    Object.assign({}, config, {
      extensions: ['.js', '.json', '.ts', '.tsx'],
      isFile,
    })
  );
}
github LeadingLight / eslint-import-resolver-react-native / index.js View on Github external
function checkImages(source, file, config, platform=null) {
  var splitSource = source.split('.');
  var noSuffix = splitSource.slice(0, -1).join('.');
  var suffix = '.' + splitSource.slice(-1);
  var platformPart = (platform === null ? '' : `.${platform}`);

  for(sizeSuffix of ['', ...sizeSuffixes]) {
    const pathToTry = `${noSuffix}${sizeSuffix}${platformPart}${suffix}`;
    const image = nodeResolve(pathToTry, file, config);
    if(image.found) {
      return image
    }
  }
  return {found: false};
}
github LeadingLight / eslint-import-resolver-react-native / index.js View on Github external
function resolvePlatform(source, file, config, platform) {
  if (isImage(source)) {
    return checkImages(source, file, config, platform);
  }
  else {
    return nodeResolve(source + '.' + platform, file, config);
  }
}

eslint-import-resolver-node

Node default behavior import resolution plugin for eslint-plugin-import.

MIT
Latest version published 10 months ago

Package Health Score

91 / 100
Full package analysis

Popular eslint-import-resolver-node functions