Socket
Socket
Sign inDemoInstall

eslint-import-resolver-node

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-import-resolver-node - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

58

index.js

@@ -1,47 +0,51 @@

var resolve = require('resolve')
, path = require('path')
'use strict';
var log = require('debug')('eslint-plugin-import:resolver:node')
const resolve = require('resolve');
const path = require('path');
exports.interfaceVersion = 2
const log = require('debug')('eslint-plugin-import:resolver:node');
exports.interfaceVersion = 2;
exports.resolve = function (source, file, config) {
log('Resolving:', source, 'from:', file)
var resolvedPath
log('Resolving:', source, 'from:', file);
let resolvedPath;
if (resolve.isCore(source)) {
log('resolved to core')
return { found: true, path: null }
log('resolved to core');
return { found: true, path: null };
}
try {
resolvedPath = resolve.sync(source, opts(file, config))
log('Resolved to:', resolvedPath)
return { found: true, path: resolvedPath }
resolvedPath = resolve.sync(source, opts(file, config));
log('Resolved to:', resolvedPath);
return { found: true, path: resolvedPath };
} catch (err) {
log('resolve threw error:', err)
return { found: false }
log('resolve threw error:', err);
return { found: false };
}
}
};
function opts(file, config) {
return Object.assign({
// more closely matches Node (#333)
// plus 'mjs' for native modules! (#939)
extensions: ['.mjs', '.js', '.json', '.node'],
},
config,
{
// path.resolve will handle paths relative to CWD
basedir: path.dirname(path.resolve(file)),
packageFilter: packageFilter,
// more closely matches Node (#333)
// plus 'mjs' for native modules! (#939)
extensions: ['.mjs', '.js', '.json', '.node'],
},
config,
{
// path.resolve will handle paths relative to CWD
basedir: path.dirname(path.resolve(file)),
packageFilter: packageFilter,
})
});
}
function packageFilter(pkg) {
if (pkg['jsnext:main']) {
pkg['main'] = pkg['jsnext:main']
if (pkg.module) {
pkg.main = pkg.module;
} else if (pkg['jsnext:main']) {
pkg.main = pkg['jsnext:main'];
}
return pkg
return pkg;
}
{
"name": "eslint-import-resolver-node",
"version": "0.3.4",
"version": "0.3.5",
"description": "Node default behavior import resolution plugin for eslint-plugin-import.",

@@ -17,3 +17,3 @@ "main": "index.js",

"type": "git",
"url": "https://github.com/benmosher/eslint-plugin-import"
"url": "https://github.com/import-js/eslint-plugin-import"
},

@@ -30,20 +30,15 @@ "keywords": [

"bugs": {
"url": "https://github.com/benmosher/eslint-plugin-import/issues"
"url": "https://github.com/import-js/eslint-plugin-import/issues"
},
"homepage": "https://github.com/benmosher/eslint-plugin-import",
"homepage": "https://github.com/import-js/eslint-plugin-import",
"dependencies": {
"debug": "^2.6.9",
"resolve": "^1.13.1"
"debug": "^3.2.7",
"resolve": "^1.20.0"
},
"devDependencies": {
"chai": "^3.5.0",
"coveralls": "^3.0.0",
"coveralls": "^3.1.0",
"mocha": "^3.5.3",
"nyc": "^11.7.1"
},
"nyc": {
"exclude": [
"test/"
]
"nyc": "^11.9.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc