/emacs-jscs

Consistent JavaScript editing using JSCS

Primary LanguageEmacs LispBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

jscs.el

jscs.el helps consistent JavaScript editing using JSCS.

Features

  • Apply indentation rules from JSCS config file
  • Run jscs --fix
  • Support all types of JSCS config files

Requirements

  • Emacs 24 or later
  • JSCS 2.0.0 or later

Make sure that node and jscs commands can be executed from Emacs: M-! node --version and M-! jscs --version.

Installation

jscs.el is available on MELPA.

Usage

To apply JSCS indentation rules to JavaScript or JSON modes, add the following code into your .emacs:

(add-hook 'js-mode-hook #'jscs-indent-apply)
(add-hook 'js2-mode-hook #'jscs-indent-apply)
(add-hook 'json-mode-hook #'jscs-indent-apply)

To run jscs --fix interactively, run M-x jscs-fix.

To run jscs --fix on JavaScript modes when saving, add the following code into your .emacs:

(add-hook 'js-mode-hook #'jscs-fix-run-before-save)
(add-hook 'js2-mode-hook #'jscs-fix-run-before-save)

Indentation Rules