import-js / import-js/eslint-plugin-import

pathGroups and alphabetize collision problems

Open
#1,669 3 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Hello! Thanks for great and really helpful plugin! You did a great job! :)

For now I am trying to extend default config with **pathGroups**. I need to mark
```
import { xxx } from 'shared/xxx/xxx....'
```
as internal import that should be placed at the begin of internal imports.

My config is
```
"import/order": [ "error", {
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"groups": [ "builtin", "external", "internal", "parent", "index", "sibling", "unknown" ],
"pathGroups": [
{
"pattern": "shared/**",
"group": "internal",
"position": "before"
}
]
} ],
```
And I have error here
```
import { FormatMessage, useFormatMessage } from '@comparaonline/react-intl-hooks';
import React, { FC } from 'react';
import InfiniteScroll from 'react-infinite-scroller';
import { connect } from 'react-redux';
import useDeepCompareEffect from 'use-deep-compare-effect'; // <= THIS LINE HAS ERROR

import './scrolled-channels-list.component.scss';
import { SearchConfigState } from 'shared/components/search-panel/store/search.model';
import { ChannelItem, SearchChannelsConfig } from 'shared/services/channel-api/channel-api.service';
import { ChannelComponent } from '../channel/channel.component';
import * as channelsActions from '../store/channels.actions';
import { ChannelsState } from '../store/channels.model';
import * as channelsSelectors from '../store/channels.selectors';
import { MoreChannelsLoadingComponent } from './more-channels-loading/more-channels-loading.component';
```
```
ESLint: `use-deep-compare-effect` import should occur after import of `shared/services/channel-api/channel-api.service`(import/order)
```
I also try to add
```
"pathGroupsExcludedImportTypes": [ "builtin", "external", "internal" ]
```
But nothing changed.
Only helped to remove from config
```
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
```
Is this a bug or I not understand something?

Contributor guide

Open the contributing guide

Research direction

Start with the import/order rule and its pathGroups, pathGroupsExcludedImportTypes, and alphabetize options, then reproduce the reported configuration and import list. Done means determining whether the external import is ordered incorrectly and documenting or correcting the interaction between pathGroups and alphabetize.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.