utils-addresses
v1.1.14
Published
demo npm module
Downloads
1
Readme
nqm-project-template
A starting template for all nqminds projects, apps, and databots, with eslint and vs code intellisense support
introduction
Configuring VS Code to get the maximum benefit from it's intellisense and linting capabilities can be a non-intuitive process. This guide aims to outline the basic steps required to get up and running.
eslint
eslint greatly helps in finding and avoiding bugs in your code, and will also help to make the nqminds code-base consistent rather than varying with each person's style.
eslint highlights (with a red squiggly line) possible bugs and inconsistent styling, and the following image shows eslint in action.
The following rules are imposed by the nqminds eslint configuration. It's not a long list and most of them are obvious and will greatly reduce the chance of bugs in your code if you adhere to them. Some of the style choices, e.g. double quotes rather than single quotes are subjective, but it's a case of choosing one and sticking to it for consistencies sake.
- can't assign to a const variable
- all variables must be defined before use
- unreachable code is highlighted
- all declared but unused variables are highlighted
- must use === in place of ==
- indents must be 2 spaces
- all quotes must be double, not single
- semi-colons must be used everywhere
No pull requests will be merged without a clean eslint report!
install
Install the eslint package globally on your machine.
sudo npm install -g eslint
You may also want to install and enable any plugins:
sudo npm install -g eslint-plugin-react
Install the VS Code eslint extension.
Copy the .eslintrc.json
file from this repository to the root of your project folder.
intellisense
VS Code has some intellisense support out-of-the-box, but in order to get maximum benefit from it requires a few extra steps.
The following image shows full intellisense support for the lodash library:
install
Install the typescript typings system.
sudo npm install -g typings
Copy the typings.json
and jsconfig.json
files from this repository to the root of your project folder.
Install the default node and lodash typings:
cd /path/to/project/root
typings install
Locate and install any other typings your project might need, e.g. Meteor:
typings search Meteor
typings install --save --global dt~meteor
There is a full description of the VS Code typings system.