The import ordering was handled by using `sort-imports` rule for alphabetical ordering and `import` plugin for separating the imports into groups by a type of the import. The alphabetical sorting was not working very well when using the combination. This removes the use of `sort-imports` rule and adds alphabetical sorting directly under the `import` plugin which means all the sorting is handled in one place. The rules for sorting of the imports are now following: - imports are separated into groups by a type of the import - imports within the groups are ordered alphabetically in ascending order - new lines separating the groups of imports are enforced - the import of React library is always at the very top of the imports
28 lines
578 B
YAML
28 lines
578 B
YAML
extends: "@redhat-cloud-services/eslint-config-redhat-cloud-services"
|
|
globals:
|
|
insights: 'readonly'
|
|
shallow: readonly
|
|
render: 'readonly'
|
|
mount: 'readonly'
|
|
plugins:
|
|
- import
|
|
rules:
|
|
import/order:
|
|
- error
|
|
- groups:
|
|
- builtin
|
|
- external
|
|
- internal
|
|
- sibling
|
|
- parent
|
|
- index
|
|
alphabetize:
|
|
order: asc
|
|
caseInsensitive: true
|
|
newlines-between: always
|
|
pathGroups: # ensures the import of React is always on top
|
|
- pattern: react
|
|
group: builtin
|
|
position: before
|
|
pathGroupsExcludedImportTypes:
|
|
- react
|