2015-07-24 20:07:03 +00:00
|
|
|
;;; packages.el --- react Layer packages File for Spacemacs
|
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2015-07-24 20:07:03 +00:00
|
|
|
;;
|
|
|
|
;; Author: Andrea Moretti <axyzxp@gmail.com>
|
|
|
|
;; URL: https://github.com/axyz
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
|
|
|
(setq react-packages
|
2015-07-28 22:05:16 +00:00
|
|
|
'(
|
2015-08-25 01:37:42 +00:00
|
|
|
company-tern
|
2016-10-10 01:44:35 +00:00
|
|
|
emmet-mode
|
2016-02-28 08:15:24 +00:00
|
|
|
evil-matchit
|
2015-08-25 01:37:42 +00:00
|
|
|
flycheck
|
|
|
|
js-doc
|
2016-04-21 14:35:28 +00:00
|
|
|
smartparens
|
2015-08-27 03:04:53 +00:00
|
|
|
tern
|
2015-07-28 22:05:16 +00:00
|
|
|
web-beautify
|
2015-08-25 01:37:42 +00:00
|
|
|
web-mode
|
2015-07-28 22:05:16 +00:00
|
|
|
))
|
2015-07-24 20:07:03 +00:00
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun react/post-init-company-tern ()
|
2017-01-02 05:39:04 +00:00
|
|
|
(spacemacs|add-company-backends :backends company-tern :modes react-mode))
|
2015-07-24 20:07:03 +00:00
|
|
|
|
2016-10-10 01:44:35 +00:00
|
|
|
(defun react/post-init-emmet-mode ()
|
2016-10-03 21:54:21 +00:00
|
|
|
(add-hook 'react-mode-hook 'emmet-mode))
|
|
|
|
|
2016-02-28 08:15:24 +00:00
|
|
|
(defun react/post-init-evil-matchit ()
|
|
|
|
(with-eval-after-load 'evil-matchit
|
2017-01-02 03:45:23 +00:00
|
|
|
(plist-put evilmi-plugins 'react-mode
|
|
|
|
'((evilmi-simple-get-tag evilmi-simple-jump)
|
|
|
|
(evilmi-javascript-get-tag evilmi-javascript-jump)
|
|
|
|
(evilmi-html-get-tag evilmi-html-jump)))))
|
2016-02-28 08:15:24 +00:00
|
|
|
|
2015-08-26 00:57:56 +00:00
|
|
|
(defun react/post-init-flycheck ()
|
2016-04-21 08:42:22 +00:00
|
|
|
(with-eval-after-load 'flycheck
|
2016-06-05 08:08:41 +00:00
|
|
|
(dolist (checker '(javascript-eslint javascript-standard))
|
|
|
|
(flycheck-add-mode checker 'react-mode)))
|
2017-02-14 03:27:29 +00:00
|
|
|
(spacemacs/enable-flycheck 'react-mode))
|
2015-07-27 22:26:47 +00:00
|
|
|
|
2015-08-26 00:57:56 +00:00
|
|
|
(defun react/post-init-js-doc ()
|
|
|
|
(add-hook 'react-mode-hook 'spacemacs/js-doc-require)
|
|
|
|
(spacemacs/js-doc-set-key-bindings 'react-mode))
|
2015-07-27 22:26:47 +00:00
|
|
|
|
2016-04-21 14:35:28 +00:00
|
|
|
(defun react/post-init-smartparens ()
|
|
|
|
(if dotspacemacs-smartparens-strict-mode
|
|
|
|
(add-hook 'react-mode-hook #'smartparens-strict-mode)
|
|
|
|
(add-hook 'react-mode-hook #'smartparens-mode)))
|
|
|
|
|
2016-06-21 23:03:18 +00:00
|
|
|
(defun react/post-init-tern ()
|
|
|
|
(add-hook 'react-mode-hook 'tern-mode)
|
|
|
|
(spacemacs//set-tern-key-bindings 'react-mode))
|
2015-08-27 03:04:53 +00:00
|
|
|
|
2015-08-26 00:57:56 +00:00
|
|
|
(defun react/post-init-web-beautify ()
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'react-mode "=" 'web-beautify-js))
|
2015-07-28 22:05:16 +00:00
|
|
|
|
2015-08-25 01:37:42 +00:00
|
|
|
(defun react/post-init-web-mode ()
|
|
|
|
(define-derived-mode react-mode web-mode "react")
|
2016-04-21 15:02:48 +00:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.jsx\\'" . react-mode))
|
2015-08-25 01:37:42 +00:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.react.js\\'" . react-mode))
|
2015-12-22 09:34:58 +00:00
|
|
|
(add-to-list 'auto-mode-alist '("\\index.android.js\\'" . react-mode))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\index.ios.js\\'" . react-mode))
|
2017-07-01 23:40:17 +00:00
|
|
|
(add-to-list 'magic-mode-alist '("/\\*\\* @jsx .*\\*/" . react-mode))
|
2016-09-03 22:20:58 +00:00
|
|
|
(add-to-list 'magic-mode-alist '("import\s+[^\s]+\s+from\s+['\"]react['\"]" . react-mode))
|
2015-08-26 00:57:56 +00:00
|
|
|
(add-hook 'react-mode-hook 'spacemacs//setup-react-mode))
|