-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] check JavaScript code with
biome
tool (#6711)
* lint js code * hotfix * Update .editorconfig Co-authored-by: James Lamb <[email protected]> --------- Co-authored-by: James Lamb <[email protected]>
- Loading branch information
1 parent
92aa07b
commit 13f2e92
Showing
10 changed files
with
81 additions
and
42 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,5 @@ | ||
#!/bin/bash | ||
|
||
set -e -E -u -o pipefail | ||
|
||
biome ci --config-path=./biome.json --diagnostic-level=info --error-on-warnings ./ |
File renamed without changes.
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,22 +1,19 @@ | ||
root = true | ||
|
||
[*] | ||
charset=utf-8 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.{py,sh,js,ps1}] | ||
[*.{py,sh,ps1,js,json}] | ||
indent_size = 4 | ||
line_length = 120 | ||
max_line_length = 120 | ||
skip = external_libs | ||
known_first_party = lightgbm | ||
|
||
# Placeholder files | ||
[{*.gitkeep,__init__.py}] | ||
insert_final_newline = none | ||
|
||
# Tabs matter for Makefile and .gitmodules | ||
[{makefile*,Makefile*,*.mk,*.mak,*.makefile,*.Makefile,GNUmakefile,BSDmakefile,make.bat,Makevars*,*.gitmodules}] | ||
indent_style = tab |
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,21 @@ | ||
{ | ||
"files": { | ||
"ignore": [".mypy_cache/"] | ||
}, | ||
"formatter": { | ||
"enabled": true, | ||
"useEditorconfig": true | ||
}, | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"all": true | ||
} | ||
}, | ||
"javascript": { | ||
"globals": ["$"] | ||
} | ||
} |
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,56 +1,69 @@ | ||
$(function() { | ||
$(() => { | ||
/* Use wider container for the page content */ | ||
$('.wy-nav-content').each(function() { this.style.setProperty('max-width', 'none', 'important'); }); | ||
$(".wy-nav-content").each(function () { | ||
this.style.setProperty("max-width", "none", "important"); | ||
}); | ||
|
||
/* List each class property item on a new line | ||
https://github.com/microsoft/LightGBM/issues/5073 */ | ||
if(window.location.pathname.toLocaleLowerCase().indexOf('pythonapi') !== -1) { | ||
$('.py.property').each(function() { this.style.setProperty('display', 'inline', 'important'); }); | ||
if (window.location.pathname.toLocaleLowerCase().indexOf("pythonapi") !== -1) { | ||
$(".py.property").each(function () { | ||
this.style.setProperty("display", "inline", "important"); | ||
}); | ||
} | ||
|
||
/* Collapse specified sections in the installation guide */ | ||
if(window.location.pathname.toLocaleLowerCase().indexOf('installation-guide') !== -1) { | ||
$('<style>.closed, .opened {cursor: pointer;} .closed:before, .opened:before {font-family: FontAwesome; display: inline-block; padding-right: 6px;} .closed:before {content: "\\f078";} .opened:before {content: "\\f077";}</style>').appendTo('body'); | ||
var collapsable = [ | ||
'#build-threadless-version-not-recommended', | ||
'#build-mpi-version', | ||
'#build-gpu-version', | ||
'#build-cuda-version', | ||
'#build-java-wrapper', | ||
'#build-c-unit-tests' | ||
if (window.location.pathname.toLocaleLowerCase().indexOf("installation-guide") !== -1) { | ||
$( | ||
'<style>.closed, .opened {cursor: pointer;} .closed:before, .opened:before {font-family: FontAwesome; display: inline-block; padding-right: 6px;} .closed:before {content: "\\f078";} .opened:before {content: "\\f077";}</style>', | ||
).appendTo("body"); | ||
const collapsable = [ | ||
"#build-threadless-version-not-recommended", | ||
"#build-mpi-version", | ||
"#build-gpu-version", | ||
"#build-cuda-version", | ||
"#build-java-wrapper", | ||
"#build-c-unit-tests", | ||
]; | ||
$.each(collapsable, function(_, val) { | ||
var header = val + ' > :header:first'; | ||
var content = val + ' :not(:header:first)'; | ||
$(header).addClass('closed'); | ||
$.each(collapsable, (_, val) => { | ||
const header = `${val} > :header:first`; | ||
const content = `${val} :not(:header:first)`; | ||
$(header).addClass("closed"); | ||
$(content).hide(); | ||
$(header).click(function() { | ||
$(header).toggleClass('closed opened'); | ||
$(header).click(() => { | ||
$(header).toggleClass("closed opened"); | ||
$(content).slideToggle(0); | ||
}); | ||
}); | ||
/* Uncollapse parent sections when nested section is specified in the URL or before navigate to it from navbar */ | ||
function uncollapse(section) { | ||
section.parents().each((_, val) => { $(val).children('.closed').click(); }); | ||
section.parents().each((_, val) => { | ||
$(val).children(".closed").click(); | ||
}); | ||
} | ||
uncollapse($(window.location.hash)); | ||
$('.wy-menu.wy-menu-vertical li a.reference.internal').click(function() { | ||
uncollapse($($(this).attr('href'))); | ||
$(".wy-menu.wy-menu-vertical li a.reference.internal").click(function () { | ||
uncollapse($($(this).attr("href"))); | ||
}); | ||
|
||
/* Modify src and href attrs of artifacts badge */ | ||
function modifyBadge(src, href) { | ||
$('img[alt="download artifacts"]').each(function() { | ||
$('img[alt="download artifacts"]').each(function () { | ||
this.src = src; | ||
this.parentNode.href = href; | ||
}); | ||
} | ||
/* Initialize artifacts badge */ | ||
modifyBadge('./_static/images/artifacts-fetching.svg', '#'); | ||
modifyBadge("./_static/images/artifacts-fetching.svg", "#"); | ||
/* Fetch latest buildId and construct artifacts badge */ | ||
$.getJSON('https://dev.azure.com/lightgbm-ci/lightgbm-ci/_apis/build/builds?branchName=refs/heads/master&resultFilter=succeeded&queryOrder=finishTimeDescending&%24top=1&api-version=7.1-preview.7', function(data) { | ||
modifyBadge('./_static/images/artifacts-download.svg', | ||
'https://dev.azure.com/lightgbm-ci/lightgbm-ci/_apis/build/builds/' + data['value'][0]['id'] + '/artifacts?artifactName=PackageAssets&api-version=7.1-preview.5&%24format=zip'); | ||
}); | ||
$.getJSON( | ||
"https://dev.azure.com/lightgbm-ci/lightgbm-ci/_apis/build/builds?branchName=refs/heads/master&resultFilter=succeeded&queryOrder=finishTimeDescending&%24top=1&api-version=7.1-preview.7", | ||
(data) => { | ||
modifyBadge( | ||
"./_static/images/artifacts-download.svg", | ||
`https://dev.azure.com/lightgbm-ci/lightgbm-ci/_apis/build/builds/${data.value[0].id}/artifacts?artifactName=PackageAssets&api-version=7.1-preview.5&%24format=zip`, | ||
); | ||
}, | ||
); | ||
} | ||
}); |
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,6 +1,6 @@ | ||
{ | ||
"feature": 25, | ||
"threshold": 1.30, | ||
"threshold": 1.3, | ||
"left": { | ||
"feature": 26, | ||
"threshold": 0.85 | ||
|
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,10 +1,10 @@ | ||
[ | ||
{ | ||
"feature": 0, | ||
"bin_upper_bound": [ 0.3, 0.35, 0.4 ] | ||
"bin_upper_bound": [0.3, 0.35, 0.4] | ||
}, | ||
{ | ||
"feature": 1, | ||
"bin_upper_bound": [ -0.1, -0.15, -0.2 ] | ||
"bin_upper_bound": [-0.1, -0.15, -0.2] | ||
} | ||
] |
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,6 +1,6 @@ | ||
[ | ||
{ | ||
"feature": 0, | ||
"bin_upper_bound": [ 0.19, 0.39, 0.59, 0.79 ] | ||
"bin_upper_bound": [0.19, 0.39, 0.59, 0.79] | ||
} | ||
] |
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