-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Labels
Description
In #75 @igmoweb proposed the addition of the sort-imports ESLint rule, to control the ordering of modules we import into our code.
In a Slack thread @rmccue further proposed that we conform to a general ordering of absolute, then relative, then side effects (e.g. importing a CSS file to ensure it gets included in the build, but not using the return of that import), with a blank line between each, and each section alphabetized.
As an example:
import React from 'react';
import { connect } from 'react-redux';
import Foo from './Foo';
import './Bar.css';
This made sense to me, and would help a lot on several projects we've had lately.
The sort-imports rule looks like it can handle putting the import-for-side-effects after other imports, but doesn't at first glance support including the relative imports after absolute. We should investigate further.