Home > Mobile >  I want to learn, why: Footer` import should occur before import of `components/Menu` import/order
I want to learn, why: Footer` import should occur before import of `components/Menu` import/order

Time:08-10

Why does occur that?

./pages/index.tsx 3:1 Error: components/Footer/Footer import should occur before import of components/Menu import/order

CodePudding user response:

Because it should be ordered alphabetically.

Check the rule here:

https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md

// 5. "sibling" modules from the same or a sibling's directory
import bar from './bar';
import baz from './bar/baz';

This is a sibling module, both are from components, so they should be ordered alphabetically.

  • Related