All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 # Asynchronous Lint Engine
3 [](https://www.vim.org/) [](https://neovim.io/) [](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [](https://ci.appveyor.com/project/dense-analysis/ale) [](https://discord.gg/5zFD6pQxDk)
5 
7 ALE (Asynchronous Lint Engine) is a plugin providing linting (syntax checking
8 and semantic errors) in Neovim 0.7.0+ and Vim 8.0+ while you edit your text files,
9 and acts as a Vim [Language Server Protocol](https://langserver.org/) client.
11 <video autoplay="true" muted="true" loop="true" controls="false" src="https://user-images.githubusercontent.com/3518142/210141215-8f2ff760-6a87-4704-a11e-c109b8e9ec41.mp4" title="An example showing what ALE can do."></video>
13 ALE makes use of Neovim and Vim 8 job control functions and timers to
14 run linters on the contents of text buffers and return errors as
15 text is changed in Vim. This allows for displaying warnings and
16 errors in files being edited in Vim before files have been saved
19 In other words, this plugin allows you to lint while you type.
21 ALE offers support for fixing code with command line tools in a non-blocking
22 manner with the `:ALEFix` feature, supporting tools in many languages, like
23 `prettier`, `eslint`, `autopep8`, and more.
25 ALE acts as a "language client" to support a variety of Language Server Protocol
28 * Diagnostics (via Language Server Protocol linters)
29 * Go To Definition (`:ALEGoToDefinition`)
30 * Completion (Built in completion support, or with Deoplete)
31 * Finding references (`:ALEFindReferences`)
32 * Hover information (`:ALEHover`)
33 * Symbol search (`:ALESymbolSearch`)
35 If you don't care about Language Server Protocol, ALE won't load any of the code
36 for working with it unless needed. One of ALE's general missions is that you
37 won't pay for the features that you don't use.
39 **Help Wanted:** If you would like to help maintain this plugin by managing the
40 many issues and pull requests that are submitted, please send the author an
41 email at [dev@w0rp.com](mailto:dev@w0rp.com?subject=Helping%20with%20ALE).
43 If you enjoy this plugin, feel free to contribute or check out the author's
44 other content at [w0rp.com](https://w0rp.com).
48 ALE has been around for many years, and there are many ways to run asynchronous
49 linting and fixing of code in Vim. ALE offers the following.
51 * No dependencies for ALE itself
52 * Lightweight plugin architecture (No JavaScript or Python required)
53 * Low memory footprint
54 * Runs virtually everywhere, including remote shells, and in `git commit`
55 * Out of the box support for running particular linters and language servers
56 * Near-zero configuration with custom code for better defaults
57 * Highly customizable and well-documented (`:help ale-options`)
58 * Breaking changes for the plugin are extremely rare
59 * Integrates with Neovim's LSP client (0.8+) and diagnostics (0.7+)
60 * Support for older Vim and Neovim versions
62 * Well-integrated with other plugins
64 ## Supported Languages and Tools
66 ALE supports a wide variety of languages and tools. See the
67 [full list](supported-tools.md) in the
68 [Supported Languages and Tools](supported-tools.md) page.
72 <a name="usage-linting"></a>
76 Once this plugin is installed, while editing your files in supported
77 languages and tools which have been correctly installed,
78 this plugin will send the contents of your text buffers to a variety of
79 programs for checking the syntax and semantics of your programs. By default,
80 linters will be re-run in the background to check your syntax when you open
81 new buffers or as you make edits to your files.
83 The behavior of linting can be configured with a variety of options,
84 documented in [the Vim help file](doc/ale.txt). For more information on the
85 options ALE offers, consult `:help ale-options` for global options and `:help
86 ale-integration-options` for options specified to particular linters.
88 <a name="usage-fixing"></a>
92 ALE can fix files with the `ALEFix` command. Functions need to be configured
93 either in each buffer with a `b:ale_fixers`, or globally with `g:ale_fixers`.
95 The recommended way to configure fixers is to define a List in an ftplugin file.
98 " In ~/.vim/ftplugin/javascript.vim, or somewhere similar.
100 " Fix files with prettier, and then ESLint.
101 let b:ale_fixers = ['prettier', 'eslint']
102 " Equivalent to the above.
103 let b:ale_fixers = {'javascript': ['prettier', 'eslint']}
106 You can also configure your fixers from vimrc using `g:ale_fixers`, before or
107 after ALE has been loaded.
109 A `*` in place of the filetype will apply a List of fixers to all files which
110 do not match some filetype in the Dictionary.
112 Note that using a plain List for `g:ale_fixers` is not supported.
115 " In ~/.vim/vimrc, or somewhere similar.
117 \ '*': ['remove_trailing_lines', 'trim_whitespace'],
118 \ 'javascript': ['eslint'],
122 If you want to automatically fix files when you save them, you need to turn
123 a setting on in vimrc.
126 " Set this variable to 1 to fix files when you save them.
127 let g:ale_fix_on_save = 1
130 The `:ALEFixSuggest` command will suggest some supported tools for fixing code.
131 Both `g:ale_fixers` and `b:ale_fixers` can also accept functions, including
132 lambda functions, as fixers, for fixing files with custom tools.
134 See `:help ale-fix` for complete information on how to fix files with ALE.
136 <a name="usage-completion"></a>
140 ALE offers some support for completion via hijacking of omnicompletion while you
141 type. All of ALE's completion information must come from Language Server
142 Protocol linters, or from `tsserver` for TypeScript.
144 When running ALE in Neovim 0.8+, ALE will integrate with Neovim's LSP client by
145 default, and any auto-completion plugin that uses the native LSP client will
146 work when ALE runs language servers.
147 [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) is recommended as a
148 completion plugin worth trying in Neovim.
150 ALE integrates with [Deoplete](https://github.com/Shougo/deoplete.nvim) as a
151 completion source, named `'ale'`. You can configure Deoplete to only use ALE as
152 the source of completion information, or mix it with other sources.
155 " Use ALE and also some plugin 'foobar' as completion sources for all code.
156 call deoplete#custom#option('sources', {
157 \ '_': ['ale', 'foobar'],
161 ALE also offers its own automatic completion support, which does not require any
162 other plugins, and can be enabled by changing a setting before ALE is loaded.
165 " Enable completion where available.
166 " This setting must be set before ALE is loaded.
168 " You should not turn this setting on if you wish to use ALE as a completion
169 " source for other completion plugins, like Deoplete.
170 let g:ale_completion_enabled = 1
173 ALE provides an omni-completion function you can use for triggering
174 completion manually with `<C-x><C-o>`.
177 set omnifunc=ale#completion#OmniFunc
180 ALE supports automatic imports from external modules. This behavior is enabled
181 by default and can be disabled by setting:
184 let g:ale_completion_autoimport = 0
187 Note that disabling auto import can result in missing completion items from some
188 LSP servers (e.g. eclipselsp). See `:help ale-completion` for more information.
190 <a name="usage-go-to-definition"></a>
194 ALE supports jumping to the definition of words under your cursor with the
195 `:ALEGoToDefinition` command using any enabled Language Server Protocol linters
196 and `tsserver`. In Neovim 0.8+, you can also use Neovim's built in `gd` keybind
199 See `:help ale-go-to-definition` for more information.
201 <a name="usage-find-references"></a>
205 ALE supports finding references for words under your cursor with the
206 `:ALEFindReferences` command using any enabled Language Server Protocol linters
209 See `:help ale-find-references` for more information.
211 <a name="usage-hover"></a>
215 ALE supports "hover" information for printing brief information about symbols at
216 the cursor taken from Language Server Protocol linters and `tsserver` with the
219 Truncated information will be displayed when the cursor rests on a symbol by
220 default, as long as there are no problems on the same line.
222 The information can be displayed in a `balloon` tooltip in Vim or GVim by
223 hovering your mouse over symbols. Mouse hovering is enabled by default in GVim,
224 and needs to be configured for Vim 8.1+ in terminals.
226 See `:help ale-hover` for more information.
228 <a name="usage-symbol-search"></a>
232 ALE supports searching for workspace symbols via Language Server Protocol
233 linters with the `ALESymbolSearch` command.
235 Search queries can be performed to find functions, types, and more which are
236 similar to a given query string.
238 See `:help ale-symbol-search` for more information.
240 <a name="usage-refactoring"></a>
242 ### Refactoring: Rename, Actions
244 ALE supports renaming symbols in code such as variables or class
245 names with the `ALERename` command.
247 `ALEFileRename` will rename file and fix import paths (tsserver
250 `ALECodeAction` will execute actions on the cursor or applied to a visual
251 range selection, such as automatically fixing errors.
253 See `:help ale-refactor` for more information.
257 Add ALE to your runtime path in the usual ways.
259 If you have trouble reading `:help ale`, try the following.
262 packloadall | silent! helptags ALL
268 mkdir -p ~/.vim/pack/git-plugins/start
269 git clone --depth 1 https://github.com/dense-analysis/ale.git ~/.vim/pack/git-plugins/start/ale
272 #### Neovim `packload`:
275 mkdir -p ~/.local/share/nvim/site/pack/git-plugins/start
276 git clone --depth 1 https://github.com/dense-analysis/ale.git ~/.local/share/nvim/site/pack/git-plugins/start/ale
279 #### Windows `packload`:
282 # Run these commands in the "Git for Windows" Bash terminal
283 mkdir -p ~/vimfiles/pack/git-plugins/start
284 git clone --depth 1 https://github.com/dense-analysis/ale.git ~/vimfiles/pack/git-plugins/start/ale
287 #### [vim-plug](https://github.com/junegunn/vim-plug)
290 Plug 'dense-analysis/ale'
293 #### [Vundle](https://github.com/VundleVim/Vundle.vim)
296 Plugin 'dense-analysis/ale'
299 #### [Pathogen](https://github.com/tpope/vim-pathogen)
301 git clone https://github.com/dense-analysis/ale ~/.vim/bundle/ale
304 #### [lazy.nvim](https://github.com/folke/lazy.nvim)
307 'dense-analysis/ale',
309 -- Configuration goes here.
312 g.ale_ruby_rubocop_auto_correct_all = 1
315 ruby = {'rubocop', 'ruby'},
316 lua = {'lua_language_server'}
324 If you would like to see support for more languages and tools, please
325 [create an issue](https://github.com/dense-analysis/ale/issues)
326 or [create a pull request](https://github.com/dense-analysis/ale/pulls).
327 If your tool can read from stdin or you have code to suggest which is good,
328 support can be happily added for it.
330 If you are interested in the general direction of the project, check out the
331 [wiki home page](https://github.com/dense-analysis/ale/wiki). The wiki includes
332 a Roadmap for the future, and more.
334 If you'd liked to discuss ALE and more check out the Dense Analysis Discord
335 server here: https://discord.gg/5zFD6pQxDk
339 <a name="faq-disable-linters"></a>
341 ### How do I disable particular linters?
343 By default, all available tools for all supported languages will be run. If you
344 want to only select a subset of the tools, you can define `b:ale_linters` for a
345 single buffer, or `g:ale_linters` globally.
347 The recommended way to configure linters is to define a List in an ftplugin
351 " In ~/.vim/ftplugin/javascript.vim, or somewhere similar.
353 " Enable ESLint only for JavaScript.
354 let b:ale_linters = ['eslint']
356 " Equivalent to the above.
357 let b:ale_linters = {'javascript': ['eslint']}
360 You can also declare which linters you want to run in your vimrc file, before or
361 after ALE has been loaded.
364 " In ~/.vim/vimrc, or somewhere similar.
365 let g:ale_linters = {
366 \ 'javascript': ['eslint'],
370 For all languages unspecified in the dictionary, all possible linters will
371 be run for those languages, just as when the dictionary is not defined.
372 Running many linters should not typically obstruct editing in Vim,
373 as they will all be executed in separate processes simultaneously.
375 If you don't want ALE to run anything other than what you've explicitly asked
376 for, you can set `g:ale_linters_explicit` to `1`.
379 " Only run linters named in ale_linters settings.
380 let g:ale_linters_explicit = 1
383 This plugin will look for linters in the [`ale_linters`](ale_linters) directory.
384 Each directory within corresponds to a particular filetype in Vim, and each file
385 in each directory corresponds to the name of a particular linter.
387 ### How do I disable a particular warning or error?
389 Warnings and errors should be configured in project configuration files for the
390 relevant tools. ALE supports disabling only warnings relating to trailing
391 whitespace, which Vim users often fix automatically.
394 " Disable whitespace warnings
395 let g:ale_warn_about_trailing_whitespace = 0
398 Users generally should not ignore warnings or errors in projects by changing
399 settings in their own editor. Instead, configure tools appropriately so any
400 other user of the same project will see the same problems.
402 <a name="faq-get-info"></a>
404 ### How can I see what ALE has configured for the current file?
406 Run the following to see what is currently configured:
412 ### How can I disable virtual text appearing at ends of lines?
414 By default, ALE displays errors and warnings with virtual text. The problems ALE
415 shows appear with comment-like syntax after every problem found. You can set ALE
416 to only show problems where the cursor currently lies like so.
419 let g:ale_virtualtext_cursor = 'current'
422 If you want to disable virtual text completely, apply the following.
425 let g:ale_virtualtext_cursor = 'disabled'
428 <a name="faq-keep-signs"></a>
429 <a name="faq-change-signs"></a>
431 ### How can I customise signs?
433 Use these options to specify what text should be used for signs:
436 let g:ale_sign_error = '>>'
437 let g:ale_sign_warning = '--'
440 ALE sets some background colors automatically for warnings and errors
441 in the sign gutter, with the names `ALEErrorSign` and `ALEWarningSign`.
442 These colors can be customised, or even removed completely:
445 highlight clear ALEErrorSign
446 highlight clear ALEWarningSign
449 You can configure the sign gutter open at all times, if you wish.
452 let g:ale_sign_column_always = 1
455 <a name="faq-change-highlights"></a>
457 ### How can I change or disable the highlights ALE uses?
459 ALE's highlights problems with highlight groups which link to `SpellBad`,
460 `SpellCap`, `error`, and `todo` groups by default. The characters that are
461 highlighted depend on the linters being used, and the information provided to
464 Highlighting can be disabled completely by setting `g:ale_set_highlights` to
468 " Set this in your vimrc file to disabling highlighting
469 let g:ale_set_highlights = 0
472 You can control all of the highlights ALE uses, say if you are using a different
473 color scheme which produces ugly highlights. For example:
476 highlight ALEWarning ctermbg=DarkMagenta
479 See `:help ale-highlights` for more information.
481 <a name="faq-echo-format"></a>
483 ### How can I change the format for echo messages?
485 There are 3 global options that allow customizing the echoed message.
487 - `g:ale_echo_msg_format` where:
488 * `%s` is the error message itself
489 * `%...code...%` is an optional error code, and most characters can be
490 written between the `%` characters.
491 * `%linter%` is the linter name
492 * `%severity%` is the severity type
493 - `g:ale_echo_msg_error_str` is the string used for error severity.
494 - `g:ale_echo_msg_warning_str` is the string used for warning severity.
499 let g:ale_echo_msg_error_str = 'E'
500 let g:ale_echo_msg_warning_str = 'W'
501 let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
506 
508 See `:help g:ale_echo_msg_format` for more information.
510 <a name="faq-statusline"></a>
511 <a name="faq-lightline"></a>
513 ### How can I customise the statusline?
517 [lightline](https://github.com/itchyny/lightline.vim) does not have built-in
518 support for ALE, nevertheless there is a plugin that adds this functionality:
519 [maximbaz/lightline-ale](https://github.com/maximbaz/lightline-ale).
521 For more information, check out the sources of that plugin,
522 `:help ale#statusline#Count()` and
523 [lightline documentation](https://github.com/itchyny/lightline.vim#advanced-configuration).
527 [vim-airline](https://github.com/vim-airline/vim-airline) integrates with ALE
528 for displaying error information in the status bar. If you want to see the
529 status for ALE in a nice format, it is recommended to use vim-airline with ALE.
530 The airline extension can be enabled by adding the following to your vimrc:
533 " Set this. Airline will handle the rest.
534 let g:airline#extensions#ale#enabled = 1
537 #### Custom statusline
539 You can implement your own statusline function without adding any other plugins.
540 ALE provides some functions to assist in this endeavour, including:
542 * `ale#statusline#Count`: Which returns the number of problems found by ALE
543 for a specified buffer.
544 * `ale#statusline#FirstProblem`: Which returns a dictionary containing the
545 full loclist details of the first problem of a specified type found by ALE
546 in a buffer. (e.g. The first style warning in the current buffer.)
547 This can be useful for displaying more detailed information such as the
548 line number of the first problem in a file.
550 Say you want to display all errors as one figure, and all non-errors as another
551 figure. You can do the following:
554 function! LinterStatus() abort
555 let l:counts = ale#statusline#Count(bufnr(''))
557 let l:all_errors = l:counts.error + l:counts.style_error
558 let l:all_non_errors = l:counts.total - l:all_errors
560 return l:counts.total == 0 ? 'OK' : printf(
567 set statusline=%{LinterStatus()}
570 See `:help ale#statusline#Count()` or `:help ale#statusline#FirstProblem()`
571 for more information.
573 <a name="faq-window-borders"></a>
575 ### How can I change the borders for floating preview windows?
577 Borders for floating preview windows are enabled by default. You can use the
578 `g:ale_floating_window_border` setting to configure them.
580 You could disable the border with an empty list.
583 let g:ale_floating_window_border = []
586 If the terminal supports Unicode, you might try setting the value like below, to
590 let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰', '│', '─']
593 Since vim's default uses nice Unicode characters when possible, you can trick
594 ale into using that default with
597 let g:ale_floating_window_border = repeat([''], 8)
600 <a name="faq-my-battery-is-sad"></a>
602 ### Will this plugin eat all of my laptop battery power?
604 ALE takes advantage of the power of various tools to check your code. This of
605 course means that CPU time will be used to continuously check your code. If you
606 are concerned about the CPU time ALE will spend, which will of course imply
607 some cost to battery life, you can adjust your settings to make your CPU do
610 First, consider increasing the delay before which ALE will run any linters
611 while you type. ALE uses a timeout which is cancelled and reset every time you
612 type, and this delay can be increased so linters are run less often. See
613 `:help g:ale_lint_delay` for more information.
615 If you don't wish to run linters while you type, you can disable that behavior.
616 Set `g:ale_lint_on_text_changed` to `never`. You won't get as frequent error
617 checking, but ALE shouldn't block your ability to edit a document after you save
618 a file, so the asynchronous nature of the plugin will still be an advantage.
620 If you are still concerned, you can turn the automatic linting off altogether,
621 including the option `g:ale_lint_on_enter`, and you can run ALE manually with
624 <a name="faq-coc-nvim"></a>
625 <a name="faq-vim-lsp"></a>
627 ### How can I use ALE with other LSP clients?
629 ALE offers an API for letting any other plugin integrate with ALE. If you are
630 interested in writing an integration, see `:help ale-lint-other-sources`.
632 If you're running ALE in Neovim with
633 [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) for configuring
634 particular language servers, ALE will automatically disable its LSP
635 functionality for any language servers configured with nvim-lspconfig by
636 default. The following setting is applied by default:
639 let g:ale_disable_lsp = 'auto'
642 If you are running ALE in combination with another LSP client, you may wish to
643 disable ALE's LSP functionality entirely. You can change the setting to `1` to
644 always disable all LSP functionality.
647 let g:ale_disable_lsp = 1
650 You can also use `b:ale_disable_lsp` in your ftplugin files to enable or disable
651 LSP features in ALE for different filetypes.
653 #### Neovim Diagnostics
655 If you are running Neovim 0.7 or later, you can make ALE display errors and
656 warnings via the Neovim diagnostics API.
659 let g:ale_use_neovim_diagnostics_api = 1
662 <!-- We could expand this section to say a little more. -->
666 [coc.nvim](https://github.com/neoclide/coc.nvim) is a popular Vim plugin written
667 in TypeScript and dependent on the [npm](https://www.npmjs.com/) ecosystem for
668 providing full IDE features to Vim. Both ALE and coc.nvim implement
669 [Language Server Protocol](https://microsoft.github.io/language-server-protocol/)
670 (LSP) clients for supporting diagnostics (linting with a live server), and other
671 features like auto-completion, and others listed above.
673 ALE is primarily focused on integrating with external programs through virtually
674 any means, provided the plugin remains almost entirely written in Vim script.
675 coc.nvim is primarily focused on bringing IDE features to Vim. If you want to
676 run external programs on your files to check for errors, and also use the most
677 advanced IDE features, you might want to use both plugins at the same time.
679 The easiest way to get both plugins to work together is to configure coc.nvim to
680 send diagnostics to ALE, so ALE controls how all problems are presented to you,
681 and to disable all LSP features in ALE, so ALE doesn't try to provide LSP
682 features already provided by coc.nvim, such as auto-completion.
684 Open your coc.nvim configuration file with `:CocConfig` and add
685 `"diagnostic.displayByAle": true` to your settings.
689 [vim-lsp](https://github.com/prabirshrestha/vim-lsp) is a popular plugin as
690 implementation of Language Server Protocol (LSP) client for Vim. It provides
691 all the LSP features including auto completion, diagnostics, go to definitions,
694 [vim-lsp-ale](https://github.com/rhysd/vim-lsp-ale) is a bridge plugin to solve
695 the problem when using both ALE and vim-lsp. With the plugin, diagnostics are
696 provided by vim-lsp and ALE can handle all the errors. Please read
697 [vim-lsp-ale's documentation](https://github.com/rhysd/vim-lsp-ale/blob/master/doc/vim-lsp-ale.txt)
700 <a name="faq-autocmd"></a>
702 ### How can I execute some code when ALE starts or stops linting?
704 ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
705 events when a lint or fix cycle are started and stopped. There is also an event
706 that runs when a linter job has been successfully started. These events can be
707 used to call arbitrary functions during these respective parts of the ALE's
713 autocmd User ALELintPre call YourFunction()
714 autocmd User ALELintPost call YourFunction()
716 autocmd User ALEJobStarted call YourFunction()
718 autocmd User ALEFixPre call YourFunction()
719 autocmd User ALEFixPost call YourFunction()
723 <a name="faq-navigation"></a>
725 ### How can I navigate between errors quickly?
727 ALE offers some commands with `<Plug>` keybinds for moving between warnings and
728 errors quickly. You can map the keys Ctrl+j and Ctrl+k to moving between errors
732 nmap <silent> <C-k> <Plug>(ale_previous_wrap)
733 nmap <silent> <C-j> <Plug>(ale_next_wrap)
736 For more information, consult the online documentation with
737 `:help ale-navigation-commands`.
739 <a name="faq-lint-on-save"></a>
741 ### How can I run linters only when I save files?
743 ALE offers an option `g:ale_lint_on_save` for enabling running the linters when
744 files are saved. This option is enabled by default. If you only wish to run
745 linters when files are saved, you can turn the other options off.
748 " Write this in your vimrc file
749 let g:ale_lint_on_text_changed = 'never'
750 let g:ale_lint_on_insert_leave = 0
751 " You can disable this option too
752 " if you don't want linters to run on opening a file
753 let g:ale_lint_on_enter = 0
756 If for whatever reason you don't wish to run linters again when you save files,
757 you can set `g:ale_lint_on_save` to `0`.
759 <a name="faq-quickfix"></a>
761 ### How can I use the quickfix list instead of the loclist?
763 The quickfix list can be enabled by turning the `g:ale_set_quickfix` option on.
764 If you wish to also disable the loclist, you can disable the `g:ale_set_loclist`
768 " Write this in your vimrc file
769 let g:ale_set_loclist = 0
770 let g:ale_set_quickfix = 1
773 If you wish to show Vim windows for the loclist or quickfix items when a file
774 contains warnings or errors, `g:ale_open_list` can be set to `1`.
775 `g:ale_keep_list_window_open` can be set to `1` if you wish to keep the window
776 open even after errors disappear.
779 let g:ale_open_list = 1
780 " Set this if you want to.
781 " This can be useful if you are combining ALE with
782 " some other plugin which sets quickfix errors, etc.
783 let g:ale_keep_list_window_open = 1
786 You can also set `let g:ale_list_vertical = 1` to open the windows vertically
787 instead of the default horizontally.
789 ### Why isn't ALE checking my filetype?
791 <a name="faq-jsx-stylelint-eslint"></a>
793 #### stylelint for JSX
795 First, install eslint and install stylelint with
796 [stylelint-processor-styled-components](https://github.com/styled-components/stylelint-processor-styled-components).
798 Supposing you have installed both tools correctly, configure your .jsx files so
799 `jsx` is included in the filetype. You can use an `autocmd` for this.
802 augroup FiletypeGroup
804 au BufNewFile,BufRead *.jsx set filetype=javascript.jsx
808 Supposing the filetype has been set correctly, you can set the following
809 options in a jsx.vim ftplugin file.
812 " In ~/.vim/ftplugin/jsx.vim, or somewhere similar.
813 let b:ale_linter_aliases = ['css', 'javascript']
814 let b:ale_linters = ['stylelint', 'eslint']
817 Or if you want, you can configure the linters from your vimrc file.
820 " In ~/.vim/vimrc, or somewhere similar.
821 let g:ale_linter_aliases = {'jsx': ['css', 'javascript']}
822 let g:ale_linters = {'jsx': ['stylelint', 'eslint']}
825 ALE will alias the `jsx` filetype so it uses the `css` filetype linters, and
826 use the original Array of selected linters for `jsx` from the `g:ale_linters`
827 object. All available linters will be used for the filetype `javascript`, and
828 no linter will be run twice for the same file.
830 <a name="faq-vue-eslint"></a>
832 #### Checking Vue with ESLint
834 To check Vue files with ESLint, your ESLint project configuration file must be
835 configured to use the [Vue plugin](https://github.com/vuejs/eslint-plugin-vue).
836 After that, you need to configure ALE so it will run the JavaScript ESLint
837 linter on your files. The settings you need are similar to the settings needed
838 for checking JSX code with both stylelint and ESLint, in the previous section.
841 " In ~/.vim/ftplugin/vue.vim, or somewhere similar.
843 " Run both javascript and vue linters for vue files.
844 let b:ale_linter_aliases = ['javascript', 'vue']
845 " Select the eslint and vls linters.
846 let b:ale_linters = ['eslint', 'vls']
849 Run `:ALEInfo` to see which linters are available after telling ALE to run
850 JavaScript linters on Vue files. Not all linters support checking Vue files.
852 If you don't want to configure your linters in ftplugin files for some reason,
853 you can configure them from your vimrc file instead.
856 " In ~/.vim/vimrc, or somewhere similar.
857 let g:ale_linter_aliases = {'vue': ['vue', 'javascript']}
858 let g:ale_linters = {'vue': ['eslint', 'vls']}
861 <a name="faq-c-configuration"></a>
863 ### How can I configure my C or C++ project?
865 The structure of C and C++ projects varies wildly from project to project, with
866 many different build tools being used for building them, and many different
867 formats for project configuration files. ALE can run compilers easily, but
868 ALE cannot easily detect which compiler flags to use.
870 Some tools and build configurations can generate
871 [compile_commands.json](https://clang.llvm.org/docs/JSONCompilationDatabase.html)
872 files. The `cppcheck`, `clangcheck`, `clangtidy` and `cquery` linters can read
873 these files for automatically determining the appropriate compiler flags to
876 For linting with compilers like `gcc` and `clang`, and with other tools, you
877 will need to tell ALE which compiler flags to use yourself. You can use
878 different options for different projects with the `g:ale_pattern_options`
879 setting. Consult the documentation for that setting for more information.
880 `b:ale_linters` can be used to select which tools you want to run, say if you
881 want to use only `gcc` for one project, and only `clang` for another.
883 ALE will attempt to parse `compile_commands.json` files to discover compiler
884 flags to use when linting code. See `:help g:ale_c_parse_compile_commands` for
885 more information. See Clang's documentation for
886 [compile_commands.json files](https://clang.llvm.org/docs/JSONCompilationDatabase.html).
887 You should strongly consider generating them in your builds, which is easy to do
890 You can also configure ALE to automatically run `make -n` to run dry runs on
891 `Makefile`s to discover compiler flags. This can execute arbitrary code, so the
892 option is disabled by default. See `:help g:ale_c_parse_makefile`.
894 <a name="faq-vm"></a>
896 ### How can I run linters or fixers via Docker or a VM?
898 ALE supports running linters or fixers via Docker, virtual machines, or in
899 combination with any remote machine with a different file system, so long as the
900 tools are well-integrated with ALE, and ALE is properly configured to run the
901 correct commands and map filename paths between different file systems. See
902 `:help ale-lint-other-machines` for the full documentation on how to configure