jscs.el helps consistent JavaScript editing using JSCS.
- Apply indentation rules from JSCS config file
- Run
jscs --fix
- Support all types of JSCS config files
- 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
.
jscs.el is available on MELPA.
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)
- validateIndentation
indent-tabs-mode
js-indent-level
in js-mode or json-modejs2-basic-offset
in js2-mode
- maximumLineLength
tab-width