-
-
Notifications
You must be signed in to change notification settings - Fork 859
Labels
L-JavaScriptLanguage: JavaScript and super languagesLanguage: JavaScript and super languagesS-Help-wantedStatus: you're familiar with the code base and want to help the projectStatus: you're familiar with the code base and want to help the projectgood first issueGood for newcomersGood for newcomers
Description
Environment information
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
What happened?
"dependencies": {
"@biomejs/js-api": "^0.6.2",
"@biomejs/wasm-nodejs": "^1.8.4-nightly.d079e53",
"outdent": "^0.8.0"
}@biomejs/wasm-nodejs@1.9.2 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()Expected result
The output span is incorrect
Code of Conduct
- I agree to follow Biome's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
L-JavaScriptLanguage: JavaScript and super languagesLanguage: JavaScript and super languagesS-Help-wantedStatus: you're familiar with the code base and want to help the projectStatus: you're familiar with the code base and want to help the projectgood first issueGood for newcomersGood for newcomers