Skip to content

Commit

Permalink
ci: support import/no-cycle (#2890)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Oct 13, 2022
1 parent 65d5756 commit b7d703d
Show file tree
Hide file tree
Showing 51 changed files with 105 additions and 21 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = {
},
},
rules: {
'import/no-cycle': 'error',
'file-progress/activate': 1,
quotes: 'off',
'@typescript-eslint/quotes': ['error', 'backtick'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';
import {combineLatest, Observable} from 'rxjs';
import {distinctUntilChanged, filter, map, startWith, takeUntil} from 'rxjs/operators';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiLineChartComponent} from './line-chart.component';

@Directive({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';
import {Observable, Subject} from 'rxjs';
import {distinctUntilChanged} from 'rxjs/operators';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiLineChartHintDirective} from './line-chart-hint.directive';

@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';
import {combineLatest, Observable} from 'rxjs';
import {filter, map, takeUntil} from 'rxjs/operators';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiLineDaysChartComponent} from './line-days-chart.component';

// TODO: Consider extending TuiLineChartHintDirective
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import {TuiDriver, TuiPoint} from '@taiga-ui/core';
import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';
import {Observable} from 'rxjs';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiLineDaysChartHintDirective} from './line-days-chart-hint.directive';

const DUMMY: TuiPoint = [NaN, NaN];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {TuiDestroyService, tuiTypedFromEvent} from '@taiga-ui/cdk';
import {merge} from 'rxjs';
import {takeUntil} from 'rxjs/operators';

import {TuiEditableImage} from './image-editor.extension';
import type {TuiEditableImage} from './image-editor.extension';

export const TUI_EDITOR_MIN_IMAGE_WIDTH = new InjectionToken<number>(
`[TUI_EDITOR_MIN_IMAGE_WIDTH]: Min size of resizable image inside editor`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {fakeSmoothScroll} from '../../ios.hacks';
import {TuiSheet, TuiSheetRequiredProps} from '../../sheet';
import {TUI_SHEET_SCROLL} from '../../sheet-tokens';
import {TUI_SHEET_ID} from '../sheet-heading/sheet-heading.component';
// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TUI_SHEET_PROVIDERS} from './sheet.providers';

@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {map, mapTo, share} from 'rxjs/operators';

import {iosScrollFactory} from '../../ios.hacks';
import {TUI_SHEET, TUI_SHEET_DRAGGED, TUI_SHEET_SCROLL} from '../../sheet-tokens';
// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiSheetComponent} from './sheet.component';

export const TUI_SHEET_PROVIDERS: Provider[] = [
Expand Down
2 changes: 1 addition & 1 deletion projects/addon-mobile/components/sheet/sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {TuiContextWithImplicit} from '@taiga-ui/cdk';
import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';
import {Observable, Observer} from 'rxjs';

import {TuiSheetOptions} from './sheet-options';
import type {TuiSheetOptions} from './sheet-options';

export interface TuiSheet<O, I = undefined>
extends TuiSheetOptions<I, O>,
Expand Down
2 changes: 2 additions & 0 deletions projects/addon-mobile/directives/sidebar/sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
} from '@taiga-ui/core';
import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiSidebarDirective} from './sidebar.directive';

