eslint-import-resolver-webpack
Advanced tools
Comparing version
28
index.js
@@ -11,3 +11,3 @@ 'use strict'; | ||
const isCore = require('is-core-module'); | ||
const resolve = require('resolve'); | ||
const resolve = require('resolve/sync'); | ||
const semver = require('semver'); | ||
@@ -79,3 +79,3 @@ const has = require('has'); | ||
packageDir = findRoot(path.resolve(file)); | ||
if (!packageDir) throw new Error('package not found above ' + file); | ||
if (!packageDir) { throw new Error('package not found above ' + file); } | ||
} | ||
@@ -113,3 +113,3 @@ | ||
if (Array.isArray(webpackConfig)) { | ||
webpackConfig = webpackConfig.map(cfg => { | ||
webpackConfig = webpackConfig.map((cfg) => { | ||
if (typeof cfg === 'function') { | ||
@@ -196,7 +196,7 @@ return cfg(env, argv); | ||
// Attempt to resolve webpack from the given `basedir` | ||
const webpackFilename = resolve.sync('webpack', { basedir, preserveSymlinks: false }); | ||
const webpackFilename = resolve('webpack', { basedir, preserveSymlinks: false }); | ||
const webpackResolveOpts = { basedir: path.dirname(webpackFilename), preserveSymlinks: false }; | ||
webpackRequire = function (id) { | ||
return require(resolve.sync(id, webpackResolveOpts)); | ||
return require(resolve(id, webpackResolveOpts)); | ||
}; | ||
@@ -243,3 +243,3 @@ } catch (e) { | ||
/** | ||
* webpack 1 defaults: http://webpack.github.io/docs/configuration.html#resolve-packagemains | ||
* webpack 1 defaults: https://webpack.github.io/docs/configuration.html#resolve-packagemains | ||
* @type {Array} | ||
@@ -292,3 +292,2 @@ */ | ||
const resolvePlugins = []; | ||
@@ -300,5 +299,5 @@ | ||
if ( | ||
plugin.constructor && | ||
plugin.constructor.name === 'ResolverPlugin' && | ||
Array.isArray(plugin.plugins) | ||
plugin.constructor | ||
&& plugin.constructor.name === 'ResolverPlugin' | ||
&& Array.isArray(plugin.plugins) | ||
) { | ||
@@ -334,6 +333,6 @@ resolvePlugins.push.apply(resolvePlugins, plugin.plugins); | ||
function findExternal(source, externals, context, resolveSync) { | ||
if (!externals) return false; | ||
if (!externals) { return false; } | ||
// string match | ||
if (typeof externals === 'string') return (source === externals); | ||
if (typeof externals === 'string') { return source === externals; } | ||
@@ -395,4 +394,4 @@ // array: recurse | ||
for (const key in externals) { | ||
if (!has(externals, key)) continue; | ||
if (source === key) return true; | ||
if (!has(externals, key)) { continue; } | ||
if (source === key) { return true; } | ||
} | ||
@@ -408,3 +407,2 @@ return false; | ||
if (configPath) { | ||
@@ -411,0 +409,0 @@ // extensions is not reused below, so safe to mutate it here. |
{ | ||
"name": "eslint-import-resolver-webpack", | ||
"version": "0.13.2", | ||
"version": "0.13.3", | ||
"description": "Resolve paths to dependencies, given a webpack.config.js. Plugin for eslint-plugin-import.", | ||
@@ -39,7 +39,7 @@ "main": "index.js", | ||
"interpret": "^1.4.0", | ||
"is-core-module": "^2.7.0", | ||
"is-core-module": "^2.13.0", | ||
"is-regex": "^1.1.4", | ||
"lodash": "^4.17.21", | ||
"resolve": "^1.20.0", | ||
"semver": "^5.7.1" | ||
"resolve": "^1.22.4", | ||
"semver": "^5.7.2" | ||
}, | ||
@@ -46,0 +46,0 @@ "peerDependencies": { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
20146
0.07%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated