Skip to main content

Learning Angular: Note on Angular ESLint

·90 words·1 min
Bemn
Author
Bemn
Hong Konger.

Here are 3 notes on ESLint warnings/errors when developing Angular app:

For each <a> with user interaction e.g. (click), you have to define at least one keyboard interaction together with tab index e.g.

<a 
	(click)="clickHandler" 
	(keyup.enter)="clickHandler" 
	[tabindex]="0"
>
	This is a link which allow user to click with accessbility
</a>

If a value is a Typescript Enum and you want to compare with a number, add .valueOf e.g.

somePropertyWithTypeEnum.valueOf() = anIntegerYouWantToCompare;

Adding a hash and pass .value when dealing with Mat-select input handler:

<mat-select 
	id="{{question.id}}" 
	formControlName="{{question.id}}"
	#selectInput
	(input)="onSearchChange(selectInput.value)"
	(change)="questionFilled()"
>

Related

Avoid Multiple Lifecycle Hooks in Azure Devops Deployment Job
·541 words·3 mins
Optimizing Azure DevOps pipelines by minimizing lifecycle hooks improves variable consistency across deployment stages.
Adding Audio to Your Web App: The Complete Guide
·1389 words·7 mins
Sound, rhythm, and harmony find their way into the inward places of the soul.
⚙️ Setting Up Nginx for Local Development
·749 words·4 mins
Let’s have HTTPS all the way, locally.