Registry / testing / eslint-plugin-index

eslint-plugin-index

JSON →
library1.1.7jsnpmunverified

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.

npm install eslint-plugin-index
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-INDE
E
eslint-plugin-index
testingjavascriptv1.1.7
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
// in .eslintrc: { "plugins": ["index"] }
{ "plugins": ["eslint-plugin-index"] } // also works but unnecessary prefix
ESLint automatically strips 'eslint-plugin-' prefix when loading plugins from node_modules.
recommended config
// in .eslintrc: { "extends": ["plugin:index/recommended"] }
{ "extends": ["index/recommended"] } // missing plugin: prefix
Extending plugin configs requires 'plugin:' prefix.
only-import-export rule
// in .eslintrc rules: { "index/only-import-export": "error" }
// no common wrong pattern
Rule name must include plugin namespace prefix 'index/'.
forbid rule
// in .eslintrc rules: { "index/forbid": "error" }
// no common wrong pattern
Rule name must include plugin namespace prefix 'index/'.

Install the plugin, enable recommended rules, and optionally enable the forbid rule.

npm install -D eslint eslint-plugin-index // .eslintrc.json { "plugins": ["index"], "extends": ["plugin:index/recommended"], "rules": { "index/forbid": "error" } }
Debug
Known issues
gotchaPlugin is designed to lint index.js files; does not work on other file names.
fix
Focus only on index.js files.
affects: all
gotchaRules only apply to .js files; does not handle .ts or .jsx by default.
fix
Configure ESLint to lint .ts/.jsx and ensure plugin settings apply.
affects: all
gotchaThe 'forbid' rule forbids any file named index; may conflict with legitimate index files.
fix
Use at your own discretion; consider disabling if you need index files.
affects: >=1.1.0
gotchaThe 'only-import-export' rule allows only import and export statements; other statements cause errors.
fix
Ensure index files contain only imports/exports or disable rule.
affects: >=1.1.0
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-index".
Plugin not installed or not in node_modules.
fix
Run `npm install -D eslint-plugin-index`.
Configuration for rule "index/only-import-export" is invalid: Value "error" must be an object or string.
Incorrect rule configuration syntax in ESLint config.
fix
Use string severity: "index/only-import-export": "error"
Upgrade
Version history
1.1.7latest on npm
Audit
Dependencies
eslintrequiredPeer dependency required for plugin to work
Agent activity
6 hits · last 30 days
node
6
Resources
eslint-plugin-index — npm install eslint-plugin-index · libregistry