eslint-plugin-import
eslint-plugin-import copied to clipboard
[import/order] control over fix newlines
With import/order, when using 'newlines-between': 'always-and-inside-groups' there seems to be no way to control how the fix happens.
Example problem:
import AddressTextField from './AddressTextField'
import CityField from './CityField'
import ContentLoader from 'components/ContentLoader/ContentLoader'
import SeparatedList from 'components/SeparatedList/SeparatedList'
Fix result:
import ContentLoader from 'components/ContentLoader/ContentLoader'
import SeparatedList from 'components/SeparatedList/SeparatedList'
import AddressTextField from './AddressTextField'
import CityField from './CityField'
Desired result:
import ContentLoader from 'components/ContentLoader/ContentLoader'
import SeparatedList from 'components/SeparatedList/SeparatedList'
import AddressTextField from './AddressTextField'
import CityField from './CityField'
Any chance to add support for some control over this?
Possible ways to control:
- inference from the surrounding imports in the file, fallbacking to current behavior
- additional property, accepting arbitrary grouping/spacing logic, likely related to https://github.com/import-js/eslint-plugin-import/issues/2292
This just seems like a fix that can be made in the autofixer.
Just reporting another example of undesired autofixer behavior: before and after. You can see it even adds some extra lines at the bottom which are removed on a subsequent autofixer run. Here's the desired result. It's slightly different because one more thing was imported from electron. teleterm is an internal package, though idk if it's recognized as such.
FWIW, once manually fixed the autofixer behaves correctly. It's just the initial run that's causing some problems.