Ale: Ale Fixers not loading for TSX files in WSL

Created on 18 Sep 2020  路  4Comments  路  Source: dense-analysis/ale

Information

VIM version


NVIM v0.4.3
Build type: Release

Operating System: Windows 10 - WSL 2

What went wrong

ALE is not detecting fixers for .tsx files in a react/typescript project I am working on in nvim in WSL2. So when I run :ALEFixSuggest I see the linters loading, and it is showing a typescriptreact filetype, but no suggested fixers.

Reproducing the bug

I am running neovim in WSL2 with tmux 3.0a. I setup a react-typescript project using the template from npx create-react-app my-app --template typescript. Let me know if there is any more information I can provide. Thank you!

:ALEInfo

Current Filetype: typescriptreact
Available Linters: ['eslint', 'standard', 'tslint', 'tsserver', 'typecheck', 'xo']
Enabled Linters: ['eslint', 'standard', 'tslint', 'tsserver', 'typecheck', 'xo']
Ignored Linters: []
Suggested Fixers:
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
Linter Variables:

Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = 100
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = 50
let g:ale_disable_lsp = 0
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {'reason': ['refmt'], 'elixir': ['mix_format'], 'typescript': ['prettier', 'eslint'], 'json': ['prettier', 'jq'], 'typescriptreact': ['prettier', 'eslint'], '*': ['remove_trailing_lines', 'trim_whitespace'], 'javascript': ['prettier', 'eslint'], 'sql': ['pgformatter'], 'css': ['prettier']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {'reason': ['reason'], 'elixir': ['elixir-ls', 'credo'], 'rust': ['rls'], 'javascript': ['eslint', 'tsserver']}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_lsp_root = {}
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:

(executable check - failure) standard
(executable check - failure) tslint
(executable check - failure) typecheck
(executable check - failure) xo
(finished - exit code 0) ['/usr/bin/zsh', '-c', 'cd ''/home/wfw40869/workspace/come_home_to_pa'' && ''/home/wfw40869/workspace/come_home_to_pa/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/home/wfw40869/workspace/come_home_to_pa/src/App.tsx'' < ''/tmp/nvime8gujr/47/App.tsx''']

<<>>
[{"filePath":"/home/wfw40869/workspace/come_home_to_pa/src/App.tsx","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}]
<<>>

(executable check - failure) standard
(executable check - failure) tslint
(executable check - failure) typecheck
(executable check - failure) xo
(finished - exit code 127) ['/usr/bin/zsh', '-c', '''prettier'' --version']

<<>>
zsh:1: command not found: prettier
<<>>

(finished - exit code 127) ['/usr/bin/zsh', '-c', '''prettier'' ''/tmp/nvime8gujr/50/App.tsx'' --write']
(started) ['/usr/bin/zsh', '-c', 'cd ''/home/wfw40869/workspace/come_home_to_pa'' && ''/home/wfw40869/workspace/come_home_to_pa/node_modules/eslint/bin/eslint.js'' --stdin-filename ''/home/wfw40869/workspace/come_home_to_pa/src/App.tsx'' --stdin --fix-dry-run --format=json < ''/tmp/nvime8gujr/51/App.tsx''']
(finished - exit code 127) ['/usr/bin/zsh', '-c', '''prettier'' --version']

<<>>
zsh:1: command not found: prettier
<<>>

(finished - exit code 127) ['/usr/bin/zsh', '-c', '''prettier'' ''/tmp/nvime8gujr/52/App.tsx'' --write']
(finished - exit code 0) ['/usr/bin/zsh', '-c', 'cd ''/home/wfw40869/workspace/come_home_to_pa'' && ''/home/wfw40869/workspace/come_home_to_pa/node_modules/eslint/bin/eslint.js'' --stdin-filename ''/home/wfw40869/workspace/come_home_to_pa/src/App.tsx'' --stdin --fix-dry-run --format=json < ''/tmp/nvime8gujr/53/App.tsx''']
(finished - exit code 0) ['/usr/bin/zsh', '-c', 'cd ''/home/wfw40869/workspace/come_home_to_pa'' && ''/home/wfw40869/workspace/come_home_to_pa/node_modules/eslint/bin/eslint.js'' -f json --stdin --stdin-filename ''/home/wfw40869/workspace/come_home_to_pa/src/App.tsx'' < ''/tmp/nvime8gujr/60/App.tsx''']

<<>>
[{"filePath":"/home/wfw40869/workspace/come_home_to_pa/src/App.tsx","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}]
<<>>

(executable check - failure) standard
(executable check - failure) tslint
(executable check - failure) typecheck
(executable check - failure) xo

bug

Most helpful comment

I am a new ALE user, so I only have used it with Ubuntu 20 and I could not successfully follow the FAQ directions on working with jsx files. I had to use 'javascriptreact' instead of 'jsx' in my vimrc for it to work. I found 'javascriptreact' under 'Current FileType' in ALEInfo.

Perhaps you need to use 'typescriptreact' instead of 'tsx' within your vimrc since this is what is under your 'Current FileType'?

All 4 comments

This is happening for me as well after upgrading from Ubunto 18.04 to 20.04.

Does anybody happen to have any workarounds in the meantime?
(When I get desperate, I change the file extension to .jsx, then save again just to get the auto-formatting done, then change the file extension back to .tsx 馃槄 ).

I am a new ALE user, so I only have used it with Ubuntu 20 and I could not successfully follow the FAQ directions on working with jsx files. I had to use 'javascriptreact' instead of 'jsx' in my vimrc for it to work. I found 'javascriptreact' under 'Current FileType' in ALEInfo.

Perhaps you need to use 'typescriptreact' instead of 'tsx' within your vimrc since this is what is under your 'Current FileType'?

Thank you @DomPSU! That fixed it for me 馃憦

Was this page helpful?
0 / 5 - 0 ratings