Fix 4004 - Disable eslint by default for json. (#4023)

* Fix 4004 - Disable eslint by default for json.

This PR disables, or more correctly, excludes eslint from the list of
default linters for json files.

Also fixes elixir, go, json5, and jsonc files documentation and default
linters to make them consistent.

* Fix and improve tests
This commit is contained in:
Horacio Sanson 2022-01-05 22:33:00 +09:00 committed by GitHub
parent 7b8e711877
commit 5a5029b73d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 15 deletions

View File

@ -45,13 +45,16 @@ let s:default_ale_linters = {
\ 'hack': ['hack'],
\ 'help': [],
\ 'inko': ['inko'],
\ 'json': ['jsonlint', 'spectral'],
\ 'json5': [],
\ 'jsonc': [],
\ 'perl': ['perlcritic'],
\ 'perl6': [],
\ 'python': ['flake8', 'mypy', 'pylint', 'pyright'],
\ 'rust': ['cargo', 'rls'],
\ 'spec': [],
\ 'text': [],
\ 'vue': ['eslint', 'vls'],
\ 'vue': ['vls', 'eslint'],
\ 'zsh': ['shell'],
\ 'v': ['v'],
\}

View File

@ -160,7 +160,7 @@ formatting.
* [hadolint](https://github.com/hadolint/hadolint)
* Elixir
* [credo](https://github.com/rrrene/credo)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning:
* [dialyxir](https://github.com/jeremyjh/dialyxir)
* [dogma](https://github.com/lpil/dogma) :floppy_disk:
* [elixir-ls](https://github.com/elixir-lsp/elixir-ls) :warning:
@ -198,7 +198,7 @@ formatting.
* [glslls](https://github.com/svenstaro/glsl-language-server)
* Go
* [bingo](https://github.com/saibing/bingo) :warning:
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning:
* [go build](https://golang.org/cmd/go/) :warning: :floppy_disk:
* [go mod](https://golang.org/cmd/go/) :warning: :floppy_disk:
* [go vet](https://golang.org/cmd/vet/) :floppy_disk:
@ -290,18 +290,18 @@ formatting.
* [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29)
* [xo](https://github.com/sindresorhus/xo)
* JSON
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning:
* [dprint](https://dprint.dev)
* [eslint](http://eslint.org/)
* [eslint](http://eslint.org/) :warning:
* [fixjson](https://github.com/rhysd/fixjson)
* [jq](https://stedolan.github.io/jq/)
* [jq](https://stedolan.github.io/jq/) :warning:
* [jsonlint](https://github.com/zaach/jsonlint)
* [prettier](https://github.com/prettier/prettier)
* [spectral](https://github.com/stoplightio/spectral)
* JSON5
* [eslint](http://eslint.org/)
* [eslint](http://eslint.org/) :warning:
* JSONC
* [eslint](http://eslint.org/)
* [eslint](http://eslint.org/) :warning:
* Jsonnet
* [jsonnet-lint](https://jsonnet.org/learning/tools.html)
* [jsonnetfmt](https://jsonnet.org/learning/tools.html)

View File

@ -14,6 +14,13 @@ After:
call ale#linter#Reset()
Execute(The defaults for the apkbuild filetype should be correct):
AssertEqual ['apkbuild_lint', 'secfixes_check'], GetLinterNames('apkbuild')
let g:ale_linters_explicit = 1
AssertEqual [], GetLinterNames('apkbuild')
Execute(The defaults for the csh filetype should be correct):
AssertEqual ['shell'], GetLinterNames('csh')
@ -21,6 +28,13 @@ Execute(The defaults for the csh filetype should be correct):
AssertEqual [], GetLinterNames('csh')
Execute(The defaults for the elixir filetype should be correct):
AssertEqual ['credo', 'dialyxir', 'dogma'], GetLinterNames('elixir')
let g:ale_linters_explicit = 1
AssertEqual [], GetLinterNames('elixir')
Execute(The defaults for the go filetype should be correct):
AssertEqual ['gofmt', 'golint', 'gopls', 'govet'], GetLinterNames('go')
@ -28,9 +42,46 @@ Execute(The defaults for the go filetype should be correct):
AssertEqual [], GetLinterNames('go')
Execute(The defaults for the hack filetype should be correct):
AssertEqual ['hack'], GetLinterNames('hack')
let g:ale_linters_explicit = 1
AssertEqual [], GetLinterNames('hack')
Execute(The defaults for the help filetype should be correct):
AssertEqual [], GetLinterNames('help')
Execute(The defaults for the inko filetype should be correct):
AssertEqual ['inko'], GetLinterNames('inko')
let g:ale_linters_explicit = 1
AssertEqual [], GetLinterNames('inko')
Execute(The defaults for the json filetype should be correct):
AssertEqual ['jsonlint', 'spectral'], GetLinterNames('json')
let g:ale_linters_explicit = 1
AssertEqual [], GetLinterNames('json')
Execute(The defaults for the json5 filetype should be correct):
AssertEqual [], GetLinterNames('json5')
Execute(The defaults for the jsonc filetype should be correct):
AssertEqual [], GetLinterNames('jsonc')
Execute(The defaults for the perl filetype should be correct):
AssertEqual ['perlcritic'], GetLinterNames('perl')
let g:ale_linters_explicit = 1
AssertEqual [], GetLinterNames('perl')
Execute(The defaults for the perl6 filetype should be correct):
AssertEqual [], GetLinterNames('perl6')
Execute(The defaults for the python filetype should be correct):
AssertEqual ['flake8', 'mypy', 'pylint', 'pyright'], GetLinterNames('python')
@ -51,6 +102,13 @@ Execute(The defaults for the spec filetype should be correct):
Execute(The defaults for the text filetype should be correct):
AssertEqual [], GetLinterNames('text')
Execute(The defaults for the vue filetype should be correct):
AssertEqual ['vls', 'eslint'], GetLinterNames('vue')
let g:ale_linters_explicit = 1
AssertEqual [], GetLinterNames('vue')
Execute(The defaults for the zsh filetype should be correct):
AssertEqual ['shell'], GetLinterNames('zsh')
@ -70,10 +128,3 @@ Execute(The defaults for the verilog filetype should be correct):
Execute(Default aliases for React should be defined):
AssertEqual ['javascript', 'jsx'], ale#linter#ResolveFiletype('javascriptreact')
AssertEqual ['typescript', 'tsx'], ale#linter#ResolveFiletype('typescriptreact')
Execute(The defaults for the apkbuild filetype should be correct):
AssertEqual ['apkbuild_lint', 'secfixes_check'], GetLinterNames('apkbuild')
let g:ale_linters_explicit = 1
AssertEqual [], GetLinterNames('apkbuild')