Socket
Socket
Sign inDemoInstall

eslint-module-utils

Package Overview
Dependencies
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-module-utils - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

package-lock.json

6

CHANGELOG.md

@@ -8,2 +8,8 @@ # Change Log

## v2.2.0 - 2018-03-29
### Changed
- `parse`: attach node locations by default.
- `moduleVisitor`: visitor now gets the full `import` statement node as a second
argument, so rules may report against the full statement / `require` call instead
of only the string literal node.

@@ -10,0 +16,0 @@ ## v2.1.1 - 2017-06-22

15

moduleVisitor.js

@@ -1,2 +0,2 @@

"use strict"
'use strict'
exports.__esModule = true

@@ -22,3 +22,3 @@

function checkSourceValue(source) {
function checkSourceValue(source, importer) {
if (source == null) return //?

@@ -30,3 +30,3 @@

// fire visitor
visitor(source)
visitor(source, importer)
}

@@ -36,3 +36,3 @@

function checkSource(node) {
checkSourceValue(node.source)
checkSourceValue(node.source, node)
}

@@ -51,3 +51,3 @@

checkSourceValue(modulePath)
checkSourceValue(modulePath, call)
}

@@ -71,3 +71,3 @@

checkSourceValue(element)
checkSourceValue(element, element)
}

@@ -98,5 +98,2 @@ }

* adding extra fields.
* @param {[type]} additionalProperties [description]
* @return {[type]} [description]
*/

@@ -103,0 +100,0 @@ function makeOptionsSchema(additionalProperties) {

2

package.json
{
"name": "eslint-module-utils",
"version": "2.1.1",
"version": "2.2.0",
"description": "Core utilities to support eslint-plugin-import and other module-related plugins.",

@@ -5,0 +5,0 @@ "engines": {

@@ -22,5 +22,9 @@ "use strict"

// always attach comments
// always include and attach comments
parserOptions.comment = true
parserOptions.attachComment = true
// attach node locations
parserOptions.loc = true
// provide the `filePath` like eslint itself does, in `parserOptions`

@@ -27,0 +31,0 @@ // https://github.com/eslint/eslint/blob/3ec436ee/lib/linter.js#L637

@@ -17,2 +17,16 @@ "use strict"

function tryRequire(target) {
let resolved;
try {
// Check if the target exists
resolved = require.resolve(target);
} catch(e) {
// If the target does not exist then just return undefined
return undefined;
}
// If the target exists then return the loaded module
return require(resolved);
}
// http://stackoverflow.com/a/27382838

@@ -25,2 +39,3 @@ exports.fileExistsWithCaseSync = function fileExistsWithCaseSync(filepath, cacheSettings) {

if (filepath === null) return true
if (filepath.toLowerCase() === process.cwd().toLowerCase()) return true
const parsedPath = path.parse(filepath)

@@ -139,23 +154,16 @@ , dir = parsedPath.dir

function getBaseDir(sourceFile) {
return pkgDir.sync(sourceFile) || process.cwd()
}
function requireResolver(name, sourceFile) {
// Try to resolve package with conventional name
try {
return require(`eslint-import-resolver-${name}`)
} catch (err) { /* continue */ }
let resolver = tryRequire(`eslint-import-resolver-${name}`) ||
tryRequire(name) ||
tryRequire(path.resolve(getBaseDir(sourceFile), name))
// Try to resolve package with custom name (@myorg/resolver-name)
try {
return require(name)
} catch (err) { /* continue */ }
// Try to resolve package with path, relative to closest package.json
// or current working directory
try {
const baseDir = pkgDir.sync(sourceFile) || process.cwd()
// absolute paths ignore base, so this covers both
return require(path.resolve(baseDir, name))
} catch (err) { /* continue */ }
// all else failed
throw new Error(`unable to load resolver "${name}".`)
if (!resolver) {
throw new Error(`unable to load resolver "${name}".`)
} else {
return resolver;
}
}

@@ -162,0 +170,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