eslint-plugin-import
eslint-plugin-import copied to clipboard
[New] Add no-indexes Rule
As per the documentation:
This rule prevents files from being named index.
For example, with the no-indexes rule enabled, files named index.js, index.jsx, index.ts, and index.tsx would all be considered invalid.
Ignore
The rule accepts an optional ignore setting, which can be used to ignore any file whose path matches one of the given regular expression patterns.
For example, the following would allow index files in the allowed directory:
{
rules: {
'import/no-indexes': [
'error',
{ ignore: ['\/allowed\/'] }
]
}
}
Coverage increased (+7.7%) to 97.574% when pulling 0bb5cb9239f3b65dcc18384ffe7f6aabc4532f99 on nickcherry:nickcherry/no-indexes into 00a9ad9d64bea44e6a5084f7e5d7bb49a02008bf on benmosher:master.
Per discussion; this would be amazing as a "no manifest exports" rule, unrelated to the filename.