diff options
author | Braden Kelley <redbmk@gmail.com> | 2024-07-08 17:41:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-09 09:41:17 +0900 |
commit | 5c635d5038b9faae88a432d7f2f1b93ef3cf44f3 (patch) | |
tree | 62a86ee8d5ac97b2d87950d446be844ceb4697ee | |
parent | 3220b94d2053e8051023fc6f79c00651071b1440 (diff) | |
download | ale-5c635d5038b9faae88a432d7f2f1b93ef3cf44f3.zip |
feat(biome): add support for json and jsonc (#4805)
- adds biome linter for json and jsonc
- enables biome by default for json and jsonc
- suggests biome as a fixer for json and jsonc
-rw-r--r-- | ale_linters/json/biome.vim | 10 | ||||
-rw-r--r-- | ale_linters/jsonc/biome.vim | 10 | ||||
-rw-r--r-- | autoload/ale/fix/registry.vim | 2 | ||||
-rw-r--r-- | autoload/ale/linter.vim | 4 | ||||
-rw-r--r-- | doc/ale-json.txt | 6 | ||||
-rw-r--r-- | doc/ale-jsonc.txt | 6 | ||||
-rw-r--r-- | doc/ale-supported-languages-and-tools.txt | 2 | ||||
-rw-r--r-- | doc/ale.txt | 2 | ||||
-rw-r--r-- | supported-tools.md | 2 | ||||
-rw-r--r-- | test/test_filetype_linter_defaults.vader | 4 |
10 files changed, 43 insertions, 5 deletions
diff --git a/ale_linters/json/biome.vim b/ale_linters/json/biome.vim new file mode 100644 index 00000000..086ee44a --- /dev/null +++ b/ale_linters/json/biome.vim @@ -0,0 +1,10 @@ +" Description: biome for json files + +call ale#linter#Define('json', { +\ 'name': 'biome', +\ 'lsp': 'stdio', +\ 'language': function('ale#handlers#biome#GetLanguage'), +\ 'executable': function('ale#handlers#biome#GetExecutable'), +\ 'command': '%e lsp-proxy', +\ 'project_root': function('ale#handlers#biome#GetProjectRoot'), +\}) diff --git a/ale_linters/jsonc/biome.vim b/ale_linters/jsonc/biome.vim new file mode 100644 index 00000000..5a691093 --- /dev/null +++ b/ale_linters/jsonc/biome.vim @@ -0,0 +1,10 @@ +" Description: biome for jsonc files + +call ale#linter#Define('jsonc', { +\ 'name': 'biome', +\ 'lsp': 'stdio', +\ 'language': function('ale#handlers#biome#GetLanguage'), +\ 'executable': function('ale#handlers#biome#GetExecutable'), +\ 'command': '%e lsp-proxy', +\ 'project_root': function('ale#handlers#biome#GetProjectRoot'), +\}) diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index b8829a5e..38a87153 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -39,7 +39,7 @@ let s:default_registry = { \ }, \ 'biome': { \ 'function': 'ale#fixers#biome#Fix', -\ 'suggested_filetypes': ['javascript', 'typescript'], +\ 'suggested_filetypes': ['javascript', 'typescript', 'json', 'jsonc'], \ 'description': 'Fix JavaScript and TypeScript using biome.', \ }, \ 'black': { diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim index 3cfd8ead..fb30fb11 100644 --- a/autoload/ale/linter.vim +++ b/autoload/ale/linter.vim @@ -47,9 +47,9 @@ let s:default_ale_linters = { \ 'hack': ['hack'], \ 'help': [], \ 'inko': ['inko'], -\ 'json': ['jsonlint', 'spectral', 'vscodejson'], +\ 'json': ['biome', 'jsonlint', 'spectral', 'vscodejson'], \ 'json5': [], -\ 'jsonc': [], +\ 'jsonc': ['biome'], \ 'perl': ['perlcritic'], \ 'perl6': [], \ 'python': ['flake8', 'mypy', 'pylint', 'pyright', 'ruff'], diff --git a/doc/ale-json.txt b/doc/ale-json.txt index 7b240373..8822a697 100644 --- a/doc/ale-json.txt +++ b/doc/ale-json.txt @@ -3,6 +3,12 @@ ALE JSON Integration *ale-json-options* =============================================================================== +biome *ale-json-biome* + +Check the docs over at |ale-typescript-biome|. + + +=============================================================================== clang-format *ale-json-clangformat* See |ale-c-clangformat| for information about the available options. diff --git a/doc/ale-jsonc.txt b/doc/ale-jsonc.txt index 92247cd4..b05fa6e6 100644 --- a/doc/ale-jsonc.txt +++ b/doc/ale-jsonc.txt @@ -3,6 +3,12 @@ ALE JSONC Integration *ale-jsonc-options* =============================================================================== +biome *ale-jsonc-biome* + +Check the docs over at |ale-typescript-biome|. + + +=============================================================================== eslint *ale-jsonc-eslint* The `eslint` linter for JSON uses the JavaScript options for `eslint`; see: diff --git a/doc/ale-supported-languages-and-tools.txt b/doc/ale-supported-languages-and-tools.txt index 505cac86..37cc8335 100644 --- a/doc/ale-supported-languages-and-tools.txt +++ b/doc/ale-supported-languages-and-tools.txt @@ -314,6 +314,7 @@ Notes: * `xo` * JSON * `VSCode JSON language server` + * `biome` * `clang-format` * `cspell` * `dprint` @@ -326,6 +327,7 @@ Notes: * JSON5 * `eslint` * JSONC + * `biome` * `eslint` * Jsonnet * `jsonnet-lint` diff --git a/doc/ale.txt b/doc/ale.txt index c7ed1a44..e235e44c 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -3137,6 +3137,7 @@ documented in additional help files. standard..............................|ale-javascript-standard| xo....................................|ale-javascript-xo| json....................................|ale-json-options| + biome.................................|ale-json-biome| clang-format..........................|ale-json-clangformat| cspell................................|ale-json-cspell| dprint................................|ale-json-dprint| @@ -3148,6 +3149,7 @@ documented in additional help files. spectral..............................|ale-json-spectral| vscodejson............................|ale-json-vscode| jsonc...................................|ale-jsonc-options| + biome.................................|ale-jsonc-biome| eslint................................|ale-jsonc-eslint| jsonnet.................................|ale-jsonnet-options| jsonnetfmt............................|ale-jsonnet-jsonnetfmt| diff --git a/supported-tools.md b/supported-tools.md index 3d687614..fee80d23 100644 --- a/supported-tools.md +++ b/supported-tools.md @@ -323,6 +323,7 @@ formatting. * [xo](https://github.com/sindresorhus/xo) * JSON * [VSCode JSON language server](https://github.com/hrsh7th/vscode-langservers-extracted) + * [biome](https://biomejs.dev/) * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning: * [dprint](https://dprint.dev) @@ -335,6 +336,7 @@ formatting. * JSON5 * [eslint](http://eslint.org/) :warning: * JSONC + * [biome](https://biomejs.dev/) * [eslint](http://eslint.org/) :warning: * Jsonnet * [jsonnet-lint](https://jsonnet.org/learning/tools.html) diff --git a/test/test_filetype_linter_defaults.vader b/test/test_filetype_linter_defaults.vader index b4b6380d..69d83d84 100644 --- a/test/test_filetype_linter_defaults.vader +++ b/test/test_filetype_linter_defaults.vader @@ -60,7 +60,7 @@ Execute(The defaults for the inko filetype should be correct): AssertEqual [], GetLinterNames('inko') Execute(The defaults for the json filetype should be correct): - AssertEqual ['jsonlint', 'spectral', 'vscodejson'], GetLinterNames('json') + AssertEqual ['biome', 'jsonlint', 'spectral', 'vscodejson'], GetLinterNames('json') let g:ale_linters_explicit = 1 @@ -70,7 +70,7 @@ 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') + AssertEqual ['biome'], GetLinterNames('jsonc') Execute(The defaults for the perl filetype should be correct): AssertEqual ['perlcritic'], GetLinterNames('perl') |