import/order: don't force new line on specific pathGroup
#1746 aperta il 4 mag 2020
Metriche repository
- Star
- (4946 star)
- Metriche merge PR
- (Merge medio 138g 22h) (3 PR mergiate in 30 g)
Descrizione
I would like to be able to have a specific pathGroup that doesn't force a newline.
My objective would be to have the imports ordered in the following manner (with react before all, but together with the external imports):
import React from "react";
import PropTypes from "prop-types";
import _ from "lodash";
import {Form, Input, Checkbox} from "antd";
At the moment I have this config:
"import/order": [
"warn",
{
"groups": [
"builtin",
"external",
"internal",
["parent", "sibling", "index"]
],
"pathGroups": [
{
"pattern": "{antd,@ant-design/icons}",
"group": "external",
"position": "after"
}
],
"pathGroupsExcludedImportTypes": ["builtin"],
"alphabetize": {"order": "asc"},
"newlines-between": "always"
}
]
Which forces me to alphabetize all the imports, to something like this:
import _ from "lodash";
import PropTypes from "prop-types";
import React from "react";
import {Form, Input, Checkbox} from "antd";
The only alternative I find is to add a specific pathGroup for react, with:
{
"pattern": "react",
"group": "external",
"position": "before"
}
But this forces me to have a line between the react import and all other external imports.
Is there a way to have a specific pathGroup without newlines at the end?
As an alternative, I would be ok with not alphabetizing the imports on the external group, but I don't think this is possible either.