eslint-plugin-import icon indicating copy to clipboard operation
eslint-plugin-import copied to clipboard

[New] Add no-indexes Rule

Open nickcherry opened this issue 5 years ago • 2 comments

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\/'] }
    ]
  }
}

nickcherry avatar Nov 10 '20 15:11 nickcherry

Coverage Status

Coverage increased (+7.7%) to 97.574% when pulling 0bb5cb9239f3b65dcc18384ffe7f6aabc4532f99 on nickcherry:nickcherry/no-indexes into 00a9ad9d64bea44e6a5084f7e5d7bb49a02008bf on benmosher:master.

coveralls avatar Nov 11 '20 03:11 coveralls

Per discussion; this would be amazing as a "no manifest exports" rule, unrelated to the filename.

ljharb avatar Feb 01 '21 20:02 ljharb