Using StandardJS in Spacemacs/Emacs
At the moment of writing this, I was using Spacemacs with its javascript layer without any customization. While working on javascript project that uses StandardJS as linter, I was getting a lot of warnings (mostly about missing semicolon), and was not getting any of StandardJS warnings.
To make javascript layer in Spacemacs work with StandardJS, I did following:
- Installed
standard
npm package globally (npm install -g standard
). - Turned off js2-mode’s strict warnings (because it has its own linter rules which we don’t want to see any more).
- Set indentation in js2-mode to 2 spaces.
So at the end, this is what my javascript
layer configuration looks like:
(javascript :variables
js2-mode-show-strict-warnings nil ;; We have standardjs for linting/warnings.
js2-basic-offset 2
js-indent-level 2)