Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 774 Bytes

only-import-export.md

File metadata and controls

45 lines (34 loc) · 774 Bytes

index/only-import-export

Use this rule to allow only import and export statements in index files.

👎 Fail

The following file structure will fail the check

pages
└── catalog
    ├── content/
    ├── sidebar/
    └── index.tsx

If pages/catalog/index.ts looks like this:

import Content from "./content";
import Sidebar from "./sidebar";

export const Page = () => {
  return (
    <React.Fragment>
      <Sidebar />
      <Content />
    </React.Fragment>
  );
};

👍 Pass

To pass the check, the file structure can be changed as follows

pages
└── catalog
    ├── content/
    ├── sidebar/
    └── page.tsx

index.js files should be either deleted or renamed.