-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
" Author: Filip Gospodinov <f@gospodinov.ch> | ||
" Description: biome for JavaScript files | ||
|
||
call ale#linter#Define('javascript', { | ||
\ 'name': 'biome', | ||
\ 'lsp': 'stdio', | ||
\ 'executable': function('ale#handlers#biome#GetExecutable'), | ||
\ 'command': function('ale#handlers#biome#GetCommand'), | ||
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'), | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
" Author: Filip Gospodinov <f@gospodinov.ch> | ||
" Description: biome for TypeScript files | ||
|
||
call ale#linter#Define('typescript', { | ||
\ 'name': 'biome', | ||
\ 'lsp': 'stdio', | ||
\ 'executable': function('ale#handlers#biome#GetExecutable'), | ||
\ 'command': function('ale#handlers#biome#GetCommand'), | ||
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'), | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function! ale#fixers#biome#Fix(buffer) abort | ||
let l:executable = ale#handlers#biome#GetExecutable(a:buffer) | ||
let l:options = ale#Var(a:buffer, 'biome_options') | ||
|
||
return { | ||
\ 'command': '%e format' | ||
\ . (!empty(l:options) ? ' ' . l:options : '') | ||
\ . ' --stdin-file-path=%s', | ||
\} | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
" Author: Filip Gospodinov <f@gospodinov.ch> | ||
" Description: Functions for working with biome, for checking or fixing files. | ||
|
||
call ale#Set('biome_executable', 'biome') | ||
call ale#Set('biome_use_global', get(g:, 'ale_use_global_executables', 0)) | ||
call ale#Set('biome_options', '') | ||
|
||
function! ale#handlers#biome#GetExecutable(buffer) abort | ||
return ale#path#FindExecutable(a:buffer, 'biome', [ | ||
\ 'node_modules/@biomejs/cli-linux-x64/biome', | ||
\ 'node_modules/@biomejs/cli-linux-arm64/biome', | ||
\ 'node_modules/@biomejs/cli-win32-x64/biome.exe', | ||
\ 'node_modules/@biomejs/cli-win32-arm64/biome.exe', | ||
\ 'node_modules/@biomejs/cli-darwin-x64/biome', | ||
\ 'node_modules/@biomejs/cli-darwin-arm64/biome', | ||
\ 'node_modules/.bin/biome', | ||
\]) | ||
endfunction | ||
|
||
function! ale#handlers#biome#GetCommand(buffer) abort | ||
let l:options = ale#Var(a:buffer, 'biome_options') | ||
|
||
return '%e lsp-proxy' | ||
\ . (!empty(l:options) ? ' ' . l:options : '') | ||
endfunction | ||
|
||
function! ale#handlers#biome#GetProjectRoot(buffer) abort | ||
let l:biome_file = ale#path#FindNearestFile(a:buffer, 'biome.json') | ||
|
||
return !empty(l:biome_file) ? fnamemodify(l:biome_file, ':h') : '' | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Before: | ||
call ale#assert#SetUpLinterTest('typescript', 'biome') | ||
call ale#test#SetFilename('test.ts') | ||
|
||
After: | ||
call ale#assert#TearDownLinterTest() | ||
|
||
Execute(The default biome command should be correct): | ||
AssertLinter 'biome', ale#Escape('biome') . 'lsp-proxy' | ||
|
||
Execute(The biome command should accept options): | ||
let b:ale_biome_options = '--foobar' | ||
|
||
AssertLinter 'biome', ale#Escape('biome') . 'lsp-proxy --foobar' |