{"id":19798,"library":"eslint-plugin-index","title":"eslint-plugin-index","description":"An ESLint plugin (v1.1.7) providing rules to enforce proper usage of index.js files in Node.js projects. Includes two rules: `only-import-export` (allows only import/export statements in index files) and `forbid` (disallows files named index). Supports ESLint 7 or 8. Recommended for projects wanting to enforce index file conventions. Niche, simple, minimal overhead. Not updated frequently.","status":"active","version":"1.1.7","language":"javascript","source_language":"en","source_url":"https://github.com/artlaman/eslint-plugin-index","tags":["javascript","eslint","eslintplugin","eslint-plugin","index"],"install":[{"cmd":"npm install eslint-plugin-index","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-index","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-index","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for plugin to work","package":"eslint","optional":false}],"imports":[{"note":"ESLint automatically strips 'eslint-plugin-' prefix when loading plugins from node_modules.","wrong":"{ \"plugins\": [\"eslint-plugin-index\"] } // also works but unnecessary prefix","symbol":"plugin","correct":"// in .eslintrc: { \"plugins\": [\"index\"] }"},{"note":"Extending plugin configs requires 'plugin:' prefix.","wrong":"{ \"extends\": [\"index/recommended\"] } // missing plugin: prefix","symbol":"recommended config","correct":"// in .eslintrc: { \"extends\": [\"plugin:index/recommended\"] }"},{"note":"Rule name must include plugin namespace prefix 'index/'.","wrong":"// no common wrong pattern","symbol":"only-import-export rule","correct":"// in .eslintrc rules: { \"index/only-import-export\": \"error\" }"},{"note":"Rule name must include plugin namespace prefix 'index/'.","wrong":"// no common wrong pattern","symbol":"forbid rule","correct":"// in .eslintrc rules: { \"index/forbid\": \"error\" }"}],"quickstart":{"code":"npm install -D eslint eslint-plugin-index\n\n// .eslintrc.json\n{\n  \"plugins\": [\"index\"],\n  \"extends\": [\"plugin:index/recommended\"],\n  \"rules\": {\n    \"index/forbid\": \"error\"\n  }\n}","lang":"javascript","description":"Install the plugin, enable recommended rules, and optionally enable the forbid rule."},"warnings":[{"fix":"Focus only on index.js files.","message":"Plugin is designed to lint index.js files; does not work on other file names.","severity":"gotcha","affected_versions":"all"},{"fix":"Configure ESLint to lint .ts/.jsx and ensure plugin settings apply.","message":"Rules only apply to .js files; does not handle .ts or .jsx by default.","severity":"gotcha","affected_versions":"all"},{"fix":"Use at your own discretion; consider disabling if you need index files.","message":"The 'forbid' rule forbids any file named index; may conflict with legitimate index files.","severity":"gotcha","affected_versions":">=1.1.0"},{"fix":"Ensure index files contain only imports/exports or disable rule.","message":"The 'only-import-export' rule allows only import and export statements; other statements cause errors.","severity":"gotcha","affected_versions":">=1.1.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 -D eslint-plugin-index`.","cause":"Plugin not installed or not in node_modules.","error":"ESLint couldn't find the plugin \"eslint-plugin-index\"."},{"fix":"Use string severity: \"index/only-import-export\": \"error\"","cause":"Incorrect rule configuration syntax in ESLint config.","error":"Configuration for rule \"index/only-import-export\" is invalid: Value \"error\" must be an object or string."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}