Registry / testing / eslint-plugin-paths

eslint-plugin-paths

JSON →
library1.1.0jsnpmunverified

ESLint plugin that enforces the use of path aliases defined in tsconfig.json or jsconfig.json instead of relative imports. Version 1.1.0 is the latest stable release, with active development. Unlike alternatives that introduce their own alias configuration, this plugin reads directly from TypeScript/JavaScript config files, providing a single source of truth. Supports auto-fix via eslint --fix. Designed for zero-config, plug-and-play usage. Requires ESLint and Node.js.

npm install eslint-plugin-paths
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-PATH
E
eslint-plugin-paths
testingjavascriptv1.1.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.

plugin
import paths from 'eslint-plugin-paths'
const paths = require('eslint-plugin-paths')
Default import is used; plugin is ESM-compatible.
rule alias
'paths/alias': 'error'
'plugins/paths/alias': 'error'
Rules are namespaced under 'paths/' prefix.
config
"paths/alias": ["error", { "config": "tsconfig.json" }]
"paths/alias": ["error", { "configFilePath": "tsconfig.json" }]
Option name is 'config', not 'configFilePath' in v1.1.0.

Install plugin, configure ESLint, set up tsconfig paths, and run ESLint to enforce alias usage.

npm install -D eslint-plugin-paths echo '{ "plugins": ["eslint-plugin-paths"], "rules": { "paths/alias": "error" } }' > .eslintrc.json # tsconfig.json example echo '{ "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["src/*"] } } }' > tsconfig.json # Invalid: relative import echo 'import foo from "./foo"' > src/index.ts # Run ESLint npx eslint src/index.ts --fix
Debug
Known issues
gotchaPlugin reads only tsconfig.json or jsconfig.json; custom aliases in other files are ignored.
fix
Ensure your aliases are defined in a compatible config file or use configFilePath option.
affects: >=1.0.0
gotchaThe rule does not check for unused aliases; it only enforces alias usage when possible.
fix
Manually review tsconfig paths to avoid unused aliases.
affects: >=1.0.0
gotchaAuto-fix may change import paths to aliases even when relative path is intended; no ignore annotation support.
fix
Disable auto-fix for specific files or paths with ESLint comment or ignore patterns.
affects: >=1.0.0
gotchaPlugin does not support multiple config files out of the box; configFilePath accepts a single file.
fix
If multiple configs needed, consider extending the plugin or using a preprocessor.
affects: >=1.0.0
Errors
Common errors & fixes
Configuration for rule "paths/alias" is invalid: Value "error" for key "severity" should be a number or string.
Incorrect rule configuration syntax.
fix
Use: "paths/alias": "error" or "paths/alias": ["error", options] in ESLint config.
Definition for rule 'paths/alias' was not found.
Plugin not added to ESLint plugins array.
fix
Add "eslint-plugin-paths" to the plugins section in ESLint config.
Cannot find module 'eslint-plugin-paths'
Plugin not installed or wrong package name.
fix
Run: npm install -D eslint-plugin-paths
Unable to resolve path to tsconfig.json
tsconfig.json not found in working directory or custom path wrong.
fix
Create tsconfig.json or set configFilePath option with absolute/relative path.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
eslintrequiredPeer dependency required for plugin to function
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-paths — npm install eslint-plugin-paths · libregistry