Skip to content

Instantly share code, notes, and snippets.

@fselcukcan
Last active June 4, 2019 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fselcukcan/d716c7fd44607c81f5d8ebfb9398a9e0 to your computer and use it in GitHub Desktop.
Save fselcukcan/d716c7fd44607c81f5d8ebfb9398a9e0 to your computer and use it in GitHub Desktop.
my emacs config
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ns-right-alternate-modifier (quote none))
'(package-archives
(quote
(("gnu" . "https://elpa.gnu.org/packages/")
("melpa-stable" . "https://stable.melpa.org/packages/")
("melpa-milkbox" . "http://melpa.milkbox.net/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("org" . "https://orgmode.org/elpa/"))))
'(package-selected-packages (quote (flycheck-mode web-mode))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; web-mode config
(add-to-list 'auto-mode-alist '("\\.jsx?$" . web-mode)) ;; auto-enable for .js/.jsx files
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
;; JSX syntax highlighting
(setq web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'")))
(setq web-mode-enable-auto-pairing t)
;; Indentation and other settings
(defun web-mode-init-hook ()
"Hooks for Web mode. Adjust indent."
(setq web-mode-markup-indent-offset 4))
(add-hook 'web-mode-hook 'web-mode-init-hook)
;; (add-hook 'web-mode-hook
;; (lambda ()
;; ;; short circuit js mode and just do everything in jsx-mode
;; (if (equal web-mode-content-type "javascript")
;; (web-mode-set-content-type "jsx")
;; (message "now set to: %s" web-mode-content-type))))
;; END web-mode config
;; Flycheck Eslint config
;; Disable the default jslint:
;; (setq-default flycheck-disabled-checkers
;; (append flycheck-disabled-checkers
;; '(javascript-jshint json-jsonlist)))
;; Using a global eslint
;;; Enable eslint checker for web-mode
;; (flycheck-add-mode 'javascript-eslint 'web-mode)
;;; Enable flycheck globally
(add-hook 'after-init-hook #'global-flycheck-mode)
;; Using a local eslint from node_modules
;;; M-x package-install RET add-node-modules-path RET
;;; (add-hook 'flycheck-mode-hook 'add-node-modules-path)
;; END Flycheck Eslint config
;; Prettier.js config
;; You can enable prettier.js to automatically format your files every time you save:
;;; M-x package-install RET prettier-js-mode RET
;;; M-x package-install RET add-node-modules-path RET
;; (defun web-mode-init-prettier-hook ()
;; (add-node-modules-path)
;; (prettier-js-mode))
;; (add-hook 'web-mode-hook 'web-mode-init-hook)
;; END Prettier.js config
;; Emmet HTML tag expansion config
;;; M-x package-install RET emmet-mode RET
;;; (add-hook 'web-mode-hook 'emmet-mode)
;; END Emmet HTML tag expansion config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment