Ale: `:ALEFix` does not work in macOS catalina 10.15

Created on 9 Oct 2019  路  9Comments  路  Source: dense-analysis/ale

Information

VIM version

VIM - Vi IMproved 8.1 (2018 May 18, compiled Oct  9 2019 18:08:26)
macOS version
Included patches: 1-2102 

Operating System: macOS catalina 10.15

What went wrong

Everything was ok before I update macOS.

After I updated macOS and brew install macvim --HEAD, :ALEFix does not work.

Reproducing the bug

  1. brew install macvim --HEAD
  2. gvim ./path/to/file.ts
  3. run :ALEFix and there is no effect
  4. use command line to run tslint (e.g. ./node_modules/.bin/tslint -c ./tslint.json --fix ./src/pages/correct/components/ClassSubjectSelect/ClassSubjectSelect.comp.ts) will make effect

:ALEInfo

 Current Filetype: typescript
Available Linters: ['eslint', 'tslint', 'tsserver', 'typecheck', 'xo']
  Enabled Linters: ['tslint', 'tsserver']
 Suggested Fixers: 
  'eslint' - Apply eslint --fix to a file.
  'prettier' - Apply prettier to a file.
  '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.
  'tslint' - Fix typescript files with tslint --fix.
  'xo' - Fix JavaScript/TypeScript files using xo --fix.
 Linter Variables:

let g:ale_typescript_tslint_config_path = ''
let g:ale_typescript_tslint_executable = 'tslint'
let g:ale_typescript_tslint_ignore_empty_files = 0
let g:ale_typescript_tslint_rules_dir = ''
let g:ale_typescript_tslint_use_global = 0
let g:ale_typescript_tsserver_config_path = ''
let g:ale_typescript_tsserver_executable = 'tsserver'
let g:ale_typescript_tsserver_use_global = 0
 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 = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = 5
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 = 1
let g:ale_fixers = {'c': ['clang-format'], 'typescript': ['tslint', 'prettier'], 'markdown': ['textlint', 'prettier'], 'scss': ['prettier'], 'json': ['prettier'], 'javascript': ['eslint', 'prettier'], 'html': ['prettier'], 'less': ['prettier'], 'css': ['prettier'], 'vue': ['eslint', 'prettier']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 1
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 = 'never'
let g:ale_linter_aliases = {}
let g:ale_linters = {'shell': ['shellcheck', 'language_server'], 'c': [], 'typescript': ['tslint', 'tsserver'], 'markdown': ['textlint', 'remark-lint'], 'vue': ['eslint, vls'], 'java': [], 'javascript': ['eslint'], 'cpp': []}
let g:ale_linters_explicit = 0
let g:ale_list_vertical = 0
let g:ale_list_window_size = 3
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 = 5
let g:ale_maximum_file_size = 1048576
let g:ale_open_list = 1
let g:ale_pattern_options = {'\.min\.css$': {'ale_enabled': 0}, 'dist\/': {'ale_enabled': 0}, '\.min\.js$': {'ale_enabled': 0}}
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 1
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 = 1
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 - success) /Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/tslint
(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/Users/fuyg/workspace/gitlab/hw-web/src/pages/correct/components/ClassSubjectSelect'' && ''/Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/tslint'' --format json -c ''/Users/fuyg/workspace/gitlab/hw-web/tslint.json'' ''/var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/3/ClassSubjectSelect.comp.ts''']

<<<OUTPUT STARTS>>>
[]
<<<OUTPUT ENDS>>>

(executable check - success) /Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/tsserver
(started) ['/bin/bash', '-c', '''/Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/tsserver''']
(finished - exit code 1) ['/bin/bash', '-c', '''/Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/tslint'' -c ''/Users/fuyg/workspace/gitlab/hw-web/tslint.json'' --fix ''/var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/4/ClassSubjectSelect.comp.ts''']
(finished - exit code 0) ['/bin/bash', '-c', '''/Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/prettier'' --version']

<<<OUTPUT STARTS>>>
1.14.2
<<<OUTPUT ENDS>>>

(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/Users/fuyg/workspace/gitlab/hw-web/src/pages/correct/components/ClassSubjectSelect'' && ''/Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/prettier'' --stdin-filepath ''/Users/fuyg/workspace/gitlab/hw-web/src/pages/correct/components/ClassSubjectSelect/ClassSubjectSelect.comp.ts'' --stdin < ''/var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/5/ClassSubjectSelect.comp.ts''']
(finished - exit code 2) ['/bin/bash', '-c', 'cd ''/Users/fuyg/workspace/gitlab/hw-web/src/pages/correct/components/ClassSubjectSelect'' && ''/Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/tslint'' --format json -c ''/Users/fuyg/workspace/gitlab/hw-web/tslint.json'' ''/var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/6/ClassSubjectSelect.comp.ts''']

<<<OUTPUT STARTS>>>
[{"endPosition":{"character":65,"line":7,"position":166},"failure":"Import sources within a group must be alphabetized.","fix":[{"innerStart":55,"innerLength":448,"innerText":"import { ClassInSchool } from '@/common/server/classes.interface'\nimport Subject from '@/common/server/Subject'\nimport { nameCompare } from '@/common/utils/compare'\nimport { SUBJECT_ALL } from '@/common/utils/subjects'\nimport Vue from 'vue'\nimport Component /*, { mixins } */ from 'vue-class-component'\nimport { Prop /*, Ref, Watch */ } from 'vue-property-decorator'\nimport { namespace } from 'vuex-class'\nimport { CLASS_SELECT_ALL } from './util'\n"}],"name":"../../../../../../../../../../var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/6/ClassSubjectSelect.comp.ts","ruleName":"ordered-imports","ruleSeverity":"ERROR","startPosition":{"character":0,"line":7,"position":101}}]
<<<OUTPUT ENDS>>>

(started) ['/bin/bash', '-c', 'cd ''/Users/fuyg/workspace/gitlab/hw-web/src/pages/correct/components/ClassSubjectSelect'' && ''/Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/tslint'' --format json -c ''/Users/fuyg/workspace/gitlab/hw-web/tslint.json'' ''/var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/7/ClassSubjectSelect.comp.ts''']
(finished - exit code 2) ['/bin/bash', '-c', 'cd ''/Users/fuyg/workspace/gitlab/hw-web/src/pages/correct/components/ClassSubjectSelect'' && ''/Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/tslint'' --format json -c ''/Users/fuyg/workspace/gitlab/hw-web/tslint.json'' ''/var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/8/ClassSubjectSelect.comp.ts''']

<<<OUTPUT STARTS>>>
[{"endPosition":{"character":3,"line":6,"position":61},"failure":"trailing whitespace","fix":{"innerStart":60,"innerLength":1,"innerText":""},"name":"../../../../../../../../../../var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/8/ClassSubjectSelect.comp.ts","ruleName":"no-trailing-whitespace","ruleSeverity":"ERROR","startPosition":{"character":2,"line":6,"position":60}},{"endPosition":{"character":65,"line":12,"position":217},"failure":"Import sources within a group must be alphabetized.","fix":[{"innerStart":106,"innerLength":448,"innerText":"import { ClassInSchool } from '@/common/server/classes.interface'\nimport Subject from '@/common/server/Subject'\nimport { nameCompare } from '@/common/utils/compare'\nimport { SUBJECT_ALL } from '@/common/utils/subjects'\nimport Vue from 'vue'\nimport Component /*, { mixins } */ from 'vue-class-component'\nimport { Prop /*, Ref, Watch */ } from 'vue-property-decorator'\nimport { namespace } from 'vuex-class'\nimport { CLASS_SELECT_ALL } from './util'\n"}],"name":"../../../../../../../../../../var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/8/ClassSubjectSelect.comp.ts","ruleName":"ordered-imports","ruleSeverity":"ERROR","startPosition":{"character":0,"line":12,"position":152}}]
<<<OUTPUT ENDS>>>

(finished - exit code 1) ['/bin/bash', '-c', '''/Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/tslint'' -c ''/Users/fuyg/workspace/gitlab/hw-web/tslint.json'' --fix ''/var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/9/ClassSubjectSelect.comp.ts''']
(finished - exit code 0) ['/bin/bash', '-c', 'cd ''/Users/fuyg/workspace/gitlab/hw-web/src/pages/correct/components/ClassSubjectSelect'' && ''/Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/prettier'' --stdin-filepath ''/Users/fuyg/workspace/gitlab/hw-web/src/pages/correct/components/ClassSubjectSelect/ClassSubjectSelect.comp.ts'' --stdin < ''/var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/10/ClassSubjectSelect.comp.ts''']
(finished - exit code 2) ['/bin/bash', '-c', 'cd ''/Users/fuyg/workspace/gitlab/hw-web/src/pages/correct/components/ClassSubjectSelect'' && ''/Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/tslint'' --format json -c ''/Users/fuyg/workspace/gitlab/hw-web/tslint.json'' ''/var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/11/ClassSubjectSelect.comp.ts''']

<<<OUTPUT STARTS>>>
[{"endPosition":{"character":65,"line":7,"position":162},"failure":"Import sources within a group must be alphabetized.","fix":[{"innerStart":51,"innerLength":448,"innerText":"import { ClassInSchool } from '@/common/server/classes.interface'\nimport Subject from '@/common/server/Subject'\nimport { nameCompare } from '@/common/utils/compare'\nimport { SUBJECT_ALL } from '@/common/utils/subjects'\nimport Vue from 'vue'\nimport Component /*, { mixins } */ from 'vue-class-component'\nimport { Prop /*, Ref, Watch */ } from 'vue-property-decorator'\nimport { namespace } from 'vuex-class'\nimport { CLASS_SELECT_ALL } from './util'\n"}],"name":"../../../../../../../../../../var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/11/ClassSubjectSelect.comp.ts","ruleName":"ordered-imports","ruleSeverity":"ERROR","startPosition":{"character":0,"line":7,"position":97}}]
<<<OUTPUT ENDS>>>

Most helpful comment

If this is a TSLint issue, I'll close this. I recommend switching to ESLint, with the ESLint typescript plugin, as TSLint will soon be deprecated and replaced with ESLint and that plugin.

All 9 comments

I won't be able to test this myself, as I don't have a Mac OSX device. Maybe someone who does can have a look.

(finished - exit code 1) ['/bin/bash', '-c', '''/Users/fuyg/workspace/gitlab/hw-web/node_modules/.bin/tslint'' -c ''/Users/fuyg/workspace/gitlab/hw-web/tslint.json'' --fix ''/var/folders/c_/jvycjs2d66xgx0w9wb34w50m0000gn/T/vjluGQz/9/ClassSubjectSelect.comp.ts''']

:ALEFix run tslint with --fix and exit code is 1, but there is no more information about the exit.

Is there a way to log the all output of the bash commands which are run by :ALEFix?

Did some investigating just now to get the command output from ALE for this situation and here's what I got:

['/usr/local/bin/zsh', '-c', '''tslint'' -c ''/Users/dhleong/git/shougun/tslint.json'' --fix ''/var/folders/9q/s674cplx7qv122xbwcchw3jm0000gn/T/vEeQL2Q/201/composite.ts''']: 

['{ Error: ENOENT: no such file or directory, open ''../../../../../../var/folders/9q/s674cplx7qv122xbwcchw3jm0000gn/T/vEeQL2Q/201/composite.ts''',
 '    at Object.fs.openSync (fs.js:559:3)',
 '    at Object.fs.writeFileSync (fs.js:1289:33)',
 '    at /Users/dhleong/.npm-packages/lib/node_modules/tslint/lib/linter.js:196:16',
 '    at Map.forEach (<anonymous>)',
 '    at Linter.applyFixes (/Users/dhleong/.npm-packages/lib/node_modules/tslint/lib/linter.js:186:21)',
 '    at _loop_1 (/Users/dhleong/.npm-packages/lib/node_modules/tslint/lib/linter.js:169:33)',
 '    at Linter.applyAllFixes (/Users/dhleong/.npm-packages/lib/node_modules/tslint/lib/linter.js:176:13)',
 '    at Linter.lint (/Users/dhleong/.npm-packages/lib/node_modules/tslint/lib/linter.js:116:33)',
 '    at /Users/dhleong/.npm-packages/lib/node_modules/tslint/lib/runner.js:216:32',

Looks like the temporary file doesn't exist

Okay, I can confirm that the tmp file exists and is readable right before ale#job#Start, at least, and the directory is gone at some point after the command exits (which you expect). Still investigating....

May be a bug in tslint? Running the command directly with that tmp file's absolute path after verifying it does indeed exist results in the same error

For what it's worth, running tslint from the tmp directory works

If this is a TSLint issue, I'll close this. I recommend switching to ESLint, with the ESLint typescript plugin, as TSLint will soon be deprecated and replaced with ESLint and that plugin.

@dhleong @w0rp Thank you

Was this page helpful?
0 / 5 - 0 ratings