Blogs Book Talks Uses Contact CV
07 March, 2016
Today I am going to talk about a very important topic, and that is Lint. In computer programming, lint is a Unix utility that flags some suspicious and non-portable constructs (likely to be bugs) in C language source code; generically, lint or a linter is any tool that flags suspicious usage in software written in any computer language.
According to wikipedia-
In computer programming, lint is a Unix utility that flags some suspicious and non-portable constructs (likely to be bugs) in C language source code; generically, lint or a linter is any tool that flags suspicious usage in software written in any computer language.
Thats bookish knowledge, lets make is a little bit easier to understand. Linter will help to prevent various typo and organize your code in various coding standards.
apm install linter or from settings' package installer.
This linter package supports a lot of different languages. All the supported packages and ducumentation can be found on http://atomlinter.github.io
I use only some packages that I use for my day to day job. Let me introduce those one by one.
At first lets talk about HTML linter. I use linter-htmlhint package for this. This package is just a bridge between atom and famous htmlhint package. You can install it via
apm install linter-htmlhint. It assume you pc has already htmlhint installed. If not then you could install it through
npm install htmlhint -g and then give it's path to htmlhint package settings. I assume your machinealre If you don't find the path, then type
which htmlhint on your terminal and paste the path to the settings.
After that I am going to talk about csslint. It's almost the same process, just install it form terminal with
apm install linter-csslint and configure it same as previous package.
You can install jsonlint and bootlint for linting json and bootstrap code. Install it by typing
apm install linter-jsonlint and
apm install linter-bootlint. Configuring process is exactly the same.
apm install linter-jshint and then give it's path in settings just like the previous one.
I use php a lot and php has some popular linter package. But I think PHP code sniffer is the most popular and one of the best package for php. You can install the package form terminal by typing
apm install linter-phpcs. It assume youe machine already has phpcs installed. If not you could install it in a number of ways. One of the popular way is to install it through pear. Just type
pear install PHP_CodeSniffer and you are good to go. But I prefer another way, and it's through composer. If you are a php guy, I assume you have familiarity with both pear and composer. You can install it from terminal with
composer global require "squizlabs/php_codesniffer=*" command. Then just give the path of phpcs to the settings of the package.
Thats it. From now on if you do something wrong while typing, atom linter will show errors.
Thats all for today. Peace.