The specific rule import/order
from eslint-plugin-import
does not seem to recognise the unnamed imports such as import moment/locale/fr
: to clarify, I need to import moment like this (as the documentation seems to indicate), so I am trying to have it ordered among the other imports using the import/order rule:
'import/order': [
'warn',
{
alphabetize: {
caseInsensitive: false,
order: 'asc',
},
groups: ['builtin', 'unknown', 'external', 'internal', 'parent', 'sibling', 'index', 'type'],
'newlines-between': 'always',
pathGroups: [
{
group: 'builtin',
pattern: 'react',
position: 'before',
},
{
group: 'unknown',
pattern: 'moment/locale/fr',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['react'],
},
],
Having that, I would expect the moment/locale/fr
import to be placed right after the builtin imports. However, I don't get any error wherever I put this import.
Worse, when I "mistakenly" put this package in a middle of a group and skip lines, I get warnings about the lines skipped, but no autofix, so it really seems import/order does not recognise unnamed imports.
Does anyone know how I could have it to work?
For the record, I am using eslint-plugin-import
v2.29.0.
Unassigned imports are ignored, as the order they are imported in may be important.
Source: https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md