How to enable type-check rules with flycheck-tslint

2017-05-19 16:18:31

I want flycheck to use the tslint's --type-check flag to compile my typescript files. In order to see unused imports on the fly inside emacs.

By tslint docs


Enables the type checker when running linting rules. --project must be

specified in order to enable type checking.

I also found out that I can set flycheck-tslint-args to add aditional aguments to tslint. Here it is a snippet of my config file

(defun setup-tide-mode ()



(flycheck-mode +1)

(flycheck-select-checker 'typescript-tslint)

(if (projectile-project-p)

(message projectile-project-root))

(setq flycheck-tslint-args . ((concat "--project tsconfig.json --type-check " buffer-file-name )))

(setq flycheck-check-syntax-automatically '(save mode-enabled))



(add-hook 'typescript-mode-hook #'setup-tide-mode)

The equivalent command runs just fine on terminal

~/go/src/ (develop)

��─ �� tslint --project tsc