Changes

Jump to: navigation, search

WebExtensions/Hacking

282 bytes added, 21:24, 29 June 2016
mach eslint --setup no longer installs globally! Improve eslint vim config to use the eslint binary from "mach eslint --setup", only for mozilla-central.
All WebExtension directories in <code>mozilla-central</code> are configured with a set of ESLint rules, which all code is required to pass. Many of these rules help to catch serious errors, such as references to non-existent variables, or a missing trailing comma turning an array literal into an array dereference, so it is extremely important that you check you code against them before it lands.
The simplest way to check your code is using the <code>mach eslint</code> command. This requires that you have [https://docs.npmjs.com/ NPM] installed (and, if you're on Linux, it may require that you [https://docs.npmjs.com/getting-started/fixing-npm-permissions fix NPM permissions]).
To setup ESLint, you need to run the following once:
The following assumes that you use the [https://github.com/VundleVim/Vundle.vim Vundle package manager]. It should be easy enough to adapt to any other package manager you happen to prefer, though.
<code>mach eslint --setup</code> installs a specific ESLint version and some ESLint plugins to a subdirectory of the repository.You should configure Syntastic roughly as follows(change <code>/path/to/mozilla-central</code> as needed):
" Initialize Vundle.
Bundle 'scrooloose/syntastic'
" Enable the specific ESLint checker for files in Syntasticmozilla-central/ only. let g:syntastic_javascript_checkers = ['eslint']
" Enable the HTML plugin, and enable JavaScript linting for HTML files.
autocmd BufRead,BufNewFile */mozilla-central/* \ let b:syntastic_javascript_checkers = ['eslint'] | \ let b:syntastic_javascript_eslint_exec = '/path/to/mozilla-central/tools/lint/eslint/node_modules/.bin/eslint' | \ let gb:syntastic_javascript_eslint_args = ['--plugin', 'html']| \ let gb:syntastic_filetype_map = { 'html': 'javascript' }
After you've added this to your configuration (and have installed Vundle, if necessary), launch Vim and run:
44
edits

Navigation menu