CLI:
Version: 1.9.2
Color support: true
Platform:
CPU Architecture: x86_64
OS: windows
Environment:
BIOME_LOG_PATH: unset
BIOME_LOG_PREFIX_NAME: unset
BIOME_CONFIG_PATH: unset
NO_COLOR: unset
TERM: unset
JS_RUNTIME_VERSION: "v16.20.2"
JS_RUNTIME_NAME: "node"
NODE_PACKAGE_MANAGER: unset
Biome Configuration:
Status: Loaded successfully
Formatter disabled: false
Linter disabled: false
Organize imports disabled: true
VCS disabled: true
Workspace:
Open Documents: 0
"dependencies": {
"@biomejs/js-api": "^0.6.2",
"@biomejs/wasm-nodejs": "^1.8.4-nightly.d079e53",
"outdent": "^0.8.0"
}
@biomejs/[email protected]
is not compatible with @biomejs/js-api
, see #3881
When I try to lint content, and it generate incorrect span range
β English characters:
const { Biome, Distribution } = require('@biomejs/js-api')
async function main() {
const biome = await Biome.create({
distribution: Distribution.NODE
})
const input = '/** English comment */ let a = 123'
const result = biome.lintContent(input, { filePath: 'index.js' })
for (const diagnostic of result.diagnostics) {
const [start, end] = diagnostic.location.span
const span = input.slice(start, end)
console.log('start -->', start, 'end -->', end, 'span -->', span)
// start --> 23 end --> 26 span --> let
}
}
main()
β Chinese characters:
const { Biome, Distribution } = require('@biomejs/js-api')
async function main() {
const biome = await Biome.create({
distribution: Distribution.NODE
})
const input = '/** δΈζ注ι */ let a = 123'
const result = biome.lintContent(input, { filePath: 'index.js' })
for (const diagnostic of result.diagnostics) {
const [start, end] = diagnostic.location.span
const span = input.slice(start, end)
console.log('start -->', start, 'end -->', end, 'span -->', span)
// start --> 20 end --> 23 span --> 123
}
}
main()
β Japanese characters:
const { Biome, Distribution } = require('@biomejs/js-api')
async function main() {
const biome = await Biome.create({
distribution: Distribution.NODE
})
const input = '/** ζ₯ζ¬θͺ注ι */ let a = 123'
const result = biome.lintContent(input, { filePath: 'index.js' })
for (const diagnostic of result.diagnostics) {
const [start, end] = diagnostic.location.span
const span = input.slice(start, end)
console.log('start -->', start, 'end -->', end, 'span -->', span)
// start --> 23 end --> 26 span --> 3
}
}
main()
The output span is incorrect
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too