eslint-module-utils
Advanced tools
Comparing version 2.10.0 to 2.11.0
@@ -8,2 +8,7 @@ # Change Log | ||
## v2.11.0 - 2024-09-05 | ||
### New | ||
- `declaredScope`: take a `node` for modern eslint versions (thanks [@michaelfaith]) | ||
## v2.10.0 - 2024-09-05 | ||
@@ -10,0 +15,0 @@ |
import { Rule, Scope } from 'eslint'; | ||
import * as ESTree from 'estree'; | ||
declare function declaredScope( | ||
context: Rule.RuleContext, | ||
name: string | ||
name: string, | ||
node?: ESTree.Node, | ||
): Scope.Scope['type'] | undefined; | ||
export default declaredScope; |
@@ -5,5 +5,7 @@ 'use strict'; | ||
const { getScope } = require('./contextCompat'); | ||
/** @type {import('./declaredScope').default} */ | ||
exports.default = function declaredScope(context, name) { | ||
const references = context.getScope().references; | ||
exports.default = function declaredScope(context, name, node) { | ||
const references = (node ? getScope(context, node) : context.getScope()).references; | ||
const reference = references.find((x) => x.identifier.name === name); | ||
@@ -10,0 +12,0 @@ if (!reference || !reference.resolved) { return undefined; } |
{ | ||
"name": "eslint-module-utils", | ||
"version": "2.10.0", | ||
"version": "2.11.0", | ||
"description": "Core utilities to support eslint-plugin-import and other module-related plugins.", | ||
@@ -5,0 +5,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52755
1065