Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

TypeScript Guidelines

Leonardo Epifânio edited this page Apr 2, 2019 · 4 revisions

TSLint

TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported across modern editors & build systems and can be customized with your own lint rules, configurations, and formatters.

Install

To install use the following command:

    npm install tslint -g

Configure

You need to configurate these rules:

{
    "defaultSeverity": "error",
    "extends": [
        "tslint:recommended"
    ],
    "jsRules": {},
    "rules": {
    	"indent": [true, "tabs", 4],
    	"no-console": [false, "log", "error"],
    	"ordered-imports": false,
    	"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"],
    	"no-trailing-whitespace": false
    },
    "rulesDirectory": []
}

Prettier Now

Prettier Now is a VSCode extension that formats the js and ts code. If you use the following settings (in VSCode, top right corner {} symbol), it will "prettify" the code on save.

    "editor.formatOnSave": true,
    "editor.formatOnPaste": true,
    "prettier.singleQuote": false,
Clone this wiki locally