Ale: Add support for YAML fixer

Created on 21 Jul 2018  路  4Comments  路  Source: dense-analysis/ale

Name: yaml
URL: https://pypi.org/project/pyaml/

Neoformat can format YAML/YML files using pyaml. I would much rather use ALE for all my linter/fixer needs. ALE has support for yaml linters via swaglint or yamllint, but no yaml fixers (a much needed functionality when writing lots of yaml files by hand).

Most helpful comment

Here is what I did and it seems to work for me:

 let g:ale_fixers      = {
    \ "*": ['trim_whitespace', 'remove_trailing_lines'],
    \ 'javascript': ['prettier', 'eslint'],
    \ 'sh': ['shfmt'],
    \ 'yaml': ['prettier'],
    \}

As long as you have prettier installed (e.g. npm i -g prettier), that should work.

All 4 comments

FYI there is now prettier support for yaml.

Thank you @tomsvogel .
I was not aware of that one.

Since I am already using prettier for JS, I can also use prettier for yaml. Therefore, I have no need for pyaml at this time.

I am not 100% shure but i think to use prettier as yaml fixer ALE hast to be extended.

Here is what I did and it seems to work for me:

 let g:ale_fixers      = {
    \ "*": ['trim_whitespace', 'remove_trailing_lines'],
    \ 'javascript': ['prettier', 'eslint'],
    \ 'sh': ['shfmt'],
    \ 'yaml': ['prettier'],
    \}

As long as you have prettier installed (e.g. npm i -g prettier), that should work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sublee picture sublee  路  3Comments

trevordmiller picture trevordmiller  路  3Comments

kronos29296 picture kronos29296  路  4Comments

glepnir picture glepnir  路  3Comments

plexigras picture plexigras  路  3Comments