Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Enforce eslint and fix warnings #53

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';