init-flycheck.el 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ;;; init-flycheck.el --- .Emacs Configuration -*- lexical-binding: t -*-
  2. ;;; Commentary:
  3. ;;
  4. ;;; Code:
  5. (use-package flycheck
  6. :config
  7. ;; support web-mode with PHP
  8. (flycheck-define-checker mix-php
  9. "A PHP syntax checker using the PHP command line interpreter.
  10. See URL `https://php.net/manual/en/features.commandline.php'."
  11. :command ("php" "-l" "-d" "error_reporting=E_ALL" "-d" "display_errors=1"
  12. "-d" "log_errors=0" source)
  13. :error-patterns
  14. ((error line-start (or "Parse" "Fatal" "syntax") " error" (any ":" ",") " "
  15. (message) " in " (file-name) " on line " line line-end))
  16. :modes (php-mode php+-mode web-mode))
  17. (add-to-list 'flycheck-checkers 'mix-php)
  18. ;; enable typescript-tslint checker
  19. (with-eval-after-load 'tide
  20. (flycheck-add-mode 'typescript-tslint 'typescript-mode)
  21. (flycheck-add-mode 'typescript-tide 'typescript-mode))
  22. ;; Enable for only languages
  23. :hook
  24. (c++-mode . flycheck-mode)
  25. ;; (emacs-lisp-mode flycheck-mode)
  26. (html-mode . flycheck-mode)
  27. (js-mode . flycheck-mode)
  28. (python-mode . flycheck-mode)
  29. (web-mode . flycheck-mode)
  30. (sh-mode . flycheck-mode))
  31. (provide 'init-flycheck)
  32. ;; End:
  33. ;;; init-flycheck.el ends here