Registry / devops / eslint-import-context

eslint-import-context

JSON →
library0.2.0jsnpmunverified

A utility library providing context information for eslint-plugin-import-x, eliminating the need for extra arguments. Version 0.2.0 is the current stable release, actively maintained with frequent patches. It ships TypeScript types and relies on oxc-resolver as a peer dependency. Key differentiator: simplifies usage of eslint-plugin-import-x by wrapping resolver context.

npm install eslint-import-context
INSTALL
IMPORT
SIG · ESLINT-IMPORT-CONT
E
eslint-import-context
devopsjavascriptv0.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

useRuleContext
import { useRuleContext } from 'eslint-import-context'
const { useRuleContext } = require('eslint-import-context')
ESM-only; CommonJS require may work but is not recommended.
getTsconfigWithContext
import { getTsconfigWithContext } from 'eslint-import-context'
const getTsconfigWithContext = require('eslint-import-context').getTsconfigWithContext
Named export, not default.
default
import eslintImportContext from 'eslint-import-context'
import * as eslintImportContext from 'eslint-import-context'
No default export; use named imports instead.

Shows how to use useRuleContext and getTsconfigWithContext in an ESLint rule to get resolver context and tsconfig.

import { useRuleContext, getTsconfigWithContext } from 'eslint-import-context'; // In an ESLint rule const rule = { create(context) { const ruleContext = useRuleContext(context); const tsconfig = getTsconfigWithContext(ruleContext); return {}; } }; export default rule;
Debug
Known issues
breakingv0.2.0 migrated from unrs-resolver to oxc-resolver. Ensure you have oxc-resolver as a peer dependency.
fix
npm install oxc-resolver or add to peerDependencies.
affects: >=0.2.0
deprecatedv0.1.8 replaced stable-hash with stable-hash-x. Update imports if manually using stable-hash.
fix
Use stable-hash-x instead.
affects: >=0.1.8
gotchav0.1.5 removed tslib dependency. If you depend on tslib for other reasons, ensure it's still installed.
fix
Install tslib separately if needed.
affects: >=0.1.5
breakingv0.1.3 changed to CommonJS single entry type. May affect bundlers expecting ESM.
fix
Check bundler configuration for CommonJS compatibility.
affects: >=0.1.3
gotchaVersion 0.1.4 fixed missing peer dependencies; earlier versions required manual installation.
fix
Update to >=0.1.4 or manually add missing peer deps.
affects: <0.1.4
gotchaThe package ships TypeScript types but may have incomplete types in early versions (e.g., v0.1.6 fixed NodeResolverOptions).
fix
Update to v0.1.6 or later for correct types.
affects: <0.1.6
Errors
Common errors & fixes
Cannot find module 'oxc-resolver'
Missing peer dependency after upgrading to v0.2.0.
fix
npm install oxc-resolver --save-dev
TypeError: getTsconfigWithContext is not a function
Incorrect import; likely using default import or wrong named export.
fix
import { getTsconfigWithContext } from 'eslint-import-context'
Module not found: Can't resolve 'stable-hash'
Using old peer dependency stable-hash with v0.1.8+.
fix
Update to stable-hash-x or downgrade to v0.1.7.
Type error: Property 'NodeResolverOptions' does not exist on type...
Using Typescript definitions older than v0.1.6.
fix
Update eslint-import-context to v0.1.6 or later.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
oxc-resolverrequiredPeer dependency required for resolver context
Agent activity
2 hits · last 30 days
node
2
Resources