@Component({
Expand Down
2 changes: 2 additions & 0 deletions projects/addon-mobile/directives/sidebar/sidebar.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {TuiDropdownPortalService} from '@taiga-ui/cdk';
import {TuiHorizontalDirection} from '@taiga-ui/core';
import {PolymorpheusComponent, PolymorpheusTemplate} from '@tinkoff/ng-polymorpheus';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiSidebarComponent} from './sidebar.component';

@Directive({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {TuiComparator} from '@taiga-ui/addon-table/types';
import {EMPTY_QUERY, tuiDefaultProp} from '@taiga-ui/cdk';
import {filter, map} from 'rxjs/operators';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiSortableDirective} from './sortable.directive';
import {TuiTableDirective} from './table.directive';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {Directive, DoCheck, forwardRef, Inject, OnInit} from '@angular/core';
import {TuiComparator} from '@taiga-ui/addon-table/types';

import {TuiThComponent} from '../th/th.component';
// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiSortByDirective} from './sort-by.directive';
import {TuiTableDirective} from './table.directive';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {TUI_MODE, TuiBrightness, TuiSizeL, TuiSizeS} from '@taiga-ui/core';
import {Observable} from 'rxjs';

import {TUI_STUCK} from '../providers/stuck.provider';
// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TUI_TABLE_PROVIDERS} from '../providers/table.providers';

@Directive({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
} from '@taiga-ui/core';
import {TUI_INPUT_COUNT_OPTIONS, TuiInputCountOptions} from '@taiga-ui/kit';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiTableDirective} from '../directives/table.directive';
import {TUI_STUCK_PROVIDER} from './stuck.provider';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {TuiRowDirective} from '../directives/row.directive';
import {TuiTableDirective} from '../directives/table.directive';
import {TuiTableSortPipe} from '../pipes/table-sort.pipe';
import {TUI_TABLE_PROVIDER} from '../providers/table.provider';
// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiTrComponent} from '../tr/tr.component';

@Component({
Expand Down
2 changes: 2 additions & 0 deletions projects/addon-table/components/table/tr/tr.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {map, startWith} from 'rxjs/operators';
import {TuiCellDirective} from '../directives/cell.directive';
import {TuiTableDirective} from '../directives/table.directive';
import {TUI_TABLE_PROVIDER} from '../providers/table.provider';
// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiTbodyComponent} from '../tbody/tbody.component';

@Component({
Expand Down
2 changes: 2 additions & 0 deletions projects/cdk/abstract/portal-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
} from '@angular/core';
import {PolymorpheusComponent} from '@tinkoff/ng-polymorpheus';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {AbstractTuiPortalService} from './portal-service';

/**
Expand Down
2 changes: 2 additions & 0 deletions projects/cdk/abstract/portal-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {ComponentRef, EmbeddedViewRef, Injectable, TemplateRef} from '@angular/c
import {TuiNoHostException} from '@taiga-ui/cdk/exceptions';
import {PolymorpheusComponent} from '@tinkoff/ng-polymorpheus';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {AbstractTuiPortalHostComponent} from './portal-host';

/**
Expand Down
3 changes: 3 additions & 0 deletions projects/cdk/directives/auto-focus/autofocus.options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {TuiFocusableElementAccessor} from '@taiga-ui/cdk/interfaces';
import {TUI_FOCUSABLE_ITEM_ACCESSOR, TUI_IS_IOS} from '@taiga-ui/cdk/tokens';
import {Observable} from 'rxjs';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiDefaultAutofocusHandler} from './handlers/default.handler';
// eslint-disable-next-line import/no-cycle
import {TuiIosAutofocusHandler} from './handlers/ios.handler';

export interface TuiAutofocusHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
TuiNativeFocusableElement,
} from '@taiga-ui/cdk/interfaces';

import {TuiAutofocusHandler} from '../autofocus.options';
import type {TuiAutofocusHandler} from '../autofocus.options';

@Directive()
export abstract class AbstractTuiAutofocusHandler implements TuiAutofocusHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {TUI_FOCUSABLE_ITEM_ACCESSOR} from '@taiga-ui/cdk/tokens';
import {Observable, race, timer} from 'rxjs';
import {map, skipWhile, take, throttleTime} from 'rxjs/operators';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {AbstractTuiAutofocusHandler} from './abstract.handler';

const TIMEOUT = 1000;
Expand Down
2 changes: 2 additions & 0 deletions projects/cdk/directives/auto-focus/handlers/ios.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {TuiFocusableElementAccessor} from '@taiga-ui/cdk/interfaces';
import {TUI_FOCUSABLE_ITEM_ACCESSOR} from '@taiga-ui/cdk/tokens';
import {tuiPx} from '@taiga-ui/cdk/utils';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {AbstractTuiAutofocusHandler} from './abstract.handler';

@Directive()
Expand Down
2 changes: 1 addition & 1 deletion projects/cdk/directives/let/let-context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {TuiContextWithImplicit} from '@taiga-ui/cdk/interfaces';

import {TuiLetDirective} from './let.directive';
import type {TuiLetDirective} from './let.directive';

/**
* @internal
Expand Down
2 changes: 2 additions & 0 deletions projects/core/components/data-list/data-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';
import {Observable} from 'rxjs';
import {map} from 'rxjs/operators';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiOptionComponent} from './option/option.component';

// TODO: Consider aria-activedescendant for proper accessibility implementation
Expand Down
2 changes: 2 additions & 0 deletions projects/core/components/data-list/option/option.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {TuiOptionRole, TuiSizeL, TuiSizeXS} from '@taiga-ui/core/types';
import {shouldCall} from '@tinkoff/ng-event-plugins';
import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiDataListComponent} from '../data-list.component';

function shouldFocus({currentTarget}: TuiEventWith<MouseEvent, HTMLElement>): boolean {
Expand Down
2 changes: 2 additions & 0 deletions projects/core/directives/dropdown/dropdown.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {TuiPoint} from '@taiga-ui/core/types';
import {Observable} from 'rxjs';
import {takeUntil} from 'rxjs/operators';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiDropdownDirective} from './dropdown.directive';
import {TuiDropdownHoverDirective} from './dropdown-hover.directive';
import {
Expand Down
2 changes: 2 additions & 0 deletions projects/core/directives/dropdown/dropdown.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {TuiPortalItem} from '@taiga-ui/core/interfaces';
import {tuiCheckFixedPosition} from '@taiga-ui/core/utils';
import {PolymorpheusComponent, PolymorpheusContent} from '@tinkoff/ng-polymorpheus';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TUI_DROPDOWN_COMPONENT} from './dropdown.providers';

@Directive({
Expand Down
2 changes: 2 additions & 0 deletions projects/core/directives/dropdown/dropdown.providers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {InjectionToken, Type} from '@angular/core';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiDropdownComponent} from './dropdown.component';

export const TUI_DROPDOWN_COMPONENT = new InjectionToken<Type<any>>(
Expand Down
6 changes: 3 additions & 3 deletions projects/core/mask/text-mask-options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {TuiTextMaskList} from './text-mask-list';
import {TuiTextMaskListHandler} from './text-mask-list-handler';
import {TuiTextMaskPipeHandler} from './text-mask-pipe-handler';
import type {TuiTextMaskList} from './text-mask-list';
import type {TuiTextMaskListHandler} from './text-mask-list-handler';
import type {TuiTextMaskPipeHandler} from './text-mask-pipe-handler';

/**
* {@link https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md}
Expand Down
6 changes: 3 additions & 3 deletions projects/core/mask/text-mask-pipe-handler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {TuiTextMaskConfig} from './text-mask-config';
import {TuiTextMaskOptions} from './text-mask-options';
import {TuiTextMaskPipeResult} from './text-mask-pipe-result';
import type {TuiTextMaskConfig} from './text-mask-config';
import type {TuiTextMaskOptions} from './text-mask-options';
import type {TuiTextMaskPipeResult} from './text-mask-pipe-result';

/**
* {@link https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#pipe}
Expand Down
4 changes: 2 additions & 2 deletions projects/core/tokens/ordered-short-week-days.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* TODO: v4.0 delete the whole file
*/

import {inject, InjectionToken} from '@angular/core';
import {Observable} from 'rxjs';
import {map} from 'rxjs/operators';

import {TUI_FIRST_DAY_OF_WEEK, TUI_SHORT_WEEK_DAYS} from './index';
import {TUI_FIRST_DAY_OF_WEEK} from './first-day-of-week';
import {TUI_SHORT_WEEK_DAYS} from './i18n';

/**
* @deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {TuiBrightness} from '@taiga-ui/core';
import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {
TUI_DOC_CUSTOMIZATION_PROVIDERS,
TUI_DOC_CUSTOMIZATION_VARS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {TuiDestroyService} from '@taiga-ui/cdk';
import {TuiModeDirective} from '@taiga-ui/core';

import {CSS_VARS} from '../../tokens/css-vars';
// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiCustomizationComponent} from './customization.component';

export const TUI_DOC_CUSTOMIZATION_VARS = new InjectionToken<Record<string, string>>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {TuiDialog} from '@taiga-ui/cdk';
import {TuiPdfViewerOptions} from '@taiga-ui/kit';
import {POLYMORPHEUS_CONTEXT} from '@tinkoff/ng-polymorpheus';

import {Buttons} from './index';
import type {Buttons} from './index';

@Component({
template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {TuiPdfViewerOptions, TuiPdfViewerService} from '@taiga-ui/kit';
import {PolymorpheusComponent} from '@tinkoff/ng-polymorpheus';
import {switchMap} from 'rxjs/operators';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {ActionsContent} from './actions-content.component';
import {PdfContent} from './pdf-content.component';

Expand Down
2 changes: 2 additions & 0 deletions projects/demo/src/modules/components/tree/examples/7/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
TuiTreeService,
} from '@taiga-ui/kit';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TreeLoader} from './service';

export interface Item {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {TuiTreeLoader} from '@taiga-ui/kit';
import {Observable, timer} from 'rxjs';
import {mapTo} from 'rxjs/operators';

import {Item} from './index';
import type {Item} from './index';

@Injectable()
export class TreeLoader implements TuiTreeLoader<Item> {
Expand Down
2 changes: 2 additions & 0 deletions projects/kit/components/arrow/arrow-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {TuiContextWithImplicit} from '@taiga-ui/cdk';
import {TuiSizeL, TuiSizeM, TuiSizeS} from '@taiga-ui/core';
import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TUI_ARROW} from './arrow.component';

export interface TuiArrowOptions {
Expand Down
2 changes: 2 additions & 0 deletions projects/kit/components/arrow/arrow.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
} from '@taiga-ui/core';
import {PolymorpheusComponent, PolymorpheusContent} from '@tinkoff/ng-polymorpheus';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TUI_ARROW_OPTIONS, TuiArrowOptions} from './arrow-options';

@Component({
Expand Down
5 changes: 2 additions & 3 deletions projects/kit/components/push/push-alert.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import {
tuiHeightCollapse,
tuiSlideInRight,
} from '@taiga-ui/core';
import {POLYMORPHEUS_CONTEXT} from '@tinkoff/ng-polymorpheus';
import {POLYMORPHEUS_CONTEXT, PolymorpheusTemplate} from '@tinkoff/ng-polymorpheus';

import {TuiPushOptions} from './push.options';
import {TuiPushAlertDirective} from './push-alert.directive';

@Component({
selector: `tui-push-alert`,
Expand All @@ -33,6 +32,6 @@ export class TuiPushAlertComponent {
) {}

get isDirective(): boolean {
return this.context.content instanceof TuiPushAlertDirective;
return this.context.content instanceof PolymorpheusTemplate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {
tuiPercentageToKeyStepValue,
} from '@taiga-ui/kit/utils';

// TODO: find the best way for prevent cycle
// eslint-disable-next-line import/no-cycle
import {TuiSliderComponent} from '../slider.component';

@Directive({
Expand Down
Loading

0 comments on commit b7d703d

Please sign in to comment.