Skip to content

Commit

Permalink
feat(biome): add support for json and jsonc
Browse files Browse the repository at this point in the history
- adds biome linter for json and jsonc
- enables biome by default for json and jsonc
- suggests biome as a fixer for json and jsonc
  • Loading branch information
redbmk committed Jul 8, 2024
1 parent 3220b94 commit 5ce5f37
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 3 deletions.
10 changes: 10 additions & 0 deletions ale_linters/json/biome.vim
Original file line number Diff line number Diff line change
@@ -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'),
\})
10 changes: 10 additions & 0 deletions ale_linters/jsonc/biome.vim
Original file line number Diff line number Diff line change
@@ -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'),
\})
2 changes: 1 addition & 1 deletion autoload/ale/fix/registry.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
4 changes: 2 additions & 2 deletions autoload/ale/linter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
6 changes: 6 additions & 0 deletions doc/ale-json.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
ALE JSON Integration *ale-json-options*


===============================================================================
biome *ale-json-biome*

Check the docs over at |ale-typescript-biome|.


===============================================================================
clang-format *ale-json-clangformat*

Expand Down
6 changes: 6 additions & 0 deletions doc/ale-jsonc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
ALE JSONC Integration *ale-jsonc-options*


===============================================================================
biome *ale-jsonc-biome*

Check the docs over at |ale-typescript-biome|.


===============================================================================
eslint *ale-jsonc-eslint*

Expand Down
2 changes: 2 additions & 0 deletions doc/ale-supported-languages-and-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ Notes:
* `xo`
* JSON
* `VSCode JSON language server`
* `biome`
* `clang-format`
* `cspell`
* `dprint`
Expand All @@ -326,6 +327,7 @@ Notes:
* JSON5
* `eslint`
* JSONC
* `biome`
* `eslint`
* Jsonnet
* `jsonnet-lint`
Expand Down
2 changes: 2 additions & 0 deletions doc/ale.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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|
Expand Down

0 comments on commit 5ce5f37

Please sign in to comment.