How to Start using Linter on Sublime Text
This story is a follow-up to the previous story about code style in the link below.
Sublime Text is one of the most popular text editor right now (yeah I know, Atom and VSCode also quite popular right now). Some people prefer to use Text Editor rather than a full-fledged IDE. But, one of the problems with most text editors are that they didn’t come with out-of-the-box syntax error markers or style code checker. Don’t worry, we have solutions for Text Editor maniac.
Linter
As in Wikipedia, lint or a linter is any tool that flags suspicious usage in software written in any computer languages. Yet, the definition of lint today is often used to represents as checkers whether the code corresponds to certain code style or not. It is also useful for simple debuggers for common errors.
Installation
Package Control
To install Linter on our Sublime Text, we have to install Package Control first. Basically, Package Control is a package manager designed for Sublime Text to install and keep packages up-to-date. To check for installation instruction, you can always check on the link below. It will run several python codes, I can’t copy the content of the code here since it will change over time.
SublimeLinter
If you have installed the package manager, you can start to install packages, yeaay. To install packages in sublime, open the command palette (ctrl+shift+p
for Windows and Linux or cmd+shift+p
for Mac OS X). Type install
and select Package Control: Install Package
from the command palette.
Now, you will be given a list of available packages. Search for SublimeLinter
and now select from the command palette.
Wait for a few seconds, and SublimeLinter will be installed!
Linter for specific programming languages
Open command palette again and you will see there are tons of available linter out there, now you should install which one you want to use.
For demonstration, I’m going to install the linter for Python with PEP8 code style. So we select the SublimeLinter-pep8
.
Usually after this you will need to do more configuration, just check for the message that pops out after the linter installation completed and complete the instruction.
Usages
Now it’s all done! You can use it right away. Here is an example of checking python code using SublimeLinter-pep8
.
Wrap Up
So, that’s all you need to do to configure linter in Sublime Text. Let me know if you have something in mind or suggestion for me. You can even request me to cover up some topic. Hopefully, it will help you in any way. Happy coding!