Closed danny-andrews closed 8 years ago
For sure! Your other suggestion can be a separate rule. Also would you like to give it a shot?
To be clear, we are referring to ES6 imports here? If so, esnext provides the following ways of importing:
// Default exports and named exports
import theDefault, { named1, named2 } from 'src/mylib';
import theDefault from 'src/mylib';
import { named1, named2 } from 'src/mylib';
// Renaming: import named1 as myNamed1
import { named1 as myNamed1, named2 } from 'src/mylib';
// Importing the module as an object
// (with one property per named export)
import * as mylib from 'src/mylib';
// Only load the module, don’t import anything
import 'src/mylib';
This could be for es6 imports or commonjs requires?
Can someone be kind enough to explain what alphabetise imports are? Google failed to give me an answer :/
It means sorting your imports in alphabetical order. e.g. This rule would complain about this:
import a from 'a';
import z from 'z';
import c from 'c';
It should be:
import a from 'a';
import c from 'c';
import z from 'z';
I will take a look a implementing this.
It might be nice to have a rule that requires imports to be alphabetized. Even more useful would be a rule that forces you to separate local imports from external imports with a newline.