{"id":19795,"library":"eslint-plugin-import-path","title":"eslint-plugin-import-path","description":"A tiny ESLint plugin (v0.0.2) for checking import/export paths against forbidden patterns and depth limits. It allows defining regex-based or substring-based blacklists and a maximum parent directory depth. Unlike the more comprehensive eslint-plugin-import, this plugin focuses solely on simple path validation without full module resolution. It is stable enough for development use, but the version 0.0.2 indicates it is still in early stages with no release cadence. Key differentiators: lightweight, no external dependencies beyond ESLint, and supports both regex and substring matching with custom error messages.","status":"active","version":"0.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/andrienko/eslint-plugin-import-path","tags":["javascript","eslint","eslintplugin","eslint-plugin"],"install":[{"cmd":"npm install eslint-plugin-import-path","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-import-path","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-import-path","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: the plugin operates as an ESLint rule and requires ESLint to function.","package":"eslint","optional":false}],"imports":[{"note":"This is a plugin, not a module with exports. It is loaded via ESLint's plugins configuration, not imported in code.","wrong":"import { /index$ } from 'eslint-plugin-import-path'","symbol":"eslint-plugin-import-path","correct":"import 'eslint-plugin-import-path' // no symbols to import, just side effects"},{"note":"Rules are configured inside ESLint config, not imported as JavaScript objects.","wrong":"// Trying to import a rule object:\nconst { forbidden } = require('eslint-plugin-import-path');","symbol":"rules","correct":"// In .eslintrc:\n\"rules\": {\n  \"import-path/forbidden\": [\"error\", [\"/index$\"]]\n}"}],"quickstart":{"code":"// Install the plugin\nnpm install eslint-plugin-import-path --save-dev\n\n// In your .eslintrc (JSON or JS config):\n{\n  \"plugins\": [\"import-path\"],\n  \"rules\": {\n    \"import-path/forbidden\": [\"warn\", [\"/index$\"]],\n    \"import-path/parent-depth\": [\"warn\", 2]\n  }\n}\n\n// Now ESLint will warn on imports like:\nimport Foo from 'somewhere/index';  // warns: path matches /index$\nimport Bar from '../../../../../deep'; // warns: depth > 2","lang":"javascript","description":"Installs the plugin and configures two rules: forbidding paths ending in '/index' and limiting parent directory depth to 2."},"warnings":[{"fix":"Use double escaping in JSON strings, e.g., 'match': '\\\\.' for a literal '.'","message":"The 'forbidden' rule uses regex strings; ensure you escape backslashes and special characters appropriately in JSON.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use 'match' for regex, 'contains' for plain substring.","message":"The 'forbidden' rule with 'contains' property does simple substring matching, not regex; ensure you use 'match' for regex patterns.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install eslint-plugin-import-path --save-dev","cause":"The plugin is not installed or not listed in the devDependencies.","error":"ESLint couldn't find the plugin \"eslint-plugin-import-path\"."},{"fix":"Use one of: 'off', 'warn', or 'error'.","cause":"The rule severity is set to an invalid value (e.g., 'warning' instead of 'warn').","error":"Configuration for rule \"import-path/forbidden\" is invalid: severity should be one of off, warn, error."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}