-
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.
* Revert "Add biome support for javascript (#4701)" This reverts commit 8922478. * Add support for biome
- Loading branch information
Showing
12 changed files
with
91 additions
and
79 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 |
---|---|---|
@@ -1,17 +1,10 @@ | ||
" Author: Akiomi Kamakura <akiomik@gmail.com> | ||
" 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') | ||
let l:options = ale#Var(a:buffer, 'biome_options') | ||
|
||
return { | ||
\ 'command': (has('win32') ? (ale#Escape(l:node) . ' ') : '') | ||
\ . ale#Escape(l:executable) | ||
\ . ' check --apply' | ||
\ . ale#Pad(l:options) | ||
\ . ' %t', | ||
\ 'read_temporary_file': 1, | ||
\ '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 |
---|---|---|
@@ -1,14 +1,31 @@ | ||
" Author: Akiomi Kamakura <akiomik@gmail.com> | ||
" Description: Functions for working with biome, for fixing files. | ||
" Author: Filip Gospodinov <f@gospodinov.ch> | ||
" Description: Functions for working with biome, for checking or 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', '') | ||
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, 'javascript_biome', [ | ||
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', | ||
\ 'node_modules/@biomejs/biome/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 was deleted.
Oops, something went wrong.
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' |
Empty file.
Empty file.