forked from dense-analysis/ale
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add biome support for javascript (dense-analysis#4701)
- Loading branch information
Showing
11 changed files
with
105 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
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,17 @@ | ||
" Author: Akiomi Kamakura <[email protected]> | ||
" Description: Fixing files with biome (ex.rome). | ||
|
||
function! ale#fixers#biome#Fix(buffer) abort | ||
let l:executable = ale#handlers#biome#GetExecutable(a:buffer) | ||
let l:options = ale#Var(a:buffer, 'javascript_biome_options') | ||
let l:node = ale#Var(a:buffer, 'javascript_biome_node_executable') | ||
|
||
return { | ||
\ 'command': (has('win32') ? (ale#Escape(l:node) . ' ') : '') | ||
\ . ale#Escape(l:executable) | ||
\ . ' check --apply' | ||
\ . ale#Pad(l:options) | ||
\ . ' %t', | ||
\ 'read_temporary_file': 1, | ||
\} | ||
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,14 @@ | ||
" Author: Akiomi Kamakura <[email protected]> | ||
" Description: Functions for working with biome, for fixing files. | ||
|
||
call ale#Set('javascript_biome_node_executable', 'node.exe') | ||
call ale#Set('javascript_biome_executable', 'biome') | ||
call ale#Set('javascript_biome_use_global', get(g:, 'ale_use_global_executables', 0)) | ||
call ale#Set('javascript_biome_options', '') | ||
|
||
function! ale#handlers#biome#GetExecutable(buffer) abort | ||
return ale#path#FindExecutable(a:buffer, 'javascript_biome', [ | ||
\ 'node_modules/.bin/biome', | ||
\ 'node_modules/@biomejs/biome/bin/biome', | ||
\]) | ||
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,30 @@ | ||
Before: | ||
call ale#assert#SetUpFixerTest('javascript', 'biome') | ||
runtime autoload/ale/handlers/biome.vim | ||
set filetype=javascript | ||
|
||
After: | ||
call ale#assert#TearDownFixerTest() | ||
|
||
Execute(The biome callback should return the correct default values): | ||
call ale#test#SetFilename('../test-files/biome/src/test.js') | ||
|
||
AssertFixer | ||
\ { | ||
\ 'read_temporary_file': 1, | ||
\ 'command': (has('win32') ? 'node.exe ' : '') | ||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/biome/node_modules/.bin/biome')) | ||
\ . ' check --apply %t', | ||
\ } | ||
|
||
Execute(The biome callback should include custom biome options): | ||
let b:ale_javascript_biome_options = '--organize-imports-enabled=true' | ||
call ale#test#SetFilename('../test-files/biome/src/test.js') | ||
|
||
AssertFixer | ||
\ { | ||
\ 'read_temporary_file': 1, | ||
\ 'command': (has('win32') ? 'node.exe ' : '') | ||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/biome/node_modules/.bin/biome')) | ||
\ . ' check --apply --organize-imports-enabled=true %t', | ||
\ } |
Empty file.
Empty file.