Skip to content

Commit

Permalink
upgrade prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Nov 6, 2024
1 parent f05dbc5 commit edecf71
Show file tree
Hide file tree
Showing 14 changed files with 705 additions and 776 deletions.
1 change: 1 addition & 0 deletions example-project/component-library-angular/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/directives/*.ts
2 changes: 1 addition & 1 deletion example-project/component-library-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"lint": "echo \"lint not configured\" && exit 0",
"prerelease": "pnpm run validate && np prerelease --yolo --any-branch --tag next",
"prettier": "pnpm run prettier.base --write",
"prettier.base": "prettier \"./({scripts,src,__tests__}/**/*.{ts,tsx,js,jsx})|*.{ts,tsx,js,jsx}\"",
"prettier.base": "prettier \"./({scripts,src,__tests__,!src/directives}/**/*.{ts,tsx,js,jsx})|*.{ts,tsx,js,jsx}\" --ignore-path=\"./.prettierignore\"",
"prettier.dry-run": "pnpm run prettier.base --list-different",
"test": "jest",
"tsc": "tsc -p .",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { ValueAccessor } from './value-accessor';
/* tslint:disable-next-line:directive-selector */
selector: 'my-checkbox',
host: {
'(myChange)': 'handleChangeEvent($event.target.checked)',
'(myChange)': 'handleChangeEvent($event.target.checked)'
},
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: BooleanValueAccessor,
multi: true,
},
],
multi: true
}
]
})
export class BooleanValueAccessor extends ValueAccessor {
constructor(el: ElementRef) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ import { ValueAccessor } from './value-accessor';
/* tslint:disable-next-line:directive-selector */
selector: 'my-input[type=number]',
host: {
'(myChange)': 'handleChangeEvent($event.target.value)',
'(myChange)': 'handleChangeEvent($event.target.value)'
},
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: NumericValueAccessor,
multi: true,
},
],
multi: true
}
]
})
export class NumericValueAccessor extends ValueAccessor {
constructor(el: ElementRef) {
super(el);
}
override registerOnChange(fn: (_: number | null) => void) {
super.registerOnChange((value) => {
super.registerOnChange(value => {
fn(value === '' ? null : parseFloat(value));
});
}
Expand Down
189 changes: 33 additions & 156 deletions example-project/component-library-angular/src/directives/proxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,16 @@ import { ProxyCmp, proxyOutputs } from './angular-component-lib/utils';

import { Components } from 'component-library';


@ProxyCmp({
inputs: [
'buttonType',
'color',
'disabled',
'download',
'expand',
'fill',
'href',
'mode',
'rel',
'shape',
'size',
'strong',
'target',
'type',
],
inputs: ['buttonType', 'color', 'disabled', 'download', 'expand', 'fill', 'href', 'mode', 'rel', 'shape', 'size', 'strong', 'target', 'type']
})
@Component({
selector: 'my-button',
changeDetection: ChangeDetectionStrategy.OnPush,
template: '<ng-content></ng-content>',
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
inputs: [
'buttonType',
'color',
'disabled',
'download',
'expand',
'fill',
'href',
'mode',
'rel',
'shape',
'size',
'strong',
'target',
'type',
],
inputs: ['buttonType', 'color', 'disabled', 'download', 'expand', 'fill', 'href', 'mode', 'rel', 'shape', 'size', 'strong', 'target', 'type'],
})
export class MyButton {
protected el: HTMLElement;
Expand All @@ -55,6 +26,7 @@ export class MyButton {
}
}


export declare interface MyButton extends Components.MyButton {
/**
* Emitted when the button has focus.
Expand All @@ -66,8 +38,9 @@ export declare interface MyButton extends Components.MyButton {
myBlur: EventEmitter<CustomEvent<void>>;
}


@ProxyCmp({
inputs: ['checked', 'color', 'disabled', 'indeterminate', 'mode', 'name', 'value'],
inputs: ['checked', 'color', 'disabled', 'indeterminate', 'mode', 'name', 'value']
})
@Component({
selector: 'my-checkbox',
Expand All @@ -85,6 +58,7 @@ export class MyCheckbox {
}
}


import type { CheckboxChangeEventDetail as IMyCheckboxCheckboxChangeEventDetail } from 'component-library';

export declare interface MyCheckbox extends Components.MyCheckbox {
Expand All @@ -102,8 +76,9 @@ export declare interface MyCheckbox extends Components.MyCheckbox {
myBlur: EventEmitter<CustomEvent<void>>;
}


@ProxyCmp({
inputs: ['age', 'favoriteKidName', 'first', 'kidsNames', 'last', 'middle'],
inputs: ['age', 'favoriteKidName', 'first', 'kidsNames', 'last', 'middle']
})
@Component({
selector: 'my-component',
Expand All @@ -121,79 +96,25 @@ export class MyComponent {
}
}


export declare interface MyComponent extends Components.MyComponent {
/**
* Testing an event without value
*/
myCustomEvent: EventEmitter<CustomEvent<number>>;
}


@ProxyCmp({
inputs: [
'accept',
'autocapitalize',
'autocomplete',
'autocorrect',
'autofocus',
'clearInput',
'clearOnEdit',
'color',
'disabled',
'enterkeyhint',
'inputmode',
'max',
'maxlength',
'min',
'minlength',
'mode',
'multiple',
'name',
'pattern',
'placeholder',
'readonly',
'required',
'size',
'spellcheck',
'step',
'type',
'value',
],
methods: ['setFocus', 'getInputElement'],
inputs: ['accept', 'autocapitalize', 'autocomplete', 'autocorrect', 'autofocus', 'clearInput', 'clearOnEdit', 'color', 'disabled', 'enterkeyhint', 'inputmode', 'max', 'maxlength', 'min', 'minlength', 'mode', 'multiple', 'name', 'pattern', 'placeholder', 'readonly', 'required', 'size', 'spellcheck', 'step', 'type', 'value'],
methods: ['setFocus', 'getInputElement']
})
@Component({
selector: 'my-input',
changeDetection: ChangeDetectionStrategy.OnPush,
template: '<ng-content></ng-content>',
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
inputs: [
'accept',
'autocapitalize',
'autocomplete',
'autocorrect',
'autofocus',
'clearInput',
'clearOnEdit',
'color',
'disabled',
'enterkeyhint',
'inputmode',
'max',
'maxlength',
'min',
'minlength',
'mode',
'multiple',
'name',
'pattern',
'placeholder',
'readonly',
'required',
'size',
'spellcheck',
'step',
'type',
'value',
],
inputs: ['accept', 'autocapitalize', 'autocomplete', 'autocorrect', 'autofocus', 'clearInput', 'clearOnEdit', 'color', 'disabled', 'enterkeyhint', 'inputmode', 'max', 'maxlength', 'min', 'minlength', 'mode', 'multiple', 'name', 'pattern', 'placeholder', 'readonly', 'required', 'size', 'spellcheck', 'step', 'type', 'value'],
})
export class MyInput {
protected el: HTMLElement;
Expand All @@ -204,6 +125,7 @@ export class MyInput {
}
}


import type { InputChangeEventDetail as IMyInputInputChangeEventDetail } from 'component-library';

export declare interface MyInput extends Components.MyInput {
Expand All @@ -225,53 +147,28 @@ export declare interface MyInput extends Components.MyInput {
myFocus: EventEmitter<CustomEvent<void>>;
}


@ProxyCmp({
inputs: [
'animated',
'backdropDismiss',
'component',
'componentProps',
'cssClass',
'event',
'keyboardClose',
'mode',
'showBackdrop',
'translucent',
],
methods: ['present', 'dismiss', 'onDidDismiss', 'onWillDismiss'],
inputs: ['animated', 'backdropDismiss', 'component', 'componentProps', 'cssClass', 'event', 'keyboardClose', 'mode', 'showBackdrop', 'translucent'],
methods: ['present', 'dismiss', 'onDidDismiss', 'onWillDismiss']
})
@Component({
selector: 'my-popover',
changeDetection: ChangeDetectionStrategy.OnPush,
template: '<ng-content></ng-content>',
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
inputs: [
'animated',
'backdropDismiss',
'component',
'componentProps',
'cssClass',
'event',
'keyboardClose',
'mode',
'showBackdrop',
'translucent',
],
inputs: ['animated', 'backdropDismiss', 'component', 'componentProps', 'cssClass', 'event', 'keyboardClose', 'mode', 'showBackdrop', 'translucent'],
})
export class MyPopover {
protected el: HTMLElement;
constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
c.detach();
this.el = r.nativeElement;
proxyOutputs(this, this.el, [
'myPopoverDidPresent',
'myPopoverWillPresent',
'myPopoverWillDismiss',
'myPopoverDidDismiss',
]);
proxyOutputs(this, this.el, ['myPopoverDidPresent', 'myPopoverWillPresent', 'myPopoverWillDismiss', 'myPopoverDidDismiss']);
}
}


import type { OverlayEventDetail as IMyPopoverOverlayEventDetail } from 'component-library';

export declare interface MyPopover extends Components.MyPopover {
Expand All @@ -293,8 +190,9 @@ export declare interface MyPopover extends Components.MyPopover {
myPopoverDidDismiss: EventEmitter<CustomEvent<IMyPopoverOverlayEventDetail>>;
}


@ProxyCmp({
inputs: ['color', 'disabled', 'mode', 'name', 'value'],
inputs: ['color', 'disabled', 'mode', 'name', 'value']
})
@Component({
selector: 'my-radio',
Expand All @@ -312,6 +210,7 @@ export class MyRadio {
}
}


export declare interface MyRadio extends Components.MyRadio {
/**
* Emitted when the radio button has focus.
Expand All @@ -327,8 +226,9 @@ export declare interface MyRadio extends Components.MyRadio {
mySelect: EventEmitter<CustomEvent<void>>;
}


@ProxyCmp({
inputs: ['allowEmptySelection', 'name', 'value'],
inputs: ['allowEmptySelection', 'name', 'value']
})
@Component({
selector: 'my-radio-group',
Expand All @@ -346,6 +246,7 @@ export class MyRadioGroup {
}
}


import type { RadioGroupChangeEventDetail as IMyRadioGroupRadioGroupChangeEventDetail } from 'component-library';

export declare interface MyRadioGroup extends Components.MyRadioGroup {
Expand All @@ -355,43 +256,16 @@ export declare interface MyRadioGroup extends Components.MyRadioGroup {
myChange: EventEmitter<CustomEvent<IMyRadioGroupRadioGroupChangeEventDetail>>;
}


@ProxyCmp({
inputs: [
'color',
'debounce',
'disabled',
'dualKnobs',
'max',
'min',
'mode',
'name',
'pin',
'snaps',
'step',
'ticks',
'value',
],
inputs: ['color', 'debounce', 'disabled', 'dualKnobs', 'max', 'min', 'mode', 'name', 'pin', 'snaps', 'step', 'ticks', 'value']
})
@Component({
selector: 'my-range',
changeDetection: ChangeDetectionStrategy.OnPush,
template: '<ng-content></ng-content>',
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
inputs: [
'color',
'debounce',
'disabled',
'dualKnobs',
'max',
'min',
'mode',
'name',
'pin',
'snaps',
'step',
'ticks',
'value',
],
inputs: ['color', 'debounce', 'disabled', 'dualKnobs', 'max', 'min', 'mode', 'name', 'pin', 'snaps', 'step', 'ticks', 'value'],
})
export class MyRange {
protected el: HTMLElement;
Expand All @@ -402,6 +276,7 @@ export class MyRange {
}
}


import type { RangeChangeEventDetail as IMyRangeRangeChangeEventDetail } from 'component-library';

export declare interface MyRange extends Components.MyRange {
Expand All @@ -418,3 +293,5 @@ export declare interface MyRange extends Components.MyRange {
*/
myBlur: EventEmitter<CustomEvent<void>>;
}


Loading

0 comments on commit edecf71

Please sign in to comment.