summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Pesce <jpesce@gmail.com>2021-08-20 22:02:56 -0300
committerGitHub <noreply@github.com>2021-08-21 10:02:56 +0900
commitf896744feec260fb196d38bba23308080c04192c (patch)
tree49c40ea65ab3aca714289fdf9c09681241e97012
parenta099fe24b2e898c93c0aa4391e5a5631932684a6 (diff)
downloadale-f896744feec260fb196d38bba23308080c04192c.zip
Close #3872 - Add eslint-plugin-jsonc as a linter for JSON, JSONC and JSON5 (#3873)
* Add eslint as linter for JSON, JSONC and JSON5 Use the same lint configuration as eslint for javascript. * Add documentation for JSON* eslint support * Fix spacing in documentation * Update docs to be unopinionated about plugins Remove any preference for eslint plugins, since there are more thant one that would work * Reorder languages and tools in alphabetic order * Fix misalignment * Change orders to pass the tests
-rw-r--r--ale_linters/json/eslint.vim16
-rw-r--r--ale_linters/json5/eslint.vim16
-rw-r--r--ale_linters/jsonc/eslint.vim16
-rw-r--r--doc/ale-json.txt9
-rw-r--r--doc/ale-json5.txt15
-rw-r--r--doc/ale-jsonc.txt15
-rw-r--r--doc/ale-supported-languages-and-tools.txt5
-rw-r--r--doc/ale.txt5
-rw-r--r--supported-tools.md5
9 files changed, 102 insertions, 0 deletions
diff --git a/ale_linters/json/eslint.vim b/ale_linters/json/eslint.vim
new file mode 100644
index 00000000..bdabb9fa
--- /dev/null
+++ b/ale_linters/json/eslint.vim
@@ -0,0 +1,16 @@
+" Author: João Pesce <joao@pesce.cc>
+" Description: eslint for JSON files.
+"
+" Requires eslint-plugin-jsonc or a similar plugin to work
+"
+" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp
+" <devw0rp@gmail.com>
+
+call ale#linter#Define('json', {
+\ 'name': 'eslint',
+\ 'output_stream': 'both',
+\ 'executable': function('ale#handlers#eslint#GetExecutable'),
+\ 'cwd': function('ale#handlers#eslint#GetCwd'),
+\ 'command': function('ale#handlers#eslint#GetCommand'),
+\ 'callback': 'ale#handlers#eslint#HandleJSON',
+\})
diff --git a/ale_linters/json5/eslint.vim b/ale_linters/json5/eslint.vim
new file mode 100644
index 00000000..6207f2d7
--- /dev/null
+++ b/ale_linters/json5/eslint.vim
@@ -0,0 +1,16 @@
+" Author: João Pesce <joao@pesce.cc>
+" Description: eslint for JSON5 files.
+"
+" Requires eslint-plugin-jsonc or a similar plugin to work
+"
+" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp
+" <devw0rp@gmail.com>
+
+call ale#linter#Define('json5', {
+\ 'name': 'eslint',
+\ 'output_stream': 'both',
+\ 'executable': function('ale#handlers#eslint#GetExecutable'),
+\ 'cwd': function('ale#handlers#eslint#GetCwd'),
+\ 'command': function('ale#handlers#eslint#GetCommand'),
+\ 'callback': 'ale#handlers#eslint#HandleJSON',
+\})
diff --git a/ale_linters/jsonc/eslint.vim b/ale_linters/jsonc/eslint.vim
new file mode 100644
index 00000000..1a5cc528
--- /dev/null
+++ b/ale_linters/jsonc/eslint.vim
@@ -0,0 +1,16 @@
+" Author: João Pesce <joao@pesce.cc>
+" Description: eslint for JSONC files.
+"
+" Requires eslint-plugin-jsonc or a similar plugin to work
+"
+" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp
+" <devw0rp@gmail.com>
+
+call ale#linter#Define('jsonc', {
+\ 'name': 'eslint',
+\ 'output_stream': 'both',
+\ 'executable': function('ale#handlers#eslint#GetExecutable'),
+\ 'cwd': function('ale#handlers#eslint#GetCwd'),
+\ 'command': function('ale#handlers#eslint#GetCommand'),
+\ 'callback': 'ale#handlers#eslint#HandleJSON',
+\})
diff --git a/doc/ale-json.txt b/doc/ale-json.txt
index dc91e14c..ad0a05b1 100644
--- a/doc/ale-json.txt
+++ b/doc/ale-json.txt
@@ -3,6 +3,15 @@ ALE JSON Integration *ale-json-options*
===============================================================================
+eslint *ale-json-eslint*
+
+The `eslint` linter for JSON uses the JavaScript options for `eslint`; see:
+|ale-javascript-eslint|.
+
+You will need a JSON ESLint plugin installed for this to work.
+
+
+===============================================================================
fixjson *ale-json-fixjson*
fixjson is a JSON file fixer/formatter for humans using (relaxed) JSON5.
diff --git a/doc/ale-json5.txt b/doc/ale-json5.txt
new file mode 100644
index 00000000..bafa60d1
--- /dev/null
+++ b/doc/ale-json5.txt
@@ -0,0 +1,15 @@
+===============================================================================
+ALE JSON5 Integration *ale-json5-options*
+
+
+===============================================================================
+eslint *ale-json5-eslint*
+
+The `eslint` linter for JSON uses the JavaScript options for `eslint`; see:
+|ale-javascript-eslint|.
+
+You will need a JSON5 ESLint plugin installed for this to work.
+
+
+===============================================================================
+ vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-jsonc.txt b/doc/ale-jsonc.txt
new file mode 100644
index 00000000..92247cd4
--- /dev/null
+++ b/doc/ale-jsonc.txt
@@ -0,0 +1,15 @@
+===============================================================================
+ALE JSONC Integration *ale-jsonc-options*
+
+
+===============================================================================
+eslint *ale-jsonc-eslint*
+
+The `eslint` linter for JSON uses the JavaScript options for `eslint`; see:
+|ale-javascript-eslint|.
+
+You will need a JSONC ESLint plugin installed for this to work.
+
+
+===============================================================================
+ 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 0247a743..db67b593 100644
--- a/doc/ale-supported-languages-and-tools.txt
+++ b/doc/ale-supported-languages-and-tools.txt
@@ -260,11 +260,16 @@ Notes:
* `tsserver`
* `xo`
* JSON
+ * `eslint`
* `fixjson`
* `jq`
* `jsonlint`
* `prettier`
* `spectral`
+* JSON5
+ * `eslint`
+* JSONC
+ * `eslint`
* Julia
* `languageserver`
* Kotlin
diff --git a/doc/ale.txt b/doc/ale.txt
index 85646dd9..c2a1b01e 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -2824,11 +2824,16 @@ documented in additional help files.
standard..............................|ale-javascript-standard|
xo....................................|ale-javascript-xo|
json....................................|ale-json-options|
+ eslint................................|ale-json-eslint|
fixjson...............................|ale-json-fixjson|
jsonlint..............................|ale-json-jsonlint|
jq....................................|ale-json-jq|
prettier..............................|ale-json-prettier|
spectral..............................|ale-json-spectral|
+ jsonc...................................|ale-jsonc-options|
+ eslint................................|ale-jsonc-eslint|
+ json5...................................|ale-json5-options|
+ eslint................................|ale-json5-eslint|
julia...................................|ale-julia-options|
languageserver........................|ale-julia-languageserver|
kotlin..................................|ale-kotlin-options|
diff --git a/supported-tools.md b/supported-tools.md
index ff75c5ad..b8db6ffb 100644
--- a/supported-tools.md
+++ b/supported-tools.md
@@ -269,11 +269,16 @@ formatting.
* [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29)
* [xo](https://github.com/sindresorhus/xo)
* JSON
+ * [eslint](http://eslint.org/)
* [fixjson](https://github.com/rhysd/fixjson)
* [jq](https://stedolan.github.io/jq/)
* [jsonlint](https://github.com/zaach/jsonlint)
* [prettier](https://github.com/prettier/prettier)
* [spectral](https://github.com/stoplightio/spectral)
+* JSON5
+ * [eslint](http://eslint.org/)
+* JSONC
+ * [eslint](http://eslint.org/)
* Julia
* [languageserver](https://github.com/JuliaEditorSupport/LanguageServer.jl)
* Kotlin