summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2022-01-05 22:33:00 +0900
committerGitHub <noreply@github.com>2022-01-05 22:33:00 +0900
commit5a5029b73d9cfb277ba84c29c2f787b88469ab0f (patch)
treef45617aae694264d915df853e8e76c799b1fe68d
parent7b8e711877449478796306be9124c1fdd690b987 (diff)
downloadale-5a5029b73d9cfb277ba84c29c2f787b88469ab0f.zip
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
-rw-r--r--autoload/ale/linter.vim5
-rw-r--r--supported-tools.md14
-rw-r--r--test/test_filetype_linter_defaults.vader65
3 files changed, 69 insertions, 15 deletions
diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim
index cbc79064..0dfb4915 100644
--- a/autoload/ale/linter.vim
+++ b/autoload/ale/linter.vim
@@ -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'],
\}
diff --git a/supported-tools.md b/supported-tools.md
index 8d3b41fb..831440d8 100644
--- a/supported-tools.md
+++ b/supported-tools.md
@@ -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)
diff --git a/test/test_filetype_linter_defaults.vader b/test/test_filetype_linter_defaults.vader
index 563a093f..7277ff00 100644
--- a/test/test_filetype_linter_defaults.vader
+++ b/test/test_filetype_linter_defaults.vader
@@ -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')