Sunday, 6 August 2017

Installing Lightning CLI and Scanning #Salesforce Lightning Component Code

This blog post is about installing Salesforce Lightning CLI, and how to scan your lightning component code for javascript coding issues and lighting issues. 




Lightning CLI alerts you to specific issues related to LockerService. Issues that are flagged include incorrect Lightning components code, and usage of unsupported or private JavaScript API methods. Lightning CLI installs into the Heroku Toolbelt, and is used on the command line.

Salesforce Lightning CLI is Heroku toolbelt plugin, need to install Heroku toolbelt, Lightning CLI relieas on Heroku toolbelt, so if you don't have Heroku installed, please install from the below link.


After installing Heroku, open cmd, and login to Heroku, git bash doesn't have this option of login to heroku, so need to use cmd only.


After successfull installation of heroku, check for node and npm, and then check for the version of theirs, and then install Lighting CLI

Enter below command

heroku plugins:install salesforce-lightning-cli




You have successfully installed Lightning CLI now. Its time to run and scan your lightning component JS code now.
You can scan a Lightning component in one shot, or a single JS file, to scan enter below command

heroku lightning:lint  ...path-of-your-lightning-component


Here is how Lightning CLI shows the component code errors, 



Above snapshot shows, what you need to modify in the controller and helper code, as it only scans the JS files.

Important links



Thanks !
Hope it helps.

No comments:

Post a Comment