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

Sort by default export name

Open cdreve opened this issue 6 years ago • 2 comments

Having:

import PropTypes from 'prop-types';
import Button from 'custom-button';
import SearchBox from 'custom-search-box';

I would like to have them sorted:

import Button from 'custom-button';
import PropTypes from 'prop-types';
import SearchBox from 'custom-search-box';

Currently the plugin sorts like this:

import Button from 'custom-button';
import SearchBox from 'custom-search-box';
import PropTypes from 'prop-types';

cdreve avatar Nov 14 '18 12:11 cdreve

I think sort-imports has that behaviour.

https://eslint.org/docs/rules/sort-imports

I am evaluating this repo specifically because it sorts by path rather than the name of the import.

defnorep avatar Nov 14 '18 21:11 defnorep

@daekano Do you know of a way for sort-imports to sort within groups? This is what I am trying to achieve. I am using eslint-plugin-import to group the imports, but it does not have the ability to sort them, this package does :) From eslint-plugin-import I ended up here.

I do not want to change the current behaviour, just add the ability to choose by what you want to sort.

cdreve avatar Nov 15 '18 08:11 cdreve