Ale gets confused between standard (https://standardjs.com/) and eslint (https://eslint.org/).
Standard is built on top of Eslint, so any Standard project also has Eslint in it. Consider a simple project:
mkdir my-project
cd my-project
npm init --yes
npm install --save-dev standard
Doing so will install both commands:
node_modules/.bin/eslintnode_modules/.bin/standardWhich enables them both linters in Ale (see :ALEInfo below):
Current Filetype: javascript
Available Linters: ['eslint', 'flow', 'jscs', 'jshint', 'standard', 'xo']
Enabled Linters: ['eslint', 'flow', 'jscs', 'jshint', 'standard', 'xo']
As a result, Ale will use eslint (which will produce an error), instead of standard.
Having standard should disable the Eslint linter.
Users could prefer either. The correct thing to do is to disable the linter you don't want.
Thanks for the quick feedback! I'd appeal for you to reconsider.
This makes Ale's support for standard not work properly by default. It would only work if you have to configure it yourself by disabling the eslint linter.
"Disabling the linter you don't want" is something that I feel is contrary to Ale's batteries-included nature, where it can adapt to reasonable setups of any project you may be using it with.
There is only one case when someone would want both of standard and eslint in a project, and that can be detected heuristically by checking if .eslintrc is available.
If there's no .eslintrc, you can assume that eslint is only present simply because it's a dependency of standard. Using eslint in that case would likely fail.
Btw, great fan of ale, I recommend it to everyone I know who uses Vim!
If you can come up with a sensible implementation with documentation, feel free to create a pull request.
some project use eslint, and others use standard.
Can't switch linter between eslint and standard automatically.
FYI I solve this like so:
autocmd FileType javascript let g:ale_linters = {
\ 'javascript': glob('.eslintrc*', '.;') != '' ? [ 'eslint', 'flow' ] : [ 'standard', 'flow' ],
\}
Note:
glob('.eslintrc*', '.;') rather than findfile('.eslintrc', '.;') since some projects will have an .eslintrc, while others an .eslintrc.js or .eslintrc.json. The glob covers all bases.'flow' if you don't need 'flow' checks.I've tried adding a .eslintignore file with **/*.js in it, but then I still get a warning
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.
Anybody know how to disable that? The above solution sounded promising, but prove to be buggy for me.
Most helpful comment
FYI I solve this like so:
Note:
glob('.eslintrc*', '.;')rather thanfindfile('.eslintrc', '.;')since some projects will have an.eslintrc, while others an.eslintrc.jsor.eslintrc.json. Theglobcovers all bases.'flow'if you don't need'flow'checks.