File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1- import { IStyleAPI , IStyleItem } from 'import-sort-style' ;
1+ import { IMatcherFunction , IStyleAPI , IStyleItem } from 'import-sort-style' ;
22
33export default function ( styleApi : IStyleAPI ) : IStyleItem [ ] {
44 const {
@@ -15,6 +15,16 @@ export default function (styleApi: IStyleAPI): IStyleItem[] {
1515 unicode,
1616 } = styleApi ;
1717
18+ /**
19+ * Checks whether the import is a built-in Node module, but ignores the
20+ * deprecated 'constants' modules
21+ */
22+ const isNodeModuleAndNotConstants : IMatcherFunction = ( imported ) => {
23+ return (
24+ ! imported . moduleName . startsWith ( 'constants' ) && isNodeModule ( imported )
25+ ) ;
26+ } ;
27+
1828 return [
1929 // import 'foo';
2030 {
@@ -26,7 +36,7 @@ export default function (styleApi: IStyleAPI): IStyleItem[] {
2636
2737 // import path from 'path';
2838 {
29- match : isNodeModule ,
39+ match : isNodeModuleAndNotConstants ,
3040 sort : moduleName ( unicode ) ,
3141 sortNamedMembers : alias ( unicode ) ,
3242 } ,
You can’t perform that action at this time.
0 commit comments