diff options
author | tatsuya <t2h5k0@gmail.com> | 2021-01-06 13:25:52 +0900 |
---|---|---|
committer | tatsuya <t2h5k0@gmail.com> | 2021-01-23 11:56:10 +0900 |
commit | 66b3e768db55b0c03fa34310a5c79bbd24209694 (patch) | |
tree | 0d1301fb2bfb49ce9c1bd2de3184645583d64414 | |
parent | 997dd7f8fe45030e65b418c5f46e20d808b1c5eb (diff) | |
download | ale-66b3e768db55b0c03fa34310a5c79bbd24209694.zip |
add spectral support for json
-rw-r--r-- | ale_linters/json/spectral.vim | 14 | ||||
-rw-r--r-- | doc/ale-json.txt | 32 | ||||
-rw-r--r-- | doc/ale-supported-languages-and-tools.txt | 1 | ||||
-rw-r--r-- | doc/ale.txt | 1 | ||||
-rw-r--r-- | supported-tools.md | 1 |
5 files changed, 49 insertions, 0 deletions
diff --git a/ale_linters/json/spectral.vim b/ale_linters/json/spectral.vim new file mode 100644 index 00000000..c7d56234 --- /dev/null +++ b/ale_linters/json/spectral.vim @@ -0,0 +1,14 @@ +" Author: t2h5 <https://github.com/t2h5> +" Description: Integration of Stoplight Spectral CLI with ALE. + +call ale#Set('json_spectral_executable', 'spectral') +call ale#Set('json_spectral_use_global', get(g:, 'ale_use_global_executables', 0)) + +call ale#linter#Define('json', { +\ 'name': 'spectral', +\ 'executable': {b -> ale#node#FindExecutable(b, 'json_spectral', [ +\ 'node_modules/.bin/spectral', +\ ])}, +\ 'command': '%e lint --ignore-unknown-format -q -f text %t', +\ 'callback': 'ale#handlers#spectral#HandleSpectralOutput' +\}) diff --git a/doc/ale-json.txt b/doc/ale-json.txt index 96499a04..dc91e14c 100644 --- a/doc/ale-json.txt +++ b/doc/ale-json.txt @@ -102,4 +102,36 @@ See |ale-javascript-prettier| for information about the available options. =============================================================================== +spectral *ale-json-spectral* + +Website: https://github.com/stoplightio/spectral + +Installation +------------------------------------------------------------------------------- + +Install spectral either globally or locally: > + + npm install @stoplight/spectral -g # global + npm install @stoplight/spectral # local +< + +Options +------------------------------------------------------------------------------- + +g:ale_json_spectral_executable *g:ale_json_spectral_executable* + *b:ale_json_spectral_executable* + Type: |String| + Default: `'spectral'` + + This variable can be set to change the path to spectral. + +g:ale_json_spectral_use_global *g:ale_json_spectral_use_global* + *b:ale_json_spectral_use_global* + Type: |String| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-supported-languages-and-tools.txt b/doc/ale-supported-languages-and-tools.txt index 0b864b48..ce73136f 100644 --- a/doc/ale-supported-languages-and-tools.txt +++ b/doc/ale-supported-languages-and-tools.txt @@ -248,6 +248,7 @@ Notes: * `jq` * `jsonlint` * `prettier` + * `spectral` * Julia * `languageserver` * Kotlin diff --git a/doc/ale.txt b/doc/ale.txt index f8fea05b..5cbc10c4 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -2785,6 +2785,7 @@ documented in additional help files. jsonlint..............................|ale-json-jsonlint| jq....................................|ale-json-jq| prettier..............................|ale-json-prettier| + spectral..............................|ale-json-spectral| julia...................................|ale-julia-options| languageserver........................|ale-julia-languageserver| kotlin..................................|ale-kotlin-options| diff --git a/supported-tools.md b/supported-tools.md index cf0370a9..0e1e6b29 100644 --- a/supported-tools.md +++ b/supported-tools.md @@ -257,6 +257,7 @@ formatting. * [jq](https://stedolan.github.io/jq/) * [jsonlint](http://zaa.ch/jsonlint/) * [prettier](https://github.com/prettier/prettier) + * [spectral](https://github.com/stoplightio/spectral) * Julia * [languageserver](https://github.com/JuliaEditorSupport/LanguageServer.jl) * Kotlin |