Skip to content

Commit

Permalink
chore: Enforce eslint and fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mpalourdio committed Mar 29, 2024
1 parent 25ad463 commit afe226e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
19 changes: 14 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,32 @@
"createDefaultProgram": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": [
"error"
],
"no-extra-boolean-cast": [
"off"
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "",
"style": "kebab-case",
"type": "element"
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "",
"style": "camelCase",
"type": "attribute"
"style": "camelCase"
}
],
"comma-dangle": [
Expand All @@ -51,7 +59,8 @@
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
"plugin:@angular-eslint/template/recommended",
"plugin:@angular-eslint/template/accessibility"
],
"rules": {}
}
Expand Down
7 changes: 4 additions & 3 deletions src/lib/components/intl-tel-input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import { AfterViewInit, Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { ControlContainer, NgForm } from '@angular/forms';
import intlTelInput from 'intl-tel-input';
import { CountryData, IntlTelInputOptions } from '../model/intl-tel-input-options';
import { IntlTelInputOptions } from '../model/intl-tel-input-options';
import { IntlTelInput } from "../model/intl-tel-input";

@Component({
selector: 'intl-tel-input',
Expand All @@ -30,14 +31,14 @@ export class IntlTelInputComponent implements AfterViewInit {
@Output() private E164PhoneNumberChange = new EventEmitter<string | null>();
@ViewChild('intlTelInput') private _inputElement!: ElementRef;
private _phoneNumber!: string;
private _intlTelInput: any;
private _intlTelInput!: IntlTelInput;

ngAfterViewInit(): void {
const intlTelInputInstance = intlTelInput;
this._intlTelInput = intlTelInputInstance(this._inputElement.nativeElement, this.options);
}

get intlTelInput(): any {
get intlTelInput(): IntlTelInput {
return this._intlTelInput;
}

Expand Down
9 changes: 9 additions & 0 deletions src/lib/model/intl-tel-input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export type IntlTelInput = {
setNumber(a: string): void

isValidNumber(): boolean

getNumber(): string | null

setCountry(a: string): void
}
1 change: 1 addition & 0 deletions src/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@

export * from './lib/components/intl-tel-input.component';
export * from './lib/model/intl-tel-input-options';
export * from './lib/model/intl-tel-input';
export * from './lib/intl-tel-input-ng.module';

0 comments on commit afe226e

Please sign in to comment.