🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

eslint-module-utils

Package Overview
Dependencies
Maintainers
3
Versions
35
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.13.0
to
2.14.0
+10
-0
CHANGELOG.md

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

## v2.14.0 - 2026-07-02
### Added
- add `contextCompat` `getCWD()` (thanks [@ljharb])
- add eslint v10 support ([#3230], thanks [@rasmi])
### Fixed
- `declaredScope`: route through the `getScope` compat shim instead of the removed `context.getScope()` (ESLint 9+) (thanks [@ljharb])
## v2.13.0 - 2026-05-27

@@ -194,2 +203,3 @@

[#3240]: https://github.com/import-js/eslint-plugin-import/pull/3240
[#3124]: https://github.com/import-js/eslint-plugin-import/pull/3124

@@ -196,0 +206,0 @@ [#3072]: https://github.com/import-js/eslint-plugin-import/pull/3072

+17
-13

@@ -5,17 +5,19 @@ import { Scope, SourceCode, Rule } from 'eslint';

type LegacyContext = {
getFilename: () => string,
getPhysicalFilename: () => string,
getSourceCode: () => SourceCode,
getScope: never,
getAncestors: never,
getDeclaredVariables: never,
getCwd: () => string;
getFilename: () => string;
getPhysicalFilename: () => string;
getSourceCode: () => SourceCode;
getScope: never;
getAncestors: never;
getDeclaredVariables: never;
};
type NewContext = {
filename: string,
sourceCode: SourceCode,
getPhysicalFilename?: () => string,
getScope: () => Scope.Scope,
getAncestors: () => ESTree.Node[],
getDeclaredVariables: (node: ESTree.Node) => Scope.Variable[],
cwd: string;
filename: string;
sourceCode: SourceCode;
getPhysicalFilename?: () => string;
getScope: () => Scope.Scope;
getAncestors: () => ESTree.Node[];
getDeclaredVariables: (node: ESTree.Node) => Scope.Variable[];
};

@@ -29,7 +31,9 @@

declare function getPhysicalFilename(context: Context): string;
declare function getScope(context: Context, node: ESTree.Node): Scope.Scope;
declare function getScope(context: Context, node?: ESTree.Node): Scope.Scope;
declare function getSourceCode(context: Context): SourceCode;
declare function getCWD(context: Context): string | undefined;
export {
getAncestors,
getCWD,
getDeclaredVariables,

@@ -36,0 +40,0 @@ getFilename,

@@ -38,2 +38,6 @@ 'use strict';

function getPhysicalFilename(context) {
if ('physicalFilename' in context) {
return context.physicalFilename;
}
if (context.getPhysicalFilename) {

@@ -51,2 +55,3 @@ return context.getPhysicalFilename();

if (sourceCode && sourceCode.getScope) {
// @ts-expect-error TODO: investigate why this is needed
return sourceCode.getScope(node);

@@ -67,4 +72,15 @@ }

/** @type {import('./contextCompat').getCWD} */
function getCWD(context) {
if ('cwd' in context) {
return context.cwd;
}
if (context.getCwd) {
return context.getCwd();
}
}
module.exports = {
getAncestors,
getCWD,
getDeclaredVariables,

@@ -71,0 +87,0 @@ getFilename,

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

exports.default = function declaredScope(context, name, node) {
const references = (node ? getScope(context, node) : context.getScope()).references;
const references = getScope(context, node).references;
const reference = references.find((x) => x.identifier.name === name);

@@ -12,0 +12,0 @@ if (!reference || !reference.resolved) { return undefined; }

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

@@ -43,3 +43,4 @@ "engines": {

"posttsc": "attw -P .",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"dependencies": "DT_CLEAN_NPM_COMMAND=\"$npm_command\" npx dt-clean@^1.2.0 --auto"
},

@@ -67,7 +68,7 @@ "repository": {

"devDependencies": {
"@arethetypeswrong/cli": "^0.18.2",
"@arethetypeswrong/cli": "^0.18.4",
"@ljharb/tsconfig": "^0.3.2",
"@types/debug": "^4.1.13",
"@types/eslint": "^8.56.12",
"@types/node": "^20.19.37",
"@types/node": "^20.19.43",
"typescript": "next"

@@ -74,0 +75,0 @@ },

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

const languageOptions = context.languageOptions;
let parserOptions = languageOptions && languageOptions.parserOptions || context.parserOptions;
let parserOptions = languageOptions && languageOptions.parserOptions || context.parserOptions || {};
const parserOrPath = getParser(path, context);

@@ -120,0 +120,0 @@

@@ -7,2 +7,4 @@ {

"maxNodeModuleJsDepth": 0,
"ignoreDeprecations": "6.0",
"types": ["node"]
},

@@ -9,0 +11,0 @@ "exclude": [