Socket
Socket
Sign inDemoInstall

eslint-module-utils

Package Overview
Dependencies
8
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.7.1 to 2.7.2

pkgDir.js

16

CHANGELOG.md
# Change Log
All notable changes to this module will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
This project adheres to [Semantic Versioning](https://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](https://keepachangelog.com).
## Unreleased
## v2.7.2 - 2022-01-01
### Fixed
- [patch] Fix `@babel/eslint-parser` 8 compatibility ([#2343], thanks [@nicolo-ribaudo])
### Changed
- [Refactor] inline `pkgDir` implementation; remove `pkg-dir`
## v2.7.1 - 2021-10-13
### Fixed
- fixed SyntaxError in node <= 6: Unexpected token ) in parse.js ([#2261], thanks [@VitusFW])
- fixed SyntaxError in node <= 6: Unexpected token ) in parse.js ([#2261], thanks [@VitusFW])

@@ -105,2 +113,3 @@ ## v2.7.0 - 2021-10-11

[#2343]: https://github.com/import-js/eslint-plugin-import/pull/2343
[#2261]: https://github.com/import-js/eslint-plugin-import/pull/2261

@@ -142,2 +151,3 @@ [#2212]: https://github.com/import-js/eslint-plugin-import/pull/2212

[@mgwalker]: https://github.com/mgwalker
[@nicolo-ribaudo]: https://github.com/nicolo-ribaudo
[@pmcelhaney]: https://github.com/pmcelhaney

@@ -144,0 +154,0 @@ [@sergei-startsev]: https://github.com/sergei-startsev

4

moduleVisitor.js

@@ -57,3 +57,3 @@ 'use strict';

// for CommonJS `require` calls
// adapted from @mctep: http://git.io/v4rAu
// adapted from @mctep: https://git.io/v4rAu
function checkCommon(call) {

@@ -85,3 +85,3 @@ if (call.callee.type !== 'Identifier') return;

if (element.value === 'require' ||
element.value === 'exports') continue; // magic modules: http://git.io/vByan
element.value === 'exports') continue; // magic modules: https://git.io/vByan

@@ -88,0 +88,0 @@ checkSourceValue(element, element);

{
"name": "eslint-module-utils",
"version": "2.7.1",
"version": "2.7.2",
"description": "Core utilities to support eslint-plugin-import and other module-related plugins.",

@@ -30,5 +30,4 @@ "engines": {

"debug": "^3.2.7",
"find-up": "^2.1.0",
"pkg-dir": "^2.0.0"
"find-up": "^2.1.0"
}
}

@@ -10,3 +10,3 @@ 'use strict';

function getBabelVisitorKeys(parserPath) {
function getBabelEslintVisitorKeys(parserPath) {
if (parserPath.endsWith('index.js')) {

@@ -18,8 +18,2 @@ const hypotheticalLocation = parserPath.replace('index.js', 'visitor-keys.js');

}
} else if (parserPath.endsWith('index.cjs')) {
const hypotheticalLocation = parserPath.replace('index.cjs', 'worker/ast-info.cjs');
if (fs.existsSync(hypotheticalLocation)) {
const astInfo = moduleRequire(hypotheticalLocation);
return astInfo.getVisitorKeys();
}
}

@@ -30,13 +24,12 @@ return null;

function keysFromParser(parserPath, parserInstance, parsedResult) {
// Exposed by @typescript-eslint/parser and @babel/eslint-parser
if (parsedResult && parsedResult.visitorKeys) {
return parsedResult.visitorKeys;
}
if (/.*espree.*/.test(parserPath)) {
return parserInstance.VisitorKeys;
}
if (/.*(babel-eslint|@babel\/eslint-parser).*/.test(parserPath)) {
return getBabelVisitorKeys(parserPath);
if (/.*babel-eslint.*/.test(parserPath)) {
return getBabelEslintVisitorKeys(parserPath);
}
if (/.*@typescript-eslint\/parser/.test(parserPath)) {
if (parsedResult) {
return parsedResult.visitorKeys;
}
}
return null;

@@ -43,0 +36,0 @@ }

'use strict';
exports.__esModule = true;
const pkgDir = require('pkg-dir');
const fs = require('fs');

@@ -12,2 +10,3 @@ const Module = require('module');

const ModuleCache = require('./ModuleCache').default;
const pkgDir = require('./pkgDir').default;

@@ -55,3 +54,3 @@ const CASE_SENSITIVE_FS = !fs.existsSync(path.join(__dirname.toUpperCase(), 'reSOLVE.js'));

// http://stackoverflow.com/a/27382838
// https://stackoverflow.com/a/27382838
exports.fileExistsWithCaseSync = function fileExistsWithCaseSync(filepath, cacheSettings, strict) {

@@ -180,3 +179,3 @@ // don't care if the FS is case-sensitive

function getBaseDir(sourceFile) {
return pkgDir.sync(sourceFile) || process.cwd();
return pkgDir(sourceFile) || process.cwd();
}

@@ -183,0 +182,0 @@ function requireResolver(name, sourceFile) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc