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

chauncey-garrett picture chauncey-garrett  路  3Comments

sodiumjoe picture sodiumjoe  路  4Comments

trevordmiller picture trevordmiller  路  3Comments

ilyakopy picture ilyakopy  路  4Comments

ianchanning picture ianchanning  路  3Comments