Ale: Example of passing options to linters

Created on 13 Oct 2017  路  6Comments  路  Source: dense-analysis/ale

I've read docs and searched everywhere but I can't seem to find any examples of passing options to the linter.

I'm using this in my vimrc:

let g:ale_javascript_eslint_options: {"indent": "off", "object-curly-spacing" : "off", "space-in-parens" : "off"}

but it doesn't seem to affect anything at all.
I feel like I've probably structured it incorrectly, an example would help a lot.

Most helpful comment

So I figured since ALE is passing a string to eslint, it's probably using the CLI, which would make sense as to why it needs to be a string.

Here's the example of which I was looking for.

let g:ale_javascript_eslint_options = "--rule 'indent: off' --rule 'object-curly-spacing: off' --rule 'space-in-parens: off'"

For anyone else in the future, more information can be found here.
https://eslint.org/docs/user-guide/command-line-interface#options

All 6 comments

I just realized that I had a : instead of an =. Everything seems to work now.
Adding this to the list of _"things that took me way too long to figure out for something so simple"_

Actually, I think I still need that example, as the options ALE expecting is supposed to be a string (as it says in the docs) but I'm passing a dictionary.
ALE is giving me mega errors for it.

Should I just wrap my 'dictionary' in a string?

See :help g:ale_javascript_eslint_options. The option is a string, not a dictionary. It's a string for setting additional command line arguments.

You shouldn't really be settings options in this manner. You should create a configuration file in your project instead.

I do not want to create a project specific file. I literally don't ever want to check for these options in eslint and I don't want to affect the project's or other collaborators build scripts with my local preferences.

If eslint is expecting JSON object for configs, why are we only passing a string?
What is the expected format for options for this string?

An example would be very helpful.

So I figured since ALE is passing a string to eslint, it's probably using the CLI, which would make sense as to why it needs to be a string.

Here's the example of which I was looking for.

let g:ale_javascript_eslint_options = "--rule 'indent: off' --rule 'object-curly-spacing: off' --rule 'space-in-parens: off'"

For anyone else in the future, more information can be found here.
https://eslint.org/docs/user-guide/command-line-interface#options

Cool. Thanks for the info. :+1:

Was this page helpful?
0 / 5 - 0 ratings