{"id":19869,"library":"eslint-plugin-paths","title":"eslint-plugin-paths","description":"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.","status":"active","version":"1.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/vitonsky/eslint-plugin-paths","tags":["javascript","eslint","eslintplugin","typescript"],"install":[{"cmd":"npm install eslint-plugin-paths","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-paths","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-paths","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for plugin to function","package":"eslint","optional":false}],"imports":[{"note":"Default import is used; plugin is ESM-compatible.","wrong":"const paths = require('eslint-plugin-paths')","symbol":"plugin","correct":"import paths from 'eslint-plugin-paths'"},{"note":"Rules are namespaced under 'paths/' prefix.","wrong":"'plugins/paths/alias': 'error'","symbol":"rule alias","correct":"'paths/alias': 'error'"},{"note":"Option name is 'config', not 'configFilePath' in v1.1.0.","wrong":"\"paths/alias\": [\"error\", { \"configFilePath\": \"tsconfig.json\" }]","symbol":"config","correct":"\"paths/alias\": [\"error\", { \"config\": \"tsconfig.json\" }]"}],"quickstart":{"code":"npm install -D eslint-plugin-paths\n\necho '{\n  \"plugins\": [\"eslint-plugin-paths\"],\n  \"rules\": {\n    \"paths/alias\": \"error\"\n  }\n}' > .eslintrc.json\n\n# tsconfig.json example\necho '{\n  \"compilerOptions\": {\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@/*\": [\"src/*\"]\n    }\n  }\n}' > tsconfig.json\n\n# Invalid: relative import\necho 'import foo from \"./foo\"' > src/index.ts\n\n# Run ESLint\nnpx eslint src/index.ts --fix","lang":"typescript","description":"Install plugin, configure ESLint, set up tsconfig paths, and run ESLint to enforce alias usage."},"warnings":[{"fix":"Ensure your aliases are defined in a compatible config file or use configFilePath option.","message":"Plugin reads only tsconfig.json or jsconfig.json; custom aliases in other files are ignored.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Manually review tsconfig paths to avoid unused aliases.","message":"The rule does not check for unused aliases; it only enforces alias usage when possible.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Disable auto-fix for specific files or paths with ESLint comment or ignore patterns.","message":"Auto-fix may change import paths to aliases even when relative path is intended; no ignore annotation support.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If multiple configs needed, consider extending the plugin or using a preprocessor.","message":"Plugin does not support multiple config files out of the box; configFilePath accepts a single file.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use: \"paths/alias\": \"error\" or \"paths/alias\": [\"error\", options] in ESLint config.","cause":"Incorrect rule configuration syntax.","error":"Configuration for rule \"paths/alias\" is invalid: Value \"error\" for key \"severity\" should be a number or string."},{"fix":"Add \"eslint-plugin-paths\" to the plugins section in ESLint config.","cause":"Plugin not added to ESLint plugins array.","error":"Definition for rule 'paths/alias' was not found."},{"fix":"Run: npm install -D eslint-plugin-paths","cause":"Plugin not installed or wrong package name.","error":"Cannot find module 'eslint-plugin-paths'"},{"fix":"Create tsconfig.json or set configFilePath option with absolute/relative path.","cause":"tsconfig.json not found in working directory or custom path wrong.","error":"Unable to resolve path to tsconfig.json"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}