How to disable ESLint validation error -Variable is defined but never used when building a PCF component

Hello everyone and welcome to my blog. In today’s blog I will discuss on how to resolve an error I faced recently when creating a PowerApps component framework (PCF) control in visual studio code.

The blog focus on Power Apps Component framework (PCF) control development but the solution shall work for anyone receiving the ESLint no-used-vars error. So even if you are not from power apps background, you can continue reading.

Coming back to the topic, I created a PCF project then used the command npm run build to build my PCF project. But I received the below ESLint validation errors.

The error is quite obvious and I knew why it was coming. But at the same time, it is necessary to first build the control and gradually develop the code where all the variables are used.

So the first step is to disable the validation errors of ESLint. If you are wondering what is ESLint all about, visit here for detailed information.

In my case I want to disable it for all methods in the file. So I declare the following command at the top of my file.

/* eslint no-unused-vars : "off" */

Now when I run npm run build, the project shall build without any errors.

Hope you liked this post. If this post has helped, you can buy me a coffee.

For similar topics on Microsoft.NET and Power Platform, subscribe to my blog using the Subscribe option on right pane.

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading