Skip to content

Commit

Permalink
fix: apply ordered-import rule on multiline import statements (#1344)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eisie96 authored Dec 22, 2022
1 parent cf89956 commit 5887c41
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 20 deletions.
9 changes: 8 additions & 1 deletion eslint-rules/src/rules/ordered-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ const orderedImportsRule: TSESLint.RuleModule<keyof typeof messages> = {
.map(imp => context.getSourceCode().getText(imp))
.sort();

return nodeText.replace(/\{.*\}/, `{ ${sortedNamedImports.join(', ')} }`);
if (/\{.*\}/.test(nodeText)) {
return nodeText.replace(/\{.*\}/, `{ ${sortedNamedImports.join(', ')} }`);
}

return nodeText.replace(
/\{(.|\n)*\}/,
`{${lineEnding} ${sortedNamedImports.join(`,${lineEnding} `)},${lineEnding}}`
);
}

const importDeclarations: TSESTree.ImportDeclaration[] = [];
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/facades/account.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import { MessagesPayloadType } from 'ish-core/store/core/messages';
import {
createCustomerAddress,
deleteCustomerAddress,
updateCustomerAddress,
getAddressesError,
getAddressesLoading,
getAllAddresses,
loadAddresses,
updateCustomerAddress,
} from 'ish-core/store/customer/addresses';
import { getUserRoles } from 'ish-core/store/customer/authorization';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { distinctCompareWith, mapToPayload, whenTruthy } from 'ish-core/utils/op
import { StatePropertiesService } from 'ish-core/utils/state-transfer/state-properties.service';

import {
applyConfiguration,
ConfigurationType,
applyConfiguration,
loadSingleServerTranslation,
loadSingleServerTranslationSuccess,
} from './configuration.actions';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import {
deleteCustomerAddress,
deleteCustomerAddressFail,
deleteCustomerAddressSuccess,
loadAddresses,
loadAddressesSuccess,
updateCustomerAddress,
updateCustomerAddressFail,
updateCustomerAddressSuccess,
loadAddresses,
loadAddressesSuccess,
} from './addresses.actions';
import { AddressesEffects } from './addresses.effects';

Expand Down
6 changes: 3 additions & 3 deletions src/app/core/store/customer/addresses/addresses.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import {
createCustomerAddress,
createCustomerAddressFail,
createCustomerAddressSuccess,
updateCustomerAddress,
updateCustomerAddressFail,
updateCustomerAddressSuccess,
deleteCustomerAddress,
deleteCustomerAddressFail,
deleteCustomerAddressSuccess,
loadAddresses,
loadAddressesFail,
loadAddressesSuccess,
updateCustomerAddress,
updateCustomerAddressFail,
updateCustomerAddressSuccess,
} from './addresses.actions';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ import {
loadBasketSuccess,
updateBasketItem,
updateBasketItemFail,
updateBasketItemSuccess,
updateBasketItems,
updateBasketItemsFail,
updateBasketItemsSuccess,
updateBasketItemSuccess,
validateBasket,
} from './basket.actions';

Expand Down
2 changes: 1 addition & 1 deletion src/app/core/store/customer/basket/basket-items.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ import {
loadBasket,
updateBasketItem,
updateBasketItemFail,
updateBasketItemSuccess,
updateBasketItems,
updateBasketItemsFail,
updateBasketItemsSuccess,
updateBasketItemSuccess,
validateBasket,
} from './basket.actions';
import { getCurrentBasket, getCurrentBasketId } from './basket.selectors';
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/store/customer/basket/basket.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ import {
updateBasketFail,
updateBasketItem,
updateBasketItemFail,
updateBasketItemSuccess,
updateBasketItems,
updateBasketItemsFail,
updateBasketItemsSuccess,
updateBasketItemSuccess,
updateBasketPayment,
updateBasketPaymentFail,
updateBasketPaymentSuccess,
Expand Down
8 changes: 4 additions & 4 deletions src/app/core/store/shopping/products/products.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ import {
loadProductLinksSuccess,
loadProductParts,
loadProductPartsSuccess,
loadProductsForCategory,
loadProductsForCategoryFail,
loadProductsForMaster,
loadProductsForMasterFail,
loadProductSuccess,
loadProductVariationsFail,
loadProductVariationsIfNotLoaded,
loadProductVariationsSuccess,
loadProductsForCategory,
loadProductsForCategoryFail,
loadProductsForMaster,
loadProductsForMasterFail,
} from './products.actions';
import {
getBreadcrumbForProductPage,
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/utils/operators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
OperatorFunction,
combineLatest,
concat,
connect,
of,
throwError,
connect,
} from 'rxjs';
import { buffer, catchError, distinctUntilChanged, filter, map, mergeAll, take, withLatestFrom } from 'rxjs/operators';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import {
AfterViewInit,
ChangeDetectionStrategy,
Component,
createNgModule,
Injector,
Input,
OnDestroy,
OnInit,
ViewChild,
ViewContainerRef,
createNgModule,
} from '@angular/core';
import { AbstractControl, FormArray, FormGroup, Validators } from '@angular/forms';
import { Subject } from 'rxjs';
Expand Down
6 changes: 3 additions & 3 deletions src/app/extensions/quoting/store/quoting/quoting.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ import {
createQuoteRequestFromQuoteRequest,
createQuoteRequestFromQuoteRequestSuccess,
createQuoteRequestFromQuoteSuccess,
deleteQuoteFromBasket,
deleteQuoteFromBasketFail,
deleteQuoteFromBasketSuccess,
deleteQuotingEntity,
deleteQuotingEntityFail,
deleteQuotingEntitySuccess,
Expand All @@ -46,9 +49,6 @@ import {
submitQuoteRequestSuccess,
updateQuoteRequest,
updateQuoteRequestSuccess,
deleteQuoteFromBasket,
deleteQuoteFromBasketSuccess,
deleteQuoteFromBasketFail,
} from './quoting.actions';
import { getQuotingEntity } from './quoting.selectors';

Expand Down

0 comments on commit 5887c41

Please sign in to comment.