ESlint rules to ensure the proper usage of index.js files
npm install eslint-plugin-index

ESlint rules to ensure the proper usage of index.js files
| rule | description | recommended |
| ------------------------------------------------ | ------------------------------------------------------ | ----------- |
| [index/only-import-export][only-import-export] | Allow only import and export statements in index files | error |
| [index/forbid][forbid] | Forbid files named index | off |
You'll first need to install ESLint:
``sh`
npm i -D eslint
Next, install eslint-plugin-index:
`sh`
npm i -D eslint-plugin-index
Add index to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
`json`
{
"plugins": ["index"]
}
Then configure the rules you want to use under the rules section.
`json`
{
"plugins": ["index"],
"rules": {
"index/only-import-export": "error"
"index/forbid": "off"
}
}
Or start with the recommended rule set:
`json``
{
"plugins": ["index"],
"extends": ["plugin:index/recommended"]
}
[only-import-export]: rules/only-import-export/only-import-export.md
[forbid]: rules/forbid/forbid.md