The completion of course, comes from emacs
comany package, but I also wanted to have a checker, emacs
Here is how to get them both working easily, even though I must admit it requires third party
npm packages, everything is not as well integrated directly into one’s emacs configuration such as
Let’s start with completion. It is necessary to install the tern utiliy, globally for instance as show in the following command.
$ npm install -g tern tern-lint
Let’s configure our emacs setup completion layers.
First step is to require
company-tern, and to add it to the list of
company-backends. Finally, we add a hook on
js2-mode to trigger
1 2 3 4 5 6 7 8 9 10 11 12
This is enough for the emac’s side, but I figured out that if you want
company to provide candidates, you’ll have to create a
.tern-project file at the root of your project (e.g. a Node.js one).
1 2 3 4 5 6
Now for the on-the-fly checking. Again, we’ll have to install third party tools and configure them system wide.
$ npm install -g eslint babel-eslint eslint-plugin-react
Here is the setup for the checking layer of your emacs setup.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
flycheck, it will fallback to it as we have disabled priority one
eslint to behave as expected, a configuration file
.eslintrc has to exist in your home folder. Here’s mine. Of course, it can be customized to meet your needs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22