eslint-plugin-import
eslint-plugin-import copied to clipboard
Use same alphabetize props as ESLint sort-imports
ESLint's native sort-imports does the sorting I want, but doesn't care about the grouping of imports. On the other hand, import/order gives me the ordering I want, but not the powerful alphabetization sort from sort-imports.
For sort-imports, this is the config I use:
{
'sort-imports': [
'warn',
{
ignoreCase: true,
memberSyntaxSortOrder: [
'single',
'all',
'multiple',
'none',
],
},
],
}
I'd like to do something similar with import/order:
{
alphabetize: {
caseInsensitive: true,
memberSyntaxSortOrder: [
'single',
'all',
'multiple',
'none',
],
order: 'asc',
},
}
I would like this functionality because I'm grouping them differently than the default:
{
groups: [
[
'builtin',
'external',
],
[
'index',
'parent',
'sibling',
],
],
}
Here's an example I'd expect to see:
import PropTypes from 'prop-types'
import React from 'react'
import useMediaQuery from './useMediaQuery'
import useMediaQueryState from './useMediaQueryState'
import { * as actions } from './actions'
import { breakpointsList } from './breakpoints'
import './styles.css'