Skip to content

Commit

Permalink
ci: require Tui prefix for type alias
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Oct 7, 2023
1 parent 839fe33 commit 4bce993
Show file tree
Hide file tree
Showing 21 changed files with 1,556 additions and 1,333 deletions.
2,765 changes: 1,483 additions & 1,282 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"@taiga-ui/browserslist-config": "0.2.0",
"@taiga-ui/commitlint-config": "0.2.1",
"@taiga-ui/cspell-config": "0.13.0",
"@taiga-ui/eslint-plugin-experience": "0.7.5",
"@taiga-ui/eslint-plugin-experience": "0.8.1",
"@taiga-ui/prettier-config": "0.3.1",
"@taiga-ui/stylelint-config": "0.5.1",
"@testing-library/cypress": "9.0.0",
Expand Down
6 changes: 3 additions & 3 deletions projects/addon-doc/components/code/code.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Inject,
Input,
} from '@angular/core';
import {RawLoaderContent} from '@taiga-ui/addon-doc/interfaces';
import {TuiRawLoaderContent} from '@taiga-ui/addon-doc/interfaces';
import {TUI_DOC_EXAMPLE_MARKDOWN_CODE_PROCESSOR} from '@taiga-ui/addon-doc/tokens';
import {tuiRawLoad} from '@taiga-ui/addon-doc/utils';
import {TuiHandler} from '@taiga-ui/cdk';
Expand All @@ -19,7 +19,7 @@ import {map, switchMap} from 'rxjs/operators';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TuiDocCodeComponent {
private readonly rawLoader$$ = new BehaviorSubject<RawLoaderContent>('');
private readonly rawLoader$$ = new BehaviorSubject<TuiRawLoaderContent>('');

@Input()
filename = '';
Expand All @@ -35,7 +35,7 @@ export class TuiDocCodeComponent {
) {}

@Input()
set code(code: RawLoaderContent) {
set code(code: TuiRawLoaderContent) {
this.rawLoader$$.next(code);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ import {BehaviorSubject, Subject} from 'rxjs';

const SERIALIZED_SUFFIX = '$';

export type DocumentationPropertyType = 'input-output' | 'input' | 'output' | null;
export type TuiDocumentationPropertyType = 'input-output' | 'input' | 'output' | null;

/**
* @deprecated: use {@link TuiDocumentationPropertyType}
* TODO: remove in v4.0
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
export type DocumentationPropertyType = TuiDocumentationPropertyType;

// @bad TODO: refactor output and value sync
@Directive({
Expand All @@ -31,7 +38,7 @@ export class TuiDocDocumentationPropertyConnectorDirective<T>
documentationPropertyName = '';

@Input()
documentationPropertyMode: DocumentationPropertyType = null;
documentationPropertyMode: TuiDocumentationPropertyType = null;

@Input()
documentationPropertyType = '';
Expand Down
11 changes: 9 additions & 2 deletions projects/addon-doc/interfaces/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ export interface TuiDocPageGroup extends TuiDocPageBase {
readonly subPages: readonly TuiDocPage[];
}

export type RawLoaderContent = Promise<{default: string}> | string;
export type TuiRawLoaderContent = Promise<{default: string}> | string;

/**
* @deprecated: use {@link TuiRawLoaderContent}
* TODO: remove in v4.0
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
export type RawLoaderContent = TuiRawLoaderContent;

export const TUI_EXAMPLE_PRIMARY_FILE_NAME = {
TS: `TypeScript`,
Expand All @@ -25,7 +32,7 @@ export const TUI_EXAMPLE_PRIMARY_FILE_NAME = {
} as const;

export type TuiDocExample =
| Record<string, RawLoaderContent>
| Record<string, TuiRawLoaderContent>
| {
[TUI_EXAMPLE_PRIMARY_FILE_NAME.HTML]?: string;
[TUI_EXAMPLE_PRIMARY_FILE_NAME.LESS]?: string;
Expand Down
4 changes: 2 additions & 2 deletions projects/addon-doc/utils/raw-load.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {RawLoaderContent} from '@taiga-ui/addon-doc/interfaces';
import {TuiRawLoaderContent} from '@taiga-ui/addon-doc/interfaces';

export async function tuiRawLoad(content: RawLoaderContent): Promise<string> {
export async function tuiRawLoad(content: TuiRawLoaderContent): Promise<string> {
return content instanceof Promise ? (await content).default : content;
}
1 change: 1 addition & 0 deletions projects/core/tokens/ordered-short-week-days.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {TUI_SHORT_WEEK_DAYS} from './i18n';
/**
* @deprecated
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
export type WEEK_DAYS_NAMES = [string, string, string, string, string, string, string];

const convertToSundayFirstWeekFormat = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {RawLoaderContent, TuiDocExample} from '@taiga-ui/addon-doc';
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc';
import {TuiSafeHtml} from '@taiga-ui/cdk';
import {TuiSizeXXL, TuiSizeXXS} from '@taiga-ui/core';

Expand All @@ -10,15 +10,15 @@ import {TuiSizeXXL, TuiSizeXXS} from '@taiga-ui/core';
changeDetection,
})
export class ExampleTuiAvatarComponent {
readonly exampleOptions: RawLoaderContent = import(
readonly exampleOptions: TuiRawLoaderContent = import(
'./examples/import/define-options.md?raw'
);

readonly exampleModule: RawLoaderContent = import(
readonly exampleModule: TuiRawLoaderContent = import(
'./examples/import/import-module.md?raw'
);

readonly exampleHtml: RawLoaderContent = import(
readonly exampleHtml: TuiRawLoaderContent = import(
'./examples/import/insert-template.md?raw'
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Component, Inject} from '@angular/core';
import {FormControl} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {RawLoaderContent, TuiDocExample} from '@taiga-ui/addon-doc';
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc';
import {TUI_RATING_OPTIONS, TuiRatingOptions} from '@taiga-ui/kit';

@Component({
Expand All @@ -13,15 +13,15 @@ import {TUI_RATING_OPTIONS, TuiRatingOptions} from '@taiga-ui/kit';
encapsulation,
})
export class ExampleTuiRatingComponent {
readonly exampleModule: RawLoaderContent = import(
readonly exampleModule: TuiRawLoaderContent = import(
'./examples/import/import-module.md?raw'
);

readonly exampleHtml: RawLoaderContent = import(
readonly exampleHtml: TuiRawLoaderContent = import(
'./examples/import/insert-template.md?raw'
);

readonly exampleOptions: RawLoaderContent = import(
readonly exampleOptions: TuiRawLoaderContent = import(
'./examples/import/define-options.md?raw'
);

Expand Down
8 changes: 4 additions & 4 deletions projects/demo/src/modules/components/tag/tag.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Component, TemplateRef, ViewChild} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {RawLoaderContent, TuiDocExample} from '@taiga-ui/addon-doc';
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc';
import {TuiSizeL, TuiSizeS} from '@taiga-ui/core';
import {TuiStatus} from '@taiga-ui/kit';
import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';
Expand All @@ -15,15 +15,15 @@ export class ExampleTuiTagComponent {
@ViewChild('errorIcon')
errorTemplate?: TemplateRef<Record<string, unknown>>;

readonly exampleOptions: RawLoaderContent = import(
readonly exampleOptions: TuiRawLoaderContent = import(
'./examples/import/define-options.md?raw'
);

readonly exampleModule: RawLoaderContent = import(
readonly exampleModule: TuiRawLoaderContent = import(
'./examples/import/import-module.md?raw'
);

readonly exampleHtml: RawLoaderContent = import(
readonly exampleHtml: TuiRawLoaderContent = import(
'./examples/import/insert-template.md?raw'
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Component, Inject} from '@angular/core';
import {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';
import {changeDetection} from '@demo/emulate/change-detection';
import {RawLoaderContent, TuiDocExample} from '@taiga-ui/addon-doc';
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc';
import {TuiSizeXXL, TuiSizeXXS} from '@taiga-ui/core';

@Component({
Expand All @@ -10,11 +10,11 @@ import {TuiSizeXXL, TuiSizeXXS} from '@taiga-ui/core';
changeDetection,
})
export class ExampleTuiAvatarComponent {
readonly exampleModule: RawLoaderContent = import(
readonly exampleModule: TuiRawLoaderContent = import(
'./examples/import/import-module.md?raw'
);

readonly exampleHtml: RawLoaderContent = import(
readonly exampleHtml: TuiRawLoaderContent = import(
'./examples/import/insert-template.md?raw'
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {RawLoaderContent, TuiDocExample} from '@taiga-ui/addon-doc';
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc';
import {TuiSizeL, TuiSizeXS} from '@taiga-ui/core';

@Component({
Expand All @@ -9,11 +9,11 @@ import {TuiSizeL, TuiSizeXS} from '@taiga-ui/core';
changeDetection,
})
export class ExampleTuiBadgeAlertComponent {
readonly exampleModule: RawLoaderContent = import(
readonly exampleModule: TuiRawLoaderContent = import(
'./examples/import/import-module.md?raw'
);

readonly exampleHtml: RawLoaderContent = import(
readonly exampleHtml: TuiRawLoaderContent = import(
'./examples/import/insert-template.md?raw'
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {RawLoaderContent, TuiDocExample} from '@taiga-ui/addon-doc';
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc';
import {TuiSizeS, TuiSizeXL} from '@taiga-ui/core';
import {TuiStatus} from '@taiga-ui/kit';

Expand All @@ -10,11 +10,11 @@ import {TuiStatus} from '@taiga-ui/kit';
changeDetection,
})
export class ExampleTuiBadgeComponent {
readonly exampleModule: RawLoaderContent = import(
readonly exampleModule: TuiRawLoaderContent = import(
'./examples/import/import-module.md?raw'
);

readonly exampleHtml: RawLoaderContent = import(
readonly exampleHtml: TuiRawLoaderContent = import(
'./examples/import/insert-template.md?raw'
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {RawLoaderContent, TuiDocExample} from '@taiga-ui/addon-doc';
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc';

@Component({
selector: 'example-badged-content',
templateUrl: './badged-content.template.html',
changeDetection,
})
export class ExampleTuiBadgeAlertComponent {
readonly exampleModule: RawLoaderContent = import(
readonly exampleModule: TuiRawLoaderContent = import(
'./examples/import/import-module.md?raw'
);

readonly exampleHtml: RawLoaderContent = import(
readonly exampleHtml: TuiRawLoaderContent = import(
'./examples/import/insert-template.md?raw'
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {RawLoaderContent, TuiDocExample} from '@taiga-ui/addon-doc';
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc';
import {TuiSizeL, TuiSizeXS} from '@taiga-ui/core';

@Component({
Expand All @@ -9,11 +9,11 @@ import {TuiSizeL, TuiSizeXS} from '@taiga-ui/core';
changeDetection,
})
export class ExampleTuiButtonComponent {
readonly exampleModule: RawLoaderContent = import(
readonly exampleModule: TuiRawLoaderContent = import(
'./examples/import/import-module.md?raw'
);

readonly exampleHtml: RawLoaderContent = import(
readonly exampleHtml: TuiRawLoaderContent = import(
'./examples/import/insert-template.md?raw'
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {RawLoaderContent, TuiDocExample} from '@taiga-ui/addon-doc';
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc';

@Component({
selector: 'example-compass',
templateUrl: './compass.template.html',
changeDetection,
})
export class ExampleTuiCompassComponent {
readonly exampleModule: RawLoaderContent = import(
readonly exampleModule: TuiRawLoaderContent = import(
'./examples/import/import-module.md?raw'
);

readonly exampleHtml: RawLoaderContent = import(
readonly exampleHtml: TuiRawLoaderContent = import(
'./examples/import/insert-template.md?raw'
);

Expand Down
6 changes: 3 additions & 3 deletions projects/demo/src/modules/experimental/fade/fade.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {RawLoaderContent, TuiDocExample} from '@taiga-ui/addon-doc';
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc';

@Component({
selector: 'example-fade',
Expand All @@ -9,11 +9,11 @@ import {RawLoaderContent, TuiDocExample} from '@taiga-ui/addon-doc';
changeDetection,
})
export class ExampleTuiFadeComponent {
readonly exampleModule: RawLoaderContent = import(
readonly exampleModule: TuiRawLoaderContent = import(
'./examples/import/import-module.md?raw'
);

readonly exampleHtml: RawLoaderContent = import(
readonly exampleHtml: TuiRawLoaderContent = import(
'./examples/import/insert-template.md?raw'
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {RawLoaderContent, TuiDocExample} from '@taiga-ui/addon-doc';
import {TuiDocExample, TuiRawLoaderContent} from '@taiga-ui/addon-doc';

@Component({
selector: 'example-sensitive',
templateUrl: './sensitive.template.html',
changeDetection,
})
export class ExampleTuiSensitiveComponent {
readonly exampleModule: RawLoaderContent = import(
readonly exampleModule: TuiRawLoaderContent = import(
'./examples/import/import-module.md?raw'
);

readonly exampleHtml: RawLoaderContent = import(
readonly exampleHtml: TuiRawLoaderContent = import(
'./examples/import/insert-template.md?raw'
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TuiStringHandler,
} from '@taiga-ui/cdk';

import {AbstractTuiFilterByInput, ArrayElement} from './filter-by-input.base';
import {AbstractTuiFilterByInput, TuiArrayElement} from './filter-by-input.base';

/**
* @deprecated Use {@link TuiFilterByInputPipe} instead
Expand All @@ -26,7 +26,7 @@ export class TuiFilterByInputWithPipe
super();
}

transform<T>(items: T, matcher?: TuiStringHandler<ArrayElement<T>>): T;
transform<T>(items: T, matcher?: TuiStringHandler<TuiArrayElement<T>>): T;
transform<T>(
items: ReadonlyArray<readonly T[]> | readonly T[] | null,
stringify: TuiStringHandler<T>,
Expand Down
9 changes: 8 additions & 1 deletion projects/kit/pipes/filter-by-input/filter-by-input.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ import {
} from '@taiga-ui/cdk';
import {tuiIsFlat} from '@taiga-ui/kit/utils';

export type ArrayElement<A> = A extends ReadonlyArray<infer T>
export type TuiArrayElement<A> = A extends ReadonlyArray<infer T>
? A extends ReadonlyArray<ReadonlyArray<infer G>>
? G
: T
: never;

/**
* @deprecated: use {@link TuiArrayElement}
* TODO: remove in v4.0
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
export type ArrayElement<A> = TuiArrayElement<A>;

export abstract class AbstractTuiFilterByInput {
protected abstract readonly accessor: TuiFocusableElementAccessor;

Expand Down
Loading

0 comments on commit 4bce993

Please sign in to comment